@@ -18,7 +18,269 @@ export type ChannelSetupPlugin = {
1818 config : ChannelConfigAdapter < unknown > ;
1919 setup ?: ChannelSetupAdapter ;
2020 setupWizard ?: ChannelSetupWizard | ChannelSetupWizardAdapter ;
21- setupWizard ?: ChannelSetupWizard | ChannelSetupWizardAdapter ;
21+ } ;
22+
23+ export type ChannelSetupWizardStatus = {
24+ configuredLabel : string ;
25+ unconfiguredLabel : string ;
26+ configuredHint ?: string ;
27+ unconfiguredHint ?: string ;
28+ configuredScore ?: number ;
29+ unconfiguredScore ?: number ;
30+ resolveConfigured : ( params : {
31+ cfg : OpenClawConfig ;
32+ accountId ?: string ;
33+ } ) => boolean | Promise < boolean > ;
34+ resolveStatusLines ?: ( params : {
35+ cfg : OpenClawConfig ;
36+ accountId ?: string ;
37+ configured : boolean ;
38+ } ) => string [ ] | Promise < string [ ] > ;
39+ resolveSelectionHint ?: ( params : {
40+ cfg : OpenClawConfig ;
41+ accountId ?: string ;
42+ configured : boolean ;
43+ } ) => string | undefined | Promise < string | undefined > ;
44+ resolveQuickstartScore ?: ( params : {
45+ cfg : OpenClawConfig ;
46+ accountId ?: string ;
47+ configured : boolean ;
48+ } ) => number | undefined | Promise < number | undefined > ;
49+ } ;
50+
51+ export type ChannelSetupWizardCredentialState = {
52+ accountConfigured : boolean ;
53+ hasConfiguredValue : boolean ;
54+ resolvedValue ?: string ;
55+ envValue ?: string ;
56+ } ;
57+
58+ export type ChannelSetupWizardCredentialValues = Partial < Record < string , string > > ;
59+
60+ export type ChannelSetupWizardNote = {
61+ title : string ;
62+ lines : string [ ] ;
63+ shouldShow ?: ( params : {
64+ cfg : OpenClawConfig ;
65+ accountId : string ;
66+ credentialValues : ChannelSetupWizardCredentialValues ;
67+ } ) => boolean | Promise < boolean > ;
68+ } ;
69+
70+ export type ChannelSetupWizardEnvShortcut = {
71+ prompt : string ;
72+ preferredEnvVar ?: string ;
73+ isAvailable : ( params : { cfg : OpenClawConfig ; accountId : string } ) => boolean ;
74+ apply : ( params : {
75+ cfg : OpenClawConfig ;
76+ accountId : string ;
77+ } ) => OpenClawConfig | Promise < OpenClawConfig > ;
78+ } ;
79+
80+ export type ChannelSetupWizardCredential = {
81+ inputKey : keyof ChannelSetupInput ;
82+ providerHint : string ;
83+ credentialLabel : string ;
84+ preferredEnvVar ?: string ;
85+ helpTitle ?: string ;
86+ helpLines ?: string [ ] ;
87+ envPrompt : string ;
88+ keepPrompt : string ;
89+ inputPrompt : string ;
90+ allowEnv ?: ( params : { cfg : OpenClawConfig ; accountId : string } ) => boolean ;
91+ inspect : ( params : {
92+ cfg : OpenClawConfig ;
93+ accountId : string ;
94+ } ) => ChannelSetupWizardCredentialState ;
95+ shouldPrompt ?: ( params : {
96+ cfg : OpenClawConfig ;
97+ accountId : string ;
98+ credentialValues : ChannelSetupWizardCredentialValues ;
99+ currentValue ?: string ;
100+ state : ChannelSetupWizardCredentialState ;
101+ } ) => boolean | Promise < boolean > ;
102+ applyUseEnv ?: ( params : {
103+ cfg : OpenClawConfig ;
104+ accountId : string ;
105+ } ) => OpenClawConfig | Promise < OpenClawConfig > ;
106+ applySet ?: ( params : {
107+ cfg : OpenClawConfig ;
108+ accountId : string ;
109+ credentialValues : ChannelSetupWizardCredentialValues ;
110+ value : unknown ;
111+ resolvedValue : string ;
112+ } ) => OpenClawConfig | Promise < OpenClawConfig > ;
113+ } ;
114+
115+ export type ChannelSetupWizardTextInput = {
116+ inputKey : keyof ChannelSetupInput ;
117+ message : string ;
118+ placeholder ?: string ;
119+ required ?: boolean ;
120+ applyEmptyValue ?: boolean ;
121+ helpTitle ?: string ;
122+ helpLines ?: string [ ] ;
123+ confirmCurrentValue ?: boolean ;
124+ keepPrompt ?: string | ( ( value : string ) => string ) ;
125+ currentValue ?: ( params : {
126+ cfg : OpenClawConfig ;
127+ accountId : string ;
128+ credentialValues : ChannelSetupWizardCredentialValues ;
129+ } ) => string | undefined | Promise < string | undefined > ;
130+ initialValue ?: ( params : {
131+ cfg : OpenClawConfig ;
132+ accountId : string ;
133+ credentialValues : ChannelSetupWizardCredentialValues ;
134+ } ) => string | undefined | Promise < string | undefined > ;
135+ shouldPrompt ?: ( params : {
136+ cfg : OpenClawConfig ;
137+ accountId : string ;
138+ credentialValues : ChannelSetupWizardCredentialValues ;
139+ currentValue ?: string ;
140+ } ) => boolean | Promise < boolean > ;
141+ applyCurrentValue ?: boolean ;
142+ validate ?: ( params : {
143+ value : string ;
144+ cfg : OpenClawConfig ;
145+ accountId : string ;
146+ credentialValues : ChannelSetupWizardCredentialValues ;
147+ } ) => string | undefined ;
148+ normalizeValue ?: ( params : {
149+ value : string ;
150+ cfg : OpenClawConfig ;
151+ accountId : string ;
152+ credentialValues : ChannelSetupWizardCredentialValues ;
153+ } ) => string ;
154+ applySet ?: ( params : {
155+ cfg : OpenClawConfig ;
156+ accountId : string ;
157+ value : string ;
158+ } ) => OpenClawConfig | Promise < OpenClawConfig > ;
159+ } ;
160+
161+ export type ChannelSetupWizardAllowFromEntry = {
162+ input : string ;
163+ resolved : boolean ;
164+ id : string | null ;
165+ } ;
166+
167+ export type ChannelSetupWizardAllowFrom = {
168+ helpTitle ?: string ;
169+ helpLines ?: string [ ] ;
170+ credentialInputKey ?: keyof ChannelSetupInput ;
171+ message : string ;
172+ placeholder : string ;
173+ invalidWithoutCredentialNote : string ;
174+ parseInputs ?: ( raw : string ) => string [ ] ;
175+ parseId : ( raw : string ) => string | null ;
176+ resolveEntries : ( params : {
177+ cfg : OpenClawConfig ;
178+ accountId : string ;
179+ credentialValues : ChannelSetupWizardCredentialValues ;
180+ entries : string [ ] ;
181+ } ) => Promise < ChannelSetupWizardAllowFromEntry [ ] > ;
182+ apply : ( params : {
183+ cfg : OpenClawConfig ;
184+ accountId : string ;
185+ allowFrom : string [ ] ;
186+ } ) => OpenClawConfig | Promise < OpenClawConfig > ;
187+ } ;
188+
189+ export type ChannelSetupWizardGroupAccess = {
190+ label : string ;
191+ placeholder : string ;
192+ helpTitle ?: string ;
193+ helpLines ?: string [ ] ;
194+ skipAllowlistEntries ?: boolean ;
195+ currentPolicy : ( params : { cfg : OpenClawConfig ; accountId : string } ) => ChannelAccessPolicy ;
196+ currentEntries : ( params : { cfg : OpenClawConfig ; accountId : string } ) => string [ ] ;
197+ updatePrompt : ( params : { cfg : OpenClawConfig ; accountId : string } ) => boolean ;
198+ setPolicy : ( params : {
199+ cfg : OpenClawConfig ;
200+ accountId : string ;
201+ policy : ChannelAccessPolicy ;
202+ } ) => OpenClawConfig ;
203+ resolveAllowlist ?: ( params : {
204+ cfg : OpenClawConfig ;
205+ accountId : string ;
206+ credentialValues : ChannelSetupWizardCredentialValues ;
207+ entries : string [ ] ;
208+ prompter : Pick < WizardPrompter , "note" > ;
209+ } ) => Promise < unknown > ;
210+ applyAllowlist ?: ( params : {
211+ cfg : OpenClawConfig ;
212+ accountId : string ;
213+ resolved : unknown ;
214+ } ) => OpenClawConfig ;
215+ } ;
216+
217+ export type ChannelSetupWizardPrepare = ( params : {
218+ cfg : OpenClawConfig ;
219+ accountId : string ;
220+ credentialValues : ChannelSetupWizardCredentialValues ;
221+ runtime : ChannelSetupConfigureContext [ "runtime" ] ;
222+ prompter : WizardPrompter ;
223+ options ?: ChannelSetupConfigureContext [ "options" ] ;
224+ } ) =>
225+ | {
226+ cfg ?: OpenClawConfig ;
227+ credentialValues ?: ChannelSetupWizardCredentialValues ;
228+ }
229+ | void
230+ | Promise < {
231+ cfg ?: OpenClawConfig ;
232+ credentialValues ?: ChannelSetupWizardCredentialValues ;
233+ } | void > ;
234+
235+ export type ChannelSetupWizardFinalize = ( params : {
236+ cfg : OpenClawConfig ;
237+ accountId : string ;
238+ credentialValues : ChannelSetupWizardCredentialValues ;
239+ runtime : ChannelSetupConfigureContext [ "runtime" ] ;
240+ prompter : WizardPrompter ;
241+ options ?: ChannelSetupConfigureContext [ "options" ] ;
242+ forceAllowFrom : boolean ;
243+ } ) =>
244+ | {
245+ cfg ?: OpenClawConfig ;
246+ credentialValues ?: ChannelSetupWizardCredentialValues ;
247+ }
248+ | void
249+ | Promise < {
250+ cfg ?: OpenClawConfig ;
251+ credentialValues ?: ChannelSetupWizardCredentialValues ;
252+ } | void > ;
253+
254+ export type ChannelSetupWizard = {
255+ channel : string ;
256+ status : ChannelSetupWizardStatus ;
257+ introNote ?: ChannelSetupWizardNote ;
258+ envShortcut ?: ChannelSetupWizardEnvShortcut ;
259+ resolveAccountIdForConfigure ?: ( params : {
260+ cfg : OpenClawConfig ;
261+ prompter : WizardPrompter ;
262+ options ?: ChannelSetupConfigureContext [ "options" ] ;
263+ accountOverride ?: string ;
264+ shouldPromptAccountIds : boolean ;
265+ listAccountIds : ChannelSetupPlugin [ "config" ] [ "listAccountIds" ] ;
266+ defaultAccountId : string ;
267+ } ) => string | Promise < string > ;
268+ resolveShouldPromptAccountIds ?: ( params : {
269+ cfg : OpenClawConfig ;
270+ options ?: ChannelSetupConfigureContext [ "options" ] ;
271+ shouldPromptAccountIds : boolean ;
272+ } ) => boolean ;
273+ prepare ?: ChannelSetupWizardPrepare ;
274+ stepOrder ?: "credentials-first" | "text-first" ;
275+ credentials : ChannelSetupWizardCredential [ ] ;
276+ textInputs ?: ChannelSetupWizardTextInput [ ] ;
277+ finalize ?: ChannelSetupWizardFinalize ;
278+ completionNote ?: ChannelSetupWizardNote ;
279+ dmPolicy ?: ChannelSetupDmPolicy ;
280+ allowFrom ?: ChannelSetupWizardAllowFrom ;
281+ groupAccess ?: ChannelSetupWizardGroupAccess ;
282+ disable ?: ( cfg : OpenClawConfig ) => OpenClawConfig ;
283+ onAccountRecorded ?: ChannelSetupWizardAdapter [ "onAccountRecorded" ] ;
22284} ;
23285
24286export type SetupChannelsOptions = {
0 commit comments