-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathopenclaw-plugin-sdk.d.ts
More file actions
208 lines (195 loc) · 6.88 KB
/
openclaw-plugin-sdk.d.ts
File metadata and controls
208 lines (195 loc) · 6.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
declare module "openclaw/plugin-sdk" {
export type OpenClawPluginApi = any;
export type OpenClawConfig = any;
export type PluginRuntime = any;
export type ChannelPlugin<T = any> = any;
export type ChannelAccountSnapshot = any;
export type ChannelConfigSchema = any;
export type DmPolicy = "pairing" | "allowlist" | "open" | "disabled";
export type WizardPrompter = {
note(message: string, title?: string): Promise<void>;
text(opts: {
message: string;
placeholder?: string;
initialValue?: string;
validate?: (value: string | undefined) => string | undefined;
}): Promise<string>;
confirm(opts: { message: string; initialValue?: boolean }): Promise<boolean>;
select<T = string>(opts: {
message: string;
options: Array<{ value: T; label: string }>;
initialValue?: T;
}): Promise<T>;
};
export function emptyPluginConfigSchema(): any;
}
declare module "openclaw/plugin-sdk/core" {
export const DEFAULT_ACCOUNT_ID: string;
export function normalizeAccountId(id: string | null | undefined): string;
export function deleteAccountFromConfigSection(params: {
cfg: any;
sectionKey: string;
accountId: string;
clearBaseFields?: string[];
allowTopLevel?: boolean;
}): any;
export function formatPairingApproveHint(channel: string): string;
export function setAccountEnabledInConfigSection(params: {
cfg: any;
sectionKey: string;
accountId: string;
enabled: boolean;
allowTopLevel?: boolean;
}): any;
}
declare module "openclaw/plugin-sdk/setup" {
export type OpenClawConfig = any;
export type ChannelSetupWizardCredentialState = {
accountConfigured: boolean;
hasConfiguredValue: boolean;
resolvedValue?: string;
envValue?: string;
};
export type ChannelSetupWizardCredential = {
inputKey: string;
providerHint: string;
credentialLabel: string;
preferredEnvVar?: string;
helpTitle?: string;
helpLines?: string[];
envPrompt?: string;
keepPrompt?: string;
inputPrompt: string;
skipSecretOption?: boolean;
allowEnv?: (params: { cfg: any; accountId: string }) => boolean;
inspect: (params: { cfg: any; accountId: string }) => ChannelSetupWizardCredentialState;
shouldPrompt?: (params: {
cfg: any;
accountId: string;
credentialValues: Record<string, string | undefined>;
currentValue?: string;
state: ChannelSetupWizardCredentialState;
}) => boolean | Promise<boolean>;
applyUseEnv?: (params: { cfg: any; accountId: string }) => any | Promise<any>;
applySet?: (params: {
cfg: any;
accountId: string;
credentialValues: Record<string, string | undefined>;
value: unknown;
resolvedValue: string;
}) => any | Promise<any>;
};
export type ChannelSetupWizardTextInput = {
inputKey: string;
message: string;
placeholder?: string;
required?: boolean;
applyEmptyValue?: boolean;
helpTitle?: string;
helpLines?: string[];
confirmCurrentValue?: boolean;
keepPrompt?: string | ((value: string) => string);
currentValue?: (params: {
cfg: any;
accountId: string;
credentialValues: Record<string, string | undefined>;
}) => string | undefined | Promise<string | undefined>;
initialValue?: (params: {
cfg: any;
accountId: string;
credentialValues: Record<string, string | undefined>;
}) => string | undefined | Promise<string | undefined>;
shouldPrompt?: (params: {
cfg: any;
accountId: string;
credentialValues: Record<string, string | undefined>;
currentValue?: string;
}) => boolean | Promise<boolean>;
applyCurrentValue?: boolean;
validate?: (params: {
value: string;
cfg: any;
accountId: string;
credentialValues: Record<string, string | undefined>;
}) => string | undefined;
normalizeValue?: (params: {
value: string;
cfg: any;
accountId: string;
credentialValues: Record<string, string | undefined>;
}) => string;
applySet?: (params: {
cfg: any;
accountId: string;
value: string;
}) => any | Promise<any>;
};
export type ChannelSetupWizardNote = {
title: string;
lines: string[];
shouldShow?: (params: {
cfg: any;
accountId: string;
credentialValues: Record<string, string | undefined>;
}) => boolean | Promise<boolean>;
};
export type ChannelSetupWizardStatus = {
configuredLabel: string;
unconfiguredLabel: string;
configuredHint?: string;
unconfiguredHint?: string;
configuredScore?: number;
unconfiguredScore?: number;
includeStatusLine?: boolean;
resolveConfigured: (params: { cfg: any }) => boolean | Promise<boolean>;
resolveStatusLines?: (params: { cfg: any; configured: boolean }) => string[] | Promise<string[]>;
resolveExtraStatusLines?: (params: { cfg: any }) => string[] | Promise<string[]>;
resolveQuickstartScore?: (params: { cfg: any; configured: boolean }) => number | undefined | Promise<number | undefined>;
};
export type ChannelSetupWizard = {
channel: string;
stepOrder?: "credentials-first" | "text-first";
status: ChannelSetupWizardStatus;
introNote?: ChannelSetupWizardNote;
credentials: ChannelSetupWizardCredential[];
textInputs?: ChannelSetupWizardTextInput[];
prepare?: (...args: any[]) => any;
finalize?: (...args: any[]) => any;
completionNote?: ChannelSetupWizardNote;
dmPolicy?: any;
allowFrom?: any;
groupAccess?: any;
disable?: (cfg: any) => any;
onAccountRecorded?: (...args: any[]) => any;
};
export type ChannelSetupAdapter = any;
export const DEFAULT_ACCOUNT_ID: string;
export function normalizeAccountId(id: string | null | undefined): string;
export function addWildcardAllowFrom(allowFrom?: any): any;
export function formatDocsLink(path: string, label: string): string;
export function createStandardChannelSetupStatus(params: {
channelLabel: string;
configuredLabel: string;
unconfiguredLabel: string;
configuredHint?: string;
unconfiguredHint?: string;
configuredScore?: number;
unconfiguredScore?: number;
includeStatusLine?: boolean;
resolveConfigured: (params: { cfg: any }) => boolean | Promise<boolean>;
resolveStatusLines?: (params: { cfg: any; configured: boolean }) => string[] | Promise<string[]>;
resolveExtraStatusLines?: (params: { cfg: any }) => string[] | Promise<string[]>;
resolveQuickstartScore?: (params: { cfg: any; configured: boolean }) => number | undefined | Promise<number | undefined>;
}): ChannelSetupWizardStatus;
export function setSetupChannelEnabled(cfg: any, channel: string, enabled: boolean): any;
export function patchChannelConfigForAccount(params: {
cfg: any;
channel: string;
accountId: string;
patch: Record<string, unknown>;
}): any;
export function splitSetupEntries(params: {
cfg: any;
channel: string;
}): any;
}