@searchfe/openclaw-baiduapp 0.1.7 → 0.1.8-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -9
- package/dist/index.js +1272 -338
- package/dist/index.js.map +1 -1
- package/openclaw.plugin.json +4 -1
- package/package.json +4 -2
- package/dist/index.d.ts +0 -421
package/openclaw.plugin.json
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
"id": "openclaw-baiduapp",
|
|
3
3
|
"name": "Baidu App",
|
|
4
4
|
"description": "百度App消息渠道插件(支持主动推送)",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.8",
|
|
6
6
|
"channels": ["openclaw-baiduapp"],
|
|
7
7
|
"configSchema": {
|
|
8
8
|
"type": "object",
|
|
9
9
|
"additionalProperties": false,
|
|
10
10
|
"properties": {
|
|
11
11
|
"enabled": {"type": "boolean"},
|
|
12
|
+
"pollingEnabled": {"type": "boolean"},
|
|
12
13
|
"name": {"type": "string"},
|
|
13
14
|
"appKey": {"type": "string"},
|
|
14
15
|
"appSecret": {"type": "string"},
|
|
@@ -27,6 +28,7 @@
|
|
|
27
28
|
"properties": {
|
|
28
29
|
"name": {"type": "string"},
|
|
29
30
|
"enabled": {"type": "boolean"},
|
|
31
|
+
"pollingEnabled": {"type": "boolean"},
|
|
30
32
|
"appKey": {"type": "string"},
|
|
31
33
|
"appSecret": {"type": "string"},
|
|
32
34
|
"webhookPath": {"type": "string"},
|
|
@@ -41,6 +43,7 @@
|
|
|
41
43
|
}
|
|
42
44
|
},
|
|
43
45
|
"uiHints": {
|
|
46
|
+
"pollingEnabled": {"label": "Polling Enabled"},
|
|
44
47
|
"appKey": {"label": "AppKey"},
|
|
45
48
|
"appSecret": {"label": "AppSecret", "sensitive": true},
|
|
46
49
|
"token": {"label": "回调Token", "sensitive": true},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@searchfe/openclaw-baiduapp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8-beta.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenClaw Baidu App channel plugin (百度App消息渠道插件)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -89,7 +89,9 @@
|
|
|
89
89
|
"release:minor": "npm run build && npm version minor && npm publish",
|
|
90
90
|
"release:major": "npm run build && npm version major && npm publish"
|
|
91
91
|
},
|
|
92
|
-
"dependencies": {
|
|
92
|
+
"dependencies": {
|
|
93
|
+
"@baiducloud/sdk": "^1.0.7"
|
|
94
|
+
},
|
|
93
95
|
"devDependencies": {
|
|
94
96
|
"@types/node": "^22.0.0",
|
|
95
97
|
"tsup": "^8.2.0",
|
package/dist/index.d.ts
DELETED
|
@@ -1,421 +0,0 @@
|
|
|
1
|
-
import { IncomingMessage, ServerResponse } from 'http';
|
|
2
|
-
|
|
3
|
-
interface BaiduAppAccountConfig {
|
|
4
|
-
name?: string;
|
|
5
|
-
enabled?: boolean;
|
|
6
|
-
webhookPath?: string;
|
|
7
|
-
token?: string;
|
|
8
|
-
encodingAESKey?: string;
|
|
9
|
-
appKey?: string;
|
|
10
|
-
appSecret?: string;
|
|
11
|
-
apiBase?: string;
|
|
12
|
-
welcomeText?: string;
|
|
13
|
-
}
|
|
14
|
-
type BaiduAppConfig = BaiduAppAccountConfig & {
|
|
15
|
-
accounts?: Record<string, BaiduAppAccountConfig>;
|
|
16
|
-
defaultAccount?: string;
|
|
17
|
-
};
|
|
18
|
-
interface ResolvedBaiduAppAccount {
|
|
19
|
-
accountId: string;
|
|
20
|
-
name?: string;
|
|
21
|
-
enabled: boolean;
|
|
22
|
-
configured: boolean;
|
|
23
|
-
token?: string;
|
|
24
|
-
encodingAESKey?: string;
|
|
25
|
-
appKey?: string;
|
|
26
|
-
appSecret?: string;
|
|
27
|
-
apiBase: string;
|
|
28
|
-
canSendActive: boolean;
|
|
29
|
-
config: BaiduAppAccountConfig;
|
|
30
|
-
}
|
|
31
|
-
interface BaiduAppInboundBase {
|
|
32
|
-
MsgId?: string;
|
|
33
|
-
msgid?: string;
|
|
34
|
-
aibotid?: string;
|
|
35
|
-
response_url?: string;
|
|
36
|
-
from?: {
|
|
37
|
-
appkey?: string;
|
|
38
|
-
};
|
|
39
|
-
ToUserName?: string;
|
|
40
|
-
CreateTime?: number;
|
|
41
|
-
MsgType?: string;
|
|
42
|
-
msgtype?: string;
|
|
43
|
-
BotID?: number;
|
|
44
|
-
}
|
|
45
|
-
type BaiduAppInboundText = BaiduAppInboundBase & {
|
|
46
|
-
msgtype: 'text';
|
|
47
|
-
MsgType?: 'text';
|
|
48
|
-
text?: {
|
|
49
|
-
content?: string;
|
|
50
|
-
};
|
|
51
|
-
Content?: string;
|
|
52
|
-
quote?: unknown;
|
|
53
|
-
};
|
|
54
|
-
type BaiduAppInboundEvent = BaiduAppInboundBase & {
|
|
55
|
-
msgtype: 'event';
|
|
56
|
-
MsgType?: 'event';
|
|
57
|
-
create_time?: number;
|
|
58
|
-
Event?: string;
|
|
59
|
-
EventKey?: string;
|
|
60
|
-
event?: {
|
|
61
|
-
eventtype?: string;
|
|
62
|
-
[key: string]: unknown;
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
type BaiduAppInboundMessage = BaiduAppInboundText | BaiduAppInboundEvent | (BaiduAppInboundBase & Record<string, unknown>);
|
|
66
|
-
|
|
67
|
-
declare const DEFAULT_ACCOUNT_ID = "default";
|
|
68
|
-
interface PluginConfig {
|
|
69
|
-
session?: {
|
|
70
|
-
store?: unknown;
|
|
71
|
-
};
|
|
72
|
-
channels?: {
|
|
73
|
-
'openclaw-baiduapp'?: BaiduAppConfig;
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
declare const baiduAppPlugin: {
|
|
78
|
-
id: string;
|
|
79
|
-
meta: {
|
|
80
|
-
id: "openclaw-baiduapp";
|
|
81
|
-
label: "Baidu App";
|
|
82
|
-
selectionLabel: "Baidu Search AI (百度搜索对话式AI)";
|
|
83
|
-
docsPath: "/channels/openclaw-baiduapp";
|
|
84
|
-
docsLabel: "openclaw-baiduapp";
|
|
85
|
-
blurb: "百度搜索对话式AI,支持主动发送消息";
|
|
86
|
-
aliases: readonly ["baidu-ai", "百度搜索AI"];
|
|
87
|
-
order: 85;
|
|
88
|
-
};
|
|
89
|
-
capabilities: {
|
|
90
|
-
chatTypes: readonly ["direct"];
|
|
91
|
-
media: boolean;
|
|
92
|
-
reactions: boolean;
|
|
93
|
-
threads: boolean;
|
|
94
|
-
edit: boolean;
|
|
95
|
-
reply: boolean;
|
|
96
|
-
polls: boolean;
|
|
97
|
-
activeSend: boolean;
|
|
98
|
-
};
|
|
99
|
-
messaging: {
|
|
100
|
-
normalizeTarget: (raw: string) => string | undefined;
|
|
101
|
-
targetResolver: {
|
|
102
|
-
looksLikeId: () => boolean;
|
|
103
|
-
hint: string;
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
configSchema: {
|
|
107
|
-
schema: {
|
|
108
|
-
type: string;
|
|
109
|
-
additionalProperties: boolean;
|
|
110
|
-
properties: {
|
|
111
|
-
name: {
|
|
112
|
-
type: string;
|
|
113
|
-
};
|
|
114
|
-
enabled: {
|
|
115
|
-
type: string;
|
|
116
|
-
};
|
|
117
|
-
webhookPath: {
|
|
118
|
-
type: string;
|
|
119
|
-
};
|
|
120
|
-
token: {
|
|
121
|
-
type: string;
|
|
122
|
-
};
|
|
123
|
-
encodingAESKey: {
|
|
124
|
-
type: string;
|
|
125
|
-
};
|
|
126
|
-
appKey: {
|
|
127
|
-
type: string;
|
|
128
|
-
};
|
|
129
|
-
appSecret: {
|
|
130
|
-
type: string;
|
|
131
|
-
};
|
|
132
|
-
apiBase: {
|
|
133
|
-
type: string;
|
|
134
|
-
};
|
|
135
|
-
welcomeText: {
|
|
136
|
-
type: string;
|
|
137
|
-
};
|
|
138
|
-
defaultAccount: {
|
|
139
|
-
type: string;
|
|
140
|
-
};
|
|
141
|
-
accounts: {
|
|
142
|
-
type: string;
|
|
143
|
-
additionalProperties: {
|
|
144
|
-
type: string;
|
|
145
|
-
additionalProperties: boolean;
|
|
146
|
-
properties: {
|
|
147
|
-
name: {
|
|
148
|
-
type: string;
|
|
149
|
-
};
|
|
150
|
-
enabled: {
|
|
151
|
-
type: string;
|
|
152
|
-
};
|
|
153
|
-
webhookPath: {
|
|
154
|
-
type: string;
|
|
155
|
-
};
|
|
156
|
-
token: {
|
|
157
|
-
type: string;
|
|
158
|
-
};
|
|
159
|
-
encodingAESKey: {
|
|
160
|
-
type: string;
|
|
161
|
-
};
|
|
162
|
-
appKey: {
|
|
163
|
-
type: string;
|
|
164
|
-
};
|
|
165
|
-
appSecret: {
|
|
166
|
-
type: string;
|
|
167
|
-
};
|
|
168
|
-
apiBase: {
|
|
169
|
-
type: string;
|
|
170
|
-
};
|
|
171
|
-
welcomeText: {
|
|
172
|
-
type: string;
|
|
173
|
-
};
|
|
174
|
-
};
|
|
175
|
-
};
|
|
176
|
-
};
|
|
177
|
-
};
|
|
178
|
-
};
|
|
179
|
-
};
|
|
180
|
-
reload: {
|
|
181
|
-
configPrefixes: string[];
|
|
182
|
-
};
|
|
183
|
-
config: {
|
|
184
|
-
listAccountIds: (cfg: PluginConfig) => string[];
|
|
185
|
-
resolveAccount: (cfg: PluginConfig, accountId?: string) => ResolvedBaiduAppAccount;
|
|
186
|
-
defaultAccountId: (cfg: PluginConfig) => string;
|
|
187
|
-
setAccountEnabled: (params: {
|
|
188
|
-
cfg: PluginConfig;
|
|
189
|
-
accountId?: string;
|
|
190
|
-
enabled: boolean;
|
|
191
|
-
}) => PluginConfig;
|
|
192
|
-
deleteAccount: (params: {
|
|
193
|
-
cfg: PluginConfig;
|
|
194
|
-
accountId?: string;
|
|
195
|
-
}) => PluginConfig;
|
|
196
|
-
isConfigured: (account: ResolvedBaiduAppAccount) => boolean;
|
|
197
|
-
describeAccount: (account: ResolvedBaiduAppAccount) => {
|
|
198
|
-
accountId: string;
|
|
199
|
-
name: string | undefined;
|
|
200
|
-
enabled: boolean;
|
|
201
|
-
configured: boolean;
|
|
202
|
-
canSendActive: boolean;
|
|
203
|
-
webhookPath: string;
|
|
204
|
-
};
|
|
205
|
-
};
|
|
206
|
-
directory: {
|
|
207
|
-
canResolve: (params: {
|
|
208
|
-
target: string;
|
|
209
|
-
}) => boolean;
|
|
210
|
-
resolveTarget: (params: {
|
|
211
|
-
cfg: PluginConfig;
|
|
212
|
-
target: string;
|
|
213
|
-
}) => {
|
|
214
|
-
channel: string;
|
|
215
|
-
accountId?: string;
|
|
216
|
-
to: string;
|
|
217
|
-
} | null;
|
|
218
|
-
resolveTargets: (params: {
|
|
219
|
-
cfg: PluginConfig;
|
|
220
|
-
targets: string[];
|
|
221
|
-
}) => Array<{
|
|
222
|
-
channel: string;
|
|
223
|
-
accountId?: string;
|
|
224
|
-
to: string;
|
|
225
|
-
}>;
|
|
226
|
-
getTargetFormats: () => string[];
|
|
227
|
-
};
|
|
228
|
-
outbound: {
|
|
229
|
-
deliveryMode: string;
|
|
230
|
-
sendText: (params: {
|
|
231
|
-
cfg: PluginConfig;
|
|
232
|
-
accountId?: string;
|
|
233
|
-
to: string;
|
|
234
|
-
text: string;
|
|
235
|
-
options?: {
|
|
236
|
-
markdown?: boolean;
|
|
237
|
-
};
|
|
238
|
-
}) => Promise<{
|
|
239
|
-
channel: string;
|
|
240
|
-
ok: boolean;
|
|
241
|
-
messageId: string;
|
|
242
|
-
error?: Error;
|
|
243
|
-
}>;
|
|
244
|
-
sendMedia: (params: {
|
|
245
|
-
cfg: PluginConfig;
|
|
246
|
-
accountId?: string | null;
|
|
247
|
-
to: string;
|
|
248
|
-
text: string;
|
|
249
|
-
mediaUrl?: string;
|
|
250
|
-
}) => Promise<{
|
|
251
|
-
channel: string;
|
|
252
|
-
ok: boolean;
|
|
253
|
-
messageId: string;
|
|
254
|
-
error?: Error;
|
|
255
|
-
}>;
|
|
256
|
-
};
|
|
257
|
-
gateway: {
|
|
258
|
-
startAccount: (ctx: {
|
|
259
|
-
cfg: PluginConfig;
|
|
260
|
-
runtime?: unknown;
|
|
261
|
-
abortSignal?: AbortSignal;
|
|
262
|
-
accountId: string;
|
|
263
|
-
setStatus?: (status: Record<string, unknown>) => void;
|
|
264
|
-
log?: {
|
|
265
|
-
info: (msg: string) => void;
|
|
266
|
-
error: (msg: string) => void;
|
|
267
|
-
};
|
|
268
|
-
}) => Promise<void>;
|
|
269
|
-
stopAccount: (ctx: {
|
|
270
|
-
accountId: string;
|
|
271
|
-
setStatus?: (status: Record<string, unknown>) => void;
|
|
272
|
-
}) => Promise<void>;
|
|
273
|
-
};
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
interface PluginRuntime {
|
|
277
|
-
log?: (msg: string) => void;
|
|
278
|
-
error?: (msg: string) => void;
|
|
279
|
-
channel?: {
|
|
280
|
-
routing?: {
|
|
281
|
-
resolveAgentRoute?: (params: {
|
|
282
|
-
cfg: unknown;
|
|
283
|
-
channel: string;
|
|
284
|
-
accountId?: string;
|
|
285
|
-
peer: {
|
|
286
|
-
kind: string;
|
|
287
|
-
id: string;
|
|
288
|
-
};
|
|
289
|
-
}) => {
|
|
290
|
-
sessionKey: string;
|
|
291
|
-
accountId: string;
|
|
292
|
-
agentId?: string;
|
|
293
|
-
};
|
|
294
|
-
};
|
|
295
|
-
reply?: {
|
|
296
|
-
dispatchReplyFromConfig?: (params: {
|
|
297
|
-
ctx: unknown;
|
|
298
|
-
cfg: unknown;
|
|
299
|
-
dispatcher?: unknown;
|
|
300
|
-
replyOptions?: unknown;
|
|
301
|
-
}) => Promise<{
|
|
302
|
-
queuedFinal: boolean;
|
|
303
|
-
counts: {
|
|
304
|
-
final: number;
|
|
305
|
-
};
|
|
306
|
-
}>;
|
|
307
|
-
dispatchReplyWithBufferedBlockDispatcher?: (params: {
|
|
308
|
-
ctx: unknown;
|
|
309
|
-
cfg: unknown;
|
|
310
|
-
dispatcherOptions: {
|
|
311
|
-
deliver: (payload: {
|
|
312
|
-
text?: string;
|
|
313
|
-
}) => Promise<void>;
|
|
314
|
-
onError?: (err: unknown, info: {
|
|
315
|
-
kind: string;
|
|
316
|
-
}) => void;
|
|
317
|
-
};
|
|
318
|
-
}) => Promise<void>;
|
|
319
|
-
finalizeInboundContext?: (ctx: unknown) => unknown;
|
|
320
|
-
createReplyDispatcher?: (params: unknown) => unknown;
|
|
321
|
-
createReplyDispatcherWithTyping?: (params: unknown) => {
|
|
322
|
-
dispatcher: unknown;
|
|
323
|
-
replyOptions?: unknown;
|
|
324
|
-
markDispatchIdle?: () => void;
|
|
325
|
-
};
|
|
326
|
-
resolveHumanDelayConfig?: (cfg: unknown, agentId?: string) => unknown;
|
|
327
|
-
resolveEnvelopeFormatOptions?: (cfg: unknown) => unknown;
|
|
328
|
-
formatAgentEnvelope?: (params: {
|
|
329
|
-
channel: string;
|
|
330
|
-
from: string;
|
|
331
|
-
previousTimestamp?: number;
|
|
332
|
-
envelope?: unknown;
|
|
333
|
-
body: string;
|
|
334
|
-
}) => string;
|
|
335
|
-
};
|
|
336
|
-
session?: {
|
|
337
|
-
resolveStorePath?: (store: unknown, params: {
|
|
338
|
-
agentId?: string;
|
|
339
|
-
}) => string | undefined;
|
|
340
|
-
readSessionUpdatedAt?: (params: {
|
|
341
|
-
storePath?: string;
|
|
342
|
-
sessionKey: string;
|
|
343
|
-
}) => number | null;
|
|
344
|
-
recordInboundSession?: (params: {
|
|
345
|
-
storePath: string;
|
|
346
|
-
sessionKey: string;
|
|
347
|
-
ctx: unknown;
|
|
348
|
-
onRecordError?: (err: unknown) => void;
|
|
349
|
-
}) => Promise<void>;
|
|
350
|
-
};
|
|
351
|
-
text?: {
|
|
352
|
-
resolveMarkdownTableMode?: (params: {
|
|
353
|
-
cfg: unknown;
|
|
354
|
-
channel: string;
|
|
355
|
-
accountId?: string;
|
|
356
|
-
}) => unknown;
|
|
357
|
-
convertMarkdownTables?: (text: string, mode: unknown) => string;
|
|
358
|
-
};
|
|
359
|
-
};
|
|
360
|
-
system?: {
|
|
361
|
-
enqueueSystemEvent?: (message: string, options?: unknown) => void;
|
|
362
|
-
};
|
|
363
|
-
[key: string]: unknown;
|
|
364
|
-
}
|
|
365
|
-
declare function setBaiduAppRuntime(next: PluginRuntime): void;
|
|
366
|
-
declare function getBaiduAppRuntime(): PluginRuntime;
|
|
367
|
-
|
|
368
|
-
interface SendMessageResult {
|
|
369
|
-
ok: boolean;
|
|
370
|
-
errcode?: number;
|
|
371
|
-
errmsg?: string;
|
|
372
|
-
invaliduser?: string;
|
|
373
|
-
msgid?: string;
|
|
374
|
-
}
|
|
375
|
-
interface SendMessageOptions$1 {
|
|
376
|
-
msgid?: string;
|
|
377
|
-
streamId?: string;
|
|
378
|
-
chunkKey?: number;
|
|
379
|
-
}
|
|
380
|
-
declare function sendBaiduAppMessage(account: ResolvedBaiduAppAccount, message: string, options?: SendMessageOptions$1): Promise<SendMessageResult>;
|
|
381
|
-
|
|
382
|
-
interface SendMessageOptions {
|
|
383
|
-
text?: string;
|
|
384
|
-
}
|
|
385
|
-
interface SendResult {
|
|
386
|
-
ok: boolean;
|
|
387
|
-
msgid?: string;
|
|
388
|
-
error?: string;
|
|
389
|
-
}
|
|
390
|
-
declare function sendBaiduDM(account: ResolvedBaiduAppAccount, options: SendMessageOptions): Promise<SendResult>;
|
|
391
|
-
declare function sendBaidu(account: ResolvedBaiduAppAccount, options: SendMessageOptions): Promise<SendResult>;
|
|
392
|
-
|
|
393
|
-
interface MoltbotPluginApi {
|
|
394
|
-
registerChannel: (opts: {
|
|
395
|
-
plugin: unknown;
|
|
396
|
-
}) => void;
|
|
397
|
-
registerHttpRoute: (params: {
|
|
398
|
-
path: string;
|
|
399
|
-
handler: (req: IncomingMessage, res: ServerResponse) => Promise<boolean | void> | boolean | void;
|
|
400
|
-
auth: 'plugin' | 'gateway';
|
|
401
|
-
match?: 'exact' | 'prefix';
|
|
402
|
-
replaceExisting?: boolean;
|
|
403
|
-
}) => void;
|
|
404
|
-
registerHttpHandler: any;
|
|
405
|
-
runtime?: unknown;
|
|
406
|
-
[key: string]: unknown;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
declare const plugin: {
|
|
410
|
-
id: string;
|
|
411
|
-
name: string;
|
|
412
|
-
description: string;
|
|
413
|
-
configSchema: {
|
|
414
|
-
type: string;
|
|
415
|
-
additionalProperties: boolean;
|
|
416
|
-
properties: {};
|
|
417
|
-
};
|
|
418
|
-
register(api: MoltbotPluginApi): void;
|
|
419
|
-
};
|
|
420
|
-
|
|
421
|
-
export { type BaiduAppConfig, type BaiduAppInboundMessage, DEFAULT_ACCOUNT_ID, type MoltbotPluginApi, type ResolvedBaiduAppAccount, type SendMessageOptions$1 as SendBaiduAppMessageOptions, type SendMessageOptions, type SendResult, baiduAppPlugin, plugin as default, getBaiduAppRuntime, sendBaidu, sendBaiduAppMessage, sendBaiduDM, setBaiduAppRuntime };
|