moltbot-feishu 0.1.0
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/LICENSE +21 -0
- package/README.md +99 -0
- package/clawdbot.plugin.json +33 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/src/accounts.d.ts +17 -0
- package/dist/src/accounts.d.ts.map +1 -0
- package/dist/src/accounts.js +81 -0
- package/dist/src/accounts.js.map +1 -0
- package/dist/src/channel.d.ts +8 -0
- package/dist/src/channel.d.ts.map +1 -0
- package/dist/src/channel.js +373 -0
- package/dist/src/channel.js.map +1 -0
- package/dist/src/config-schema.d.ts +157 -0
- package/dist/src/config-schema.d.ts.map +1 -0
- package/dist/src/config-schema.js +21 -0
- package/dist/src/config-schema.js.map +1 -0
- package/dist/src/dedup.d.ts +8 -0
- package/dist/src/dedup.d.ts.map +1 -0
- package/dist/src/dedup.js +25 -0
- package/dist/src/dedup.js.map +1 -0
- package/dist/src/group-filter.d.ts +15 -0
- package/dist/src/group-filter.d.ts.map +1 -0
- package/dist/src/group-filter.js +44 -0
- package/dist/src/group-filter.js.map +1 -0
- package/dist/src/media.d.ts +21 -0
- package/dist/src/media.d.ts.map +1 -0
- package/dist/src/media.js +133 -0
- package/dist/src/media.js.map +1 -0
- package/dist/src/onboarding.d.ts +51 -0
- package/dist/src/onboarding.d.ts.map +1 -0
- package/dist/src/onboarding.js +213 -0
- package/dist/src/onboarding.js.map +1 -0
- package/dist/src/probe.d.ts +10 -0
- package/dist/src/probe.d.ts.map +1 -0
- package/dist/src/probe.js +48 -0
- package/dist/src/probe.js.map +1 -0
- package/dist/src/receive.d.ts +25 -0
- package/dist/src/receive.d.ts.map +1 -0
- package/dist/src/receive.js +217 -0
- package/dist/src/receive.js.map +1 -0
- package/dist/src/runtime.d.ts +7 -0
- package/dist/src/runtime.d.ts.map +1 -0
- package/dist/src/runtime.js +14 -0
- package/dist/src/runtime.js.map +1 -0
- package/dist/src/send.d.ts +23 -0
- package/dist/src/send.d.ts.map +1 -0
- package/dist/src/send.js +158 -0
- package/dist/src/send.js.map +1 -0
- package/dist/src/status-issues.d.ts +7 -0
- package/dist/src/status-issues.d.ts.map +1 -0
- package/dist/src/status-issues.js +48 -0
- package/dist/src/status-issues.js.map +1 -0
- package/dist/src/types.d.ts +62 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +5 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +93 -0
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feishu ChannelPlugin + ChannelDock — core channel integration.
|
|
3
|
+
*/
|
|
4
|
+
import { applyAccountNameToChannelSection, buildChannelConfigSchema, DEFAULT_ACCOUNT_ID, deleteAccountFromConfigSection, formatPairingApproveHint, migrateBaseNameToDefaultAccount, normalizeAccountId, PAIRING_APPROVED_MESSAGE, setAccountEnabledInConfigSection, } from "clawdbot/plugin-sdk";
|
|
5
|
+
import { listFeishuAccountIds, resolveDefaultFeishuAccountId, resolveFeishuAccount, } from "./accounts.js";
|
|
6
|
+
import { FeishuConfigSchema } from "./config-schema.js";
|
|
7
|
+
import { feishuOnboardingAdapter } from "./onboarding.js";
|
|
8
|
+
import { probeFeishu } from "./probe.js";
|
|
9
|
+
import { sendTextMessage, sendMediaMessage } from "./send.js";
|
|
10
|
+
import { collectFeishuStatusIssues } from "./status-issues.js";
|
|
11
|
+
import { startFeishuProvider } from "./receive.js";
|
|
12
|
+
import * as Lark from "@larksuiteoapi/node-sdk";
|
|
13
|
+
const meta = {
|
|
14
|
+
id: "feishu",
|
|
15
|
+
label: "Feishu",
|
|
16
|
+
selectionLabel: "Feishu (飞书)",
|
|
17
|
+
docsPath: "/channels/feishu",
|
|
18
|
+
docsLabel: "feishu",
|
|
19
|
+
blurb: "Feishu (Lark) messaging platform with Bot WebSocket API.",
|
|
20
|
+
aliases: ["lark", "fs"],
|
|
21
|
+
order: 85,
|
|
22
|
+
quickstartAllowFrom: true,
|
|
23
|
+
};
|
|
24
|
+
function normalizeFeishuMessagingTarget(raw) {
|
|
25
|
+
const trimmed = raw?.trim();
|
|
26
|
+
if (!trimmed)
|
|
27
|
+
return undefined;
|
|
28
|
+
return trimmed.replace(/^(feishu|lark|fs):/i, "");
|
|
29
|
+
}
|
|
30
|
+
/** Create a Feishu Lark.Client for an account. */
|
|
31
|
+
function createFeishuClient(account) {
|
|
32
|
+
return new Lark.Client({
|
|
33
|
+
appId: account.appId,
|
|
34
|
+
appSecret: account.appSecret,
|
|
35
|
+
domain: Lark.Domain.Feishu,
|
|
36
|
+
appType: Lark.AppType.SelfBuild,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
export const feishuDock = {
|
|
40
|
+
id: "feishu",
|
|
41
|
+
capabilities: {
|
|
42
|
+
chatTypes: ["direct", "group"],
|
|
43
|
+
media: true,
|
|
44
|
+
blockStreaming: true,
|
|
45
|
+
},
|
|
46
|
+
outbound: { textChunkLimit: 4000 },
|
|
47
|
+
config: {
|
|
48
|
+
resolveAllowFrom: ({ cfg, accountId }) => (resolveFeishuAccount({ cfg: cfg, accountId }).config.allowFrom ?? []).map((entry) => String(entry)),
|
|
49
|
+
formatAllowFrom: ({ allowFrom }) => allowFrom
|
|
50
|
+
.map((entry) => String(entry).trim())
|
|
51
|
+
.filter(Boolean)
|
|
52
|
+
.map((entry) => entry.replace(/^(feishu|lark|fs):/i, ""))
|
|
53
|
+
.map((entry) => entry.toLowerCase()),
|
|
54
|
+
},
|
|
55
|
+
groups: {
|
|
56
|
+
resolveRequireMention: () => true,
|
|
57
|
+
},
|
|
58
|
+
threading: {
|
|
59
|
+
resolveReplyToMode: () => "off",
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
export const feishuPlugin = {
|
|
63
|
+
id: "feishu",
|
|
64
|
+
meta,
|
|
65
|
+
onboarding: feishuOnboardingAdapter,
|
|
66
|
+
capabilities: {
|
|
67
|
+
chatTypes: ["direct", "group"],
|
|
68
|
+
media: true,
|
|
69
|
+
reactions: false,
|
|
70
|
+
threads: false,
|
|
71
|
+
polls: false,
|
|
72
|
+
nativeCommands: false,
|
|
73
|
+
blockStreaming: true,
|
|
74
|
+
},
|
|
75
|
+
reload: { configPrefixes: ["channels.feishu"] },
|
|
76
|
+
configSchema: buildChannelConfigSchema(FeishuConfigSchema),
|
|
77
|
+
config: {
|
|
78
|
+
listAccountIds: (cfg) => listFeishuAccountIds(cfg),
|
|
79
|
+
resolveAccount: (cfg, accountId) => resolveFeishuAccount({ cfg: cfg, accountId }),
|
|
80
|
+
defaultAccountId: (cfg) => resolveDefaultFeishuAccountId(cfg),
|
|
81
|
+
setAccountEnabled: ({ cfg, accountId, enabled }) => setAccountEnabledInConfigSection({
|
|
82
|
+
cfg: cfg,
|
|
83
|
+
sectionKey: "feishu",
|
|
84
|
+
accountId,
|
|
85
|
+
enabled,
|
|
86
|
+
allowTopLevel: true,
|
|
87
|
+
}),
|
|
88
|
+
deleteAccount: ({ cfg, accountId }) => deleteAccountFromConfigSection({
|
|
89
|
+
cfg: cfg,
|
|
90
|
+
sectionKey: "feishu",
|
|
91
|
+
accountId,
|
|
92
|
+
clearBaseFields: ["appId", "appSecret", "name"],
|
|
93
|
+
}),
|
|
94
|
+
isConfigured: (account) => Boolean(account.appId?.trim() && account.appSecret?.trim()),
|
|
95
|
+
describeAccount: (account) => ({
|
|
96
|
+
accountId: account.accountId,
|
|
97
|
+
name: account.name,
|
|
98
|
+
enabled: account.enabled,
|
|
99
|
+
configured: Boolean(account.appId?.trim() && account.appSecret?.trim()),
|
|
100
|
+
tokenSource: account.tokenSource,
|
|
101
|
+
}),
|
|
102
|
+
resolveAllowFrom: ({ cfg, accountId }) => (resolveFeishuAccount({ cfg: cfg, accountId }).config.allowFrom ?? []).map((entry) => String(entry)),
|
|
103
|
+
formatAllowFrom: ({ allowFrom }) => allowFrom
|
|
104
|
+
.map((entry) => String(entry).trim())
|
|
105
|
+
.filter(Boolean)
|
|
106
|
+
.map((entry) => entry.replace(/^(feishu|lark|fs):/i, ""))
|
|
107
|
+
.map((entry) => entry.toLowerCase()),
|
|
108
|
+
},
|
|
109
|
+
security: {
|
|
110
|
+
resolveDmPolicy: ({ cfg, accountId, account }) => {
|
|
111
|
+
const resolvedAccountId = accountId ?? account.accountId ?? DEFAULT_ACCOUNT_ID;
|
|
112
|
+
const useAccountPath = Boolean(cfg.channels?.feishu?.accounts?.[resolvedAccountId]);
|
|
113
|
+
const basePath = useAccountPath
|
|
114
|
+
? `channels.feishu.accounts.${resolvedAccountId}.`
|
|
115
|
+
: "channels.feishu.";
|
|
116
|
+
return {
|
|
117
|
+
policy: account.config.dmPolicy ?? "pairing",
|
|
118
|
+
allowFrom: account.config.allowFrom ?? [],
|
|
119
|
+
policyPath: `${basePath}dmPolicy`,
|
|
120
|
+
allowFromPath: basePath,
|
|
121
|
+
approveHint: formatPairingApproveHint("feishu"),
|
|
122
|
+
normalizeEntry: (raw) => raw.replace(/^(feishu|lark|fs):/i, ""),
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
groups: {
|
|
127
|
+
resolveRequireMention: () => true,
|
|
128
|
+
},
|
|
129
|
+
threading: {
|
|
130
|
+
resolveReplyToMode: () => "off",
|
|
131
|
+
},
|
|
132
|
+
messaging: {
|
|
133
|
+
normalizeTarget: normalizeFeishuMessagingTarget,
|
|
134
|
+
targetResolver: {
|
|
135
|
+
looksLikeId: (raw) => {
|
|
136
|
+
const trimmed = raw.trim();
|
|
137
|
+
if (!trimmed)
|
|
138
|
+
return false;
|
|
139
|
+
// Feishu chat IDs look like oc_xxxxx or ou_xxxxx
|
|
140
|
+
return /^(oc|ou|on)_[a-f0-9]+$/i.test(trimmed) || /^[a-f0-9]{20,}$/i.test(trimmed);
|
|
141
|
+
},
|
|
142
|
+
hint: "<chatId>",
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
directory: {
|
|
146
|
+
self: async () => null,
|
|
147
|
+
listPeers: async ({ cfg, accountId, query, limit }) => {
|
|
148
|
+
const account = resolveFeishuAccount({ cfg: cfg, accountId });
|
|
149
|
+
const q = query?.trim().toLowerCase() || "";
|
|
150
|
+
const peers = Array.from(new Set((account.config.allowFrom ?? [])
|
|
151
|
+
.map((entry) => String(entry).trim())
|
|
152
|
+
.filter((entry) => Boolean(entry) && entry !== "*")
|
|
153
|
+
.map((entry) => entry.replace(/^(feishu|lark|fs):/i, ""))))
|
|
154
|
+
.filter((id) => (q ? id.toLowerCase().includes(q) : true))
|
|
155
|
+
.slice(0, limit && limit > 0 ? limit : undefined)
|
|
156
|
+
.map((id) => ({ kind: "user", id }));
|
|
157
|
+
return peers;
|
|
158
|
+
},
|
|
159
|
+
listGroups: async () => [],
|
|
160
|
+
},
|
|
161
|
+
setup: {
|
|
162
|
+
resolveAccountId: ({ accountId }) => normalizeAccountId(accountId),
|
|
163
|
+
applyAccountName: ({ cfg, accountId, name }) => applyAccountNameToChannelSection({
|
|
164
|
+
cfg: cfg,
|
|
165
|
+
channelKey: "feishu",
|
|
166
|
+
accountId,
|
|
167
|
+
name,
|
|
168
|
+
}),
|
|
169
|
+
validateInput: ({ accountId, input }) => {
|
|
170
|
+
if (!input.appId && !input.appSecret) {
|
|
171
|
+
return "Feishu requires appId and appSecret.";
|
|
172
|
+
}
|
|
173
|
+
return null;
|
|
174
|
+
},
|
|
175
|
+
applyAccountConfig: ({ cfg, accountId, input }) => {
|
|
176
|
+
const namedConfig = applyAccountNameToChannelSection({
|
|
177
|
+
cfg: cfg,
|
|
178
|
+
channelKey: "feishu",
|
|
179
|
+
accountId,
|
|
180
|
+
name: input.name,
|
|
181
|
+
});
|
|
182
|
+
const next = accountId !== DEFAULT_ACCOUNT_ID
|
|
183
|
+
? migrateBaseNameToDefaultAccount({
|
|
184
|
+
cfg: namedConfig,
|
|
185
|
+
channelKey: "feishu",
|
|
186
|
+
})
|
|
187
|
+
: namedConfig;
|
|
188
|
+
if (accountId === DEFAULT_ACCOUNT_ID) {
|
|
189
|
+
return {
|
|
190
|
+
...next,
|
|
191
|
+
channels: {
|
|
192
|
+
...next.channels,
|
|
193
|
+
feishu: {
|
|
194
|
+
...next.channels?.feishu,
|
|
195
|
+
enabled: true,
|
|
196
|
+
...(input.appId ? { appId: input.appId } : {}),
|
|
197
|
+
...(input.appSecret ? { appSecret: input.appSecret } : {}),
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
const feishuCfg = (next.channels?.feishu ?? {});
|
|
203
|
+
const accountsCfg = (feishuCfg.accounts ?? {});
|
|
204
|
+
const existingAccount = (accountsCfg[accountId] ?? {});
|
|
205
|
+
return {
|
|
206
|
+
...next,
|
|
207
|
+
channels: {
|
|
208
|
+
...(next.channels ?? {}),
|
|
209
|
+
feishu: {
|
|
210
|
+
...feishuCfg,
|
|
211
|
+
enabled: true,
|
|
212
|
+
accounts: {
|
|
213
|
+
...accountsCfg,
|
|
214
|
+
[accountId]: {
|
|
215
|
+
...existingAccount,
|
|
216
|
+
enabled: true,
|
|
217
|
+
...(input.appId ? { appId: input.appId } : {}),
|
|
218
|
+
...(input.appSecret ? { appSecret: input.appSecret } : {}),
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
};
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
pairing: {
|
|
227
|
+
idLabel: "feishuUserId",
|
|
228
|
+
normalizeAllowEntry: (entry) => entry.replace(/^(feishu|lark|fs):/i, ""),
|
|
229
|
+
notifyApproval: async ({ cfg, id }) => {
|
|
230
|
+
const account = resolveFeishuAccount({ cfg: cfg });
|
|
231
|
+
if (!account.appId || !account.appSecret) {
|
|
232
|
+
throw new Error("Feishu credentials not configured");
|
|
233
|
+
}
|
|
234
|
+
const client = createFeishuClient(account);
|
|
235
|
+
await sendTextMessage(client, id, PAIRING_APPROVED_MESSAGE);
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
outbound: {
|
|
239
|
+
deliveryMode: "direct",
|
|
240
|
+
chunker: (text, limit) => {
|
|
241
|
+
if (!text)
|
|
242
|
+
return [];
|
|
243
|
+
if (limit <= 0 || text.length <= limit)
|
|
244
|
+
return [text];
|
|
245
|
+
const chunks = [];
|
|
246
|
+
let remaining = text;
|
|
247
|
+
while (remaining.length > limit) {
|
|
248
|
+
const window = remaining.slice(0, limit);
|
|
249
|
+
const lastNewline = window.lastIndexOf("\n");
|
|
250
|
+
const lastSpace = window.lastIndexOf(" ");
|
|
251
|
+
let breakIdx = lastNewline > 0 ? lastNewline : lastSpace;
|
|
252
|
+
if (breakIdx <= 0)
|
|
253
|
+
breakIdx = limit;
|
|
254
|
+
const rawChunk = remaining.slice(0, breakIdx);
|
|
255
|
+
const chunk = rawChunk.trimEnd();
|
|
256
|
+
if (chunk.length > 0)
|
|
257
|
+
chunks.push(chunk);
|
|
258
|
+
const brokeOnSeparator = breakIdx < remaining.length && /\s/.test(remaining[breakIdx]);
|
|
259
|
+
const nextStart = Math.min(remaining.length, breakIdx + (brokeOnSeparator ? 1 : 0));
|
|
260
|
+
remaining = remaining.slice(nextStart).trimStart();
|
|
261
|
+
}
|
|
262
|
+
if (remaining.length)
|
|
263
|
+
chunks.push(remaining);
|
|
264
|
+
return chunks;
|
|
265
|
+
},
|
|
266
|
+
chunkerMode: "text",
|
|
267
|
+
textChunkLimit: 4000,
|
|
268
|
+
sendText: async ({ to, text, accountId, cfg }) => {
|
|
269
|
+
const account = resolveFeishuAccount({
|
|
270
|
+
accountId: accountId ?? undefined,
|
|
271
|
+
cfg: cfg,
|
|
272
|
+
});
|
|
273
|
+
if (!account.appId || !account.appSecret) {
|
|
274
|
+
return { channel: "feishu", ok: false, messageId: "", error: new Error("Feishu credentials not configured") };
|
|
275
|
+
}
|
|
276
|
+
const client = createFeishuClient(account);
|
|
277
|
+
const result = await sendTextMessage(client, to, text);
|
|
278
|
+
return {
|
|
279
|
+
channel: "feishu",
|
|
280
|
+
ok: result.ok,
|
|
281
|
+
messageId: result.messageId ?? "",
|
|
282
|
+
error: result.error ? new Error(result.error) : undefined,
|
|
283
|
+
};
|
|
284
|
+
},
|
|
285
|
+
sendMedia: async ({ to, text, mediaUrl, accountId, cfg }) => {
|
|
286
|
+
const account = resolveFeishuAccount({
|
|
287
|
+
accountId: accountId ?? undefined,
|
|
288
|
+
cfg: cfg,
|
|
289
|
+
});
|
|
290
|
+
if (!account.appId || !account.appSecret) {
|
|
291
|
+
return { channel: "feishu", ok: false, messageId: "", error: new Error("Feishu credentials not configured") };
|
|
292
|
+
}
|
|
293
|
+
const client = createFeishuClient(account);
|
|
294
|
+
const result = await sendMediaMessage(client, to, mediaUrl ?? "", text);
|
|
295
|
+
return {
|
|
296
|
+
channel: "feishu",
|
|
297
|
+
ok: result.ok,
|
|
298
|
+
messageId: result.messageId ?? "",
|
|
299
|
+
error: result.error ? new Error(result.error) : undefined,
|
|
300
|
+
};
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
status: {
|
|
304
|
+
defaultRuntime: {
|
|
305
|
+
accountId: DEFAULT_ACCOUNT_ID,
|
|
306
|
+
running: false,
|
|
307
|
+
lastStartAt: null,
|
|
308
|
+
lastStopAt: null,
|
|
309
|
+
lastError: null,
|
|
310
|
+
},
|
|
311
|
+
collectStatusIssues: collectFeishuStatusIssues,
|
|
312
|
+
buildChannelSummary: ({ snapshot }) => ({
|
|
313
|
+
configured: snapshot.configured ?? false,
|
|
314
|
+
tokenSource: snapshot.tokenSource ?? "none",
|
|
315
|
+
running: snapshot.running ?? false,
|
|
316
|
+
mode: "websocket",
|
|
317
|
+
lastStartAt: snapshot.lastStartAt ?? null,
|
|
318
|
+
lastStopAt: snapshot.lastStopAt ?? null,
|
|
319
|
+
lastError: snapshot.lastError ?? null,
|
|
320
|
+
probe: snapshot.probe,
|
|
321
|
+
lastProbeAt: snapshot.lastProbeAt ?? null,
|
|
322
|
+
}),
|
|
323
|
+
probeAccount: async ({ account, timeoutMs }) => probeFeishu(account.appId, account.appSecret, timeoutMs),
|
|
324
|
+
buildAccountSnapshot: ({ account, runtime }) => {
|
|
325
|
+
const configured = Boolean(account.appId?.trim() && account.appSecret?.trim());
|
|
326
|
+
return {
|
|
327
|
+
accountId: account.accountId,
|
|
328
|
+
name: account.name,
|
|
329
|
+
enabled: account.enabled,
|
|
330
|
+
configured,
|
|
331
|
+
tokenSource: account.tokenSource,
|
|
332
|
+
running: runtime?.running ?? false,
|
|
333
|
+
lastStartAt: runtime?.lastStartAt ?? null,
|
|
334
|
+
lastStopAt: runtime?.lastStopAt ?? null,
|
|
335
|
+
lastError: runtime?.lastError ?? null,
|
|
336
|
+
mode: "websocket",
|
|
337
|
+
lastInboundAt: runtime?.lastInboundAt ?? null,
|
|
338
|
+
lastOutboundAt: runtime?.lastOutboundAt ?? null,
|
|
339
|
+
dmPolicy: account.config.dmPolicy ?? "pairing",
|
|
340
|
+
appId: account.appId ? `${account.appId.slice(0, 8)}...` : undefined,
|
|
341
|
+
};
|
|
342
|
+
},
|
|
343
|
+
},
|
|
344
|
+
gateway: {
|
|
345
|
+
startAccount: async (ctx) => {
|
|
346
|
+
const account = ctx.account;
|
|
347
|
+
let feishuBotLabel = "";
|
|
348
|
+
try {
|
|
349
|
+
const probe = await probeFeishu(account.appId, account.appSecret, 3000);
|
|
350
|
+
const name = probe.ok ? probe.bot?.name?.trim() : null;
|
|
351
|
+
if (name)
|
|
352
|
+
feishuBotLabel = ` (${name})`;
|
|
353
|
+
ctx.setStatus({ accountId: account.accountId, bot: probe.bot });
|
|
354
|
+
}
|
|
355
|
+
catch {
|
|
356
|
+
// Ignore probe errors during startup
|
|
357
|
+
}
|
|
358
|
+
ctx.log?.info(`[${account.accountId}] Starting Feishu provider${feishuBotLabel}`);
|
|
359
|
+
const provider = startFeishuProvider({
|
|
360
|
+
account,
|
|
361
|
+
config: ctx.cfg,
|
|
362
|
+
log: {
|
|
363
|
+
info: (msg) => ctx.log?.info(msg),
|
|
364
|
+
error: (msg) => ctx.log?.error(msg),
|
|
365
|
+
},
|
|
366
|
+
abortSignal: ctx.abortSignal,
|
|
367
|
+
statusSink: (patch) => ctx.setStatus({ accountId: ctx.accountId, ...patch }),
|
|
368
|
+
});
|
|
369
|
+
return provider;
|
|
370
|
+
},
|
|
371
|
+
},
|
|
372
|
+
};
|
|
373
|
+
//# sourceMappingURL=channel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel.js","sourceRoot":"","sources":["../../src/channel.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,OAAO,EACL,gCAAgC,EAChC,wBAAwB,EACxB,kBAAkB,EAClB,8BAA8B,EAC9B,wBAAwB,EACxB,+BAA+B,EAC/B,kBAAkB,EAClB,wBAAwB,EACxB,gCAAgC,GACjC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,oBAAoB,EACpB,6BAA6B,EAC7B,oBAAoB,GACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,KAAK,IAAI,MAAM,yBAAyB,CAAC;AAEhD,MAAM,IAAI,GAAG;IACX,EAAE,EAAE,QAAQ;IACZ,KAAK,EAAE,QAAQ;IACf,cAAc,EAAE,aAAa;IAC7B,QAAQ,EAAE,kBAAkB;IAC5B,SAAS,EAAE,QAAQ;IACnB,KAAK,EAAE,0DAA0D;IACjE,OAAO,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC;IACvB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,IAAI,IAAI;oBAAE,cAAc,GAAG,KAAK,IAAI,GAAG,CAAC;gBACxC,GAAG,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;YAClE,CAAC;YAAC,MAAM,CAAC;gBACP,qCAAqC;YACvC,CAAC;YAED,GAAG,CAAC,GAAG,EAAE,IAAI,CACX,IAAI,OAAO,CAAC,SAAS,6BAA6B,cAAc,EAAE,CACnE,CAAC;YAEF,MAAM,QAAQ,GAAG,mBAAmB,CAAC;gBACnC,OAAO;gBACP,MAAM,EAAE,GAAG,CAAC,GAAqB;gBACjC,GAAG,EAAE;oBACH,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC;oBACjC,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;iBACpC;gBACD,WAAW,EAAE,GAAG,CAAC,WAAW;gBAC5B,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,CACpB,GAAG,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,GAAG,KAAK,EAAE,CAAC;aACxD,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC;QAClB,CAAC;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feishu config Zod schema for validation.
|
|
3
|
+
*/
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
export declare const FeishuConfigSchema: z.ZodObject<{
|
|
6
|
+
name: z.ZodOptional<z.ZodString>;
|
|
7
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
8
|
+
appId: z.ZodOptional<z.ZodString>;
|
|
9
|
+
appSecret: z.ZodOptional<z.ZodString>;
|
|
10
|
+
dmPolicy: z.ZodOptional<z.ZodEnum<["pairing", "allowlist", "open", "disabled"]>>;
|
|
11
|
+
allowFrom: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">>;
|
|
12
|
+
thinkingThresholdMs: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
botNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
14
|
+
mediaMaxMb: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
} & {
|
|
16
|
+
accounts: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodObject<{
|
|
17
|
+
name: z.ZodOptional<z.ZodString>;
|
|
18
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
+
appId: z.ZodOptional<z.ZodString>;
|
|
20
|
+
appSecret: z.ZodOptional<z.ZodString>;
|
|
21
|
+
dmPolicy: z.ZodOptional<z.ZodEnum<["pairing", "allowlist", "open", "disabled"]>>;
|
|
22
|
+
allowFrom: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">>;
|
|
23
|
+
thinkingThresholdMs: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
botNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
25
|
+
mediaMaxMb: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
name?: string;
|
|
28
|
+
enabled?: boolean;
|
|
29
|
+
appId?: string;
|
|
30
|
+
appSecret?: string;
|
|
31
|
+
dmPolicy?: "pairing" | "allowlist" | "open" | "disabled";
|
|
32
|
+
allowFrom?: (string | number)[];
|
|
33
|
+
thinkingThresholdMs?: number;
|
|
34
|
+
botNames?: string[];
|
|
35
|
+
mediaMaxMb?: number;
|
|
36
|
+
}, {
|
|
37
|
+
name?: string;
|
|
38
|
+
enabled?: boolean;
|
|
39
|
+
appId?: string;
|
|
40
|
+
appSecret?: string;
|
|
41
|
+
dmPolicy?: "pairing" | "allowlist" | "open" | "disabled";
|
|
42
|
+
allowFrom?: (string | number)[];
|
|
43
|
+
thinkingThresholdMs?: number;
|
|
44
|
+
botNames?: string[];
|
|
45
|
+
mediaMaxMb?: number;
|
|
46
|
+
}>, z.objectOutputType<{}, z.ZodObject<{
|
|
47
|
+
name: z.ZodOptional<z.ZodString>;
|
|
48
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
49
|
+
appId: z.ZodOptional<z.ZodString>;
|
|
50
|
+
appSecret: z.ZodOptional<z.ZodString>;
|
|
51
|
+
dmPolicy: z.ZodOptional<z.ZodEnum<["pairing", "allowlist", "open", "disabled"]>>;
|
|
52
|
+
allowFrom: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">>;
|
|
53
|
+
thinkingThresholdMs: z.ZodOptional<z.ZodNumber>;
|
|
54
|
+
botNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
55
|
+
mediaMaxMb: z.ZodOptional<z.ZodNumber>;
|
|
56
|
+
}, "strip", z.ZodTypeAny, {
|
|
57
|
+
name?: string;
|
|
58
|
+
enabled?: boolean;
|
|
59
|
+
appId?: string;
|
|
60
|
+
appSecret?: string;
|
|
61
|
+
dmPolicy?: "pairing" | "allowlist" | "open" | "disabled";
|
|
62
|
+
allowFrom?: (string | number)[];
|
|
63
|
+
thinkingThresholdMs?: number;
|
|
64
|
+
botNames?: string[];
|
|
65
|
+
mediaMaxMb?: number;
|
|
66
|
+
}, {
|
|
67
|
+
name?: string;
|
|
68
|
+
enabled?: boolean;
|
|
69
|
+
appId?: string;
|
|
70
|
+
appSecret?: string;
|
|
71
|
+
dmPolicy?: "pairing" | "allowlist" | "open" | "disabled";
|
|
72
|
+
allowFrom?: (string | number)[];
|
|
73
|
+
thinkingThresholdMs?: number;
|
|
74
|
+
botNames?: string[];
|
|
75
|
+
mediaMaxMb?: number;
|
|
76
|
+
}>, "strip">, z.objectInputType<{}, z.ZodObject<{
|
|
77
|
+
name: z.ZodOptional<z.ZodString>;
|
|
78
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
79
|
+
appId: z.ZodOptional<z.ZodString>;
|
|
80
|
+
appSecret: z.ZodOptional<z.ZodString>;
|
|
81
|
+
dmPolicy: z.ZodOptional<z.ZodEnum<["pairing", "allowlist", "open", "disabled"]>>;
|
|
82
|
+
allowFrom: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">>;
|
|
83
|
+
thinkingThresholdMs: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
botNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
85
|
+
mediaMaxMb: z.ZodOptional<z.ZodNumber>;
|
|
86
|
+
}, "strip", z.ZodTypeAny, {
|
|
87
|
+
name?: string;
|
|
88
|
+
enabled?: boolean;
|
|
89
|
+
appId?: string;
|
|
90
|
+
appSecret?: string;
|
|
91
|
+
dmPolicy?: "pairing" | "allowlist" | "open" | "disabled";
|
|
92
|
+
allowFrom?: (string | number)[];
|
|
93
|
+
thinkingThresholdMs?: number;
|
|
94
|
+
botNames?: string[];
|
|
95
|
+
mediaMaxMb?: number;
|
|
96
|
+
}, {
|
|
97
|
+
name?: string;
|
|
98
|
+
enabled?: boolean;
|
|
99
|
+
appId?: string;
|
|
100
|
+
appSecret?: string;
|
|
101
|
+
dmPolicy?: "pairing" | "allowlist" | "open" | "disabled";
|
|
102
|
+
allowFrom?: (string | number)[];
|
|
103
|
+
thinkingThresholdMs?: number;
|
|
104
|
+
botNames?: string[];
|
|
105
|
+
mediaMaxMb?: number;
|
|
106
|
+
}>, "strip">>>;
|
|
107
|
+
defaultAccount: z.ZodOptional<z.ZodString>;
|
|
108
|
+
}, "strip", z.ZodTypeAny, {
|
|
109
|
+
accounts?: {} & {
|
|
110
|
+
[k: string]: {
|
|
111
|
+
name?: string;
|
|
112
|
+
enabled?: boolean;
|
|
113
|
+
appId?: string;
|
|
114
|
+
appSecret?: string;
|
|
115
|
+
dmPolicy?: "pairing" | "allowlist" | "open" | "disabled";
|
|
116
|
+
allowFrom?: (string | number)[];
|
|
117
|
+
thinkingThresholdMs?: number;
|
|
118
|
+
botNames?: string[];
|
|
119
|
+
mediaMaxMb?: number;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
defaultAccount?: string;
|
|
123
|
+
name?: string;
|
|
124
|
+
enabled?: boolean;
|
|
125
|
+
appId?: string;
|
|
126
|
+
appSecret?: string;
|
|
127
|
+
dmPolicy?: "pairing" | "allowlist" | "open" | "disabled";
|
|
128
|
+
allowFrom?: (string | number)[];
|
|
129
|
+
thinkingThresholdMs?: number;
|
|
130
|
+
botNames?: string[];
|
|
131
|
+
mediaMaxMb?: number;
|
|
132
|
+
}, {
|
|
133
|
+
accounts?: {} & {
|
|
134
|
+
[k: string]: {
|
|
135
|
+
name?: string;
|
|
136
|
+
enabled?: boolean;
|
|
137
|
+
appId?: string;
|
|
138
|
+
appSecret?: string;
|
|
139
|
+
dmPolicy?: "pairing" | "allowlist" | "open" | "disabled";
|
|
140
|
+
allowFrom?: (string | number)[];
|
|
141
|
+
thinkingThresholdMs?: number;
|
|
142
|
+
botNames?: string[];
|
|
143
|
+
mediaMaxMb?: number;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
defaultAccount?: string;
|
|
147
|
+
name?: string;
|
|
148
|
+
enabled?: boolean;
|
|
149
|
+
appId?: string;
|
|
150
|
+
appSecret?: string;
|
|
151
|
+
dmPolicy?: "pairing" | "allowlist" | "open" | "disabled";
|
|
152
|
+
allowFrom?: (string | number)[];
|
|
153
|
+
thinkingThresholdMs?: number;
|
|
154
|
+
botNames?: string[];
|
|
155
|
+
mediaMaxMb?: number;
|
|
156
|
+
}>;
|
|
157
|
+
//# sourceMappingURL=config-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-schema.d.ts","sourceRoot":"","sources":["../../src/config-schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgBxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG7B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feishu config Zod schema for validation.
|
|
3
|
+
*/
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
const allowFromEntry = z.union([z.string(), z.number()]);
|
|
6
|
+
const feishuAccountSchema = z.object({
|
|
7
|
+
name: z.string().optional(),
|
|
8
|
+
enabled: z.boolean().optional(),
|
|
9
|
+
appId: z.string().optional(),
|
|
10
|
+
appSecret: z.string().optional(),
|
|
11
|
+
dmPolicy: z.enum(["pairing", "allowlist", "open", "disabled"]).optional(),
|
|
12
|
+
allowFrom: z.array(allowFromEntry).optional(),
|
|
13
|
+
thinkingThresholdMs: z.number().optional(),
|
|
14
|
+
botNames: z.array(z.string()).optional(),
|
|
15
|
+
mediaMaxMb: z.number().optional(),
|
|
16
|
+
});
|
|
17
|
+
export const FeishuConfigSchema = feishuAccountSchema.extend({
|
|
18
|
+
accounts: z.object({}).catchall(feishuAccountSchema).optional(),
|
|
19
|
+
defaultAccount: z.string().optional(),
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=config-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-schema.js","sourceRoot":"","sources":["../../src/config-schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAEzD,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC/B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,EAAE;IACzE,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE;IAC7C,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1C,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACxC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,MAAM,CAAC;IAC3D,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,QAAQ,EAAE;IAC/D,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACtC,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Message deduplication — Feishu may deliver the same event more than once.
|
|
3
|
+
*/
|
|
4
|
+
/** Garbage-collect expired entries and check for duplicates. */
|
|
5
|
+
export declare function isDuplicate(messageId: string | undefined | null): boolean;
|
|
6
|
+
/** Clear all dedup state (for testing). */
|
|
7
|
+
export declare function clearDedup(): void;
|
|
8
|
+
//# sourceMappingURL=dedup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dedup.d.ts","sourceRoot":"","sources":["../../src/dedup.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,gEAAgE;AAChE,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAYzE;AAED,2CAA2C;AAC3C,wBAAgB,UAAU,IAAI,IAAI,CAEjC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Message deduplication — Feishu may deliver the same event more than once.
|
|
3
|
+
*/
|
|
4
|
+
const SEEN_TTL_MS = 10 * 60 * 1000; // 10 minutes
|
|
5
|
+
const seen = new Map();
|
|
6
|
+
/** Garbage-collect expired entries and check for duplicates. */
|
|
7
|
+
export function isDuplicate(messageId) {
|
|
8
|
+
const now = Date.now();
|
|
9
|
+
// GC old entries
|
|
10
|
+
for (const [k, ts] of seen) {
|
|
11
|
+
if (now - ts > SEEN_TTL_MS)
|
|
12
|
+
seen.delete(k);
|
|
13
|
+
}
|
|
14
|
+
if (!messageId)
|
|
15
|
+
return false;
|
|
16
|
+
if (seen.has(messageId))
|
|
17
|
+
return true;
|
|
18
|
+
seen.set(messageId, now);
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
/** Clear all dedup state (for testing). */
|
|
22
|
+
export function clearDedup() {
|
|
23
|
+
seen.clear();
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=dedup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dedup.js","sourceRoot":"","sources":["../../src/dedup.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AAEjD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEvC,gEAAgE;AAChE,MAAM,UAAU,WAAW,CAAC,SAAoC;IAC9D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAEvB,iBAAiB;IACjB,KAAK,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC;QAC3B,IAAI,GAAG,GAAG,EAAE,GAAG,WAAW;YAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED,IAAI,CAAC,SAAS;QAAE,OAAO,KAAK,CAAC;IAC7B,IAAI,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC;QAAE,OAAO,IAAI,CAAC;IACrC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IACzB,OAAO,KAAK,CAAC;AACf,CAAC;AAED,2CAA2C;AAC3C,MAAM,UAAU,UAAU;IACxB,IAAI,CAAC,KAAK,EAAE,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Smart group chat reply filter.
|
|
3
|
+
*
|
|
4
|
+
* In group chats, only respond when the message looks like a real
|
|
5
|
+
* question, request, or direct address — avoids spamming.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Determine whether the bot should respond to a group message.
|
|
9
|
+
*
|
|
10
|
+
* @param text - Message text (after stripping @mention placeholders)
|
|
11
|
+
* @param mentions - Array of mention objects from the Feishu event
|
|
12
|
+
* @param botNames - Custom bot name list for address detection
|
|
13
|
+
*/
|
|
14
|
+
export declare function shouldRespondInGroup(text: string, mentions: unknown[], botNames?: string[]): boolean;
|
|
15
|
+
//# sourceMappingURL=group-filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group-filter.d.ts","sourceRoot":"","sources":["../../src/group-filter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,OAAO,EAAE,EACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,GAClB,OAAO,CA4BT"}
|