@openclaw-china/wecom 2026.3.19 → 2026.3.20
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/dist/index.d.ts +32 -0
- package/dist/index.js +71 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -414,6 +414,38 @@ declare const wecomPlugin: {
|
|
|
414
414
|
error?: Error;
|
|
415
415
|
}>;
|
|
416
416
|
};
|
|
417
|
+
status: {
|
|
418
|
+
defaultRuntime: {
|
|
419
|
+
accountId: string;
|
|
420
|
+
running: boolean;
|
|
421
|
+
lastStartAt: null;
|
|
422
|
+
lastStopAt: null;
|
|
423
|
+
lastError: null;
|
|
424
|
+
};
|
|
425
|
+
buildAccountSnapshot: ({ account, runtime, probe }: {
|
|
426
|
+
account: ResolvedWecomAccount;
|
|
427
|
+
runtime?: Record<string, unknown>;
|
|
428
|
+
probe?: unknown;
|
|
429
|
+
}) => {
|
|
430
|
+
accountId: string;
|
|
431
|
+
name: string | undefined;
|
|
432
|
+
enabled: boolean;
|
|
433
|
+
configured: boolean;
|
|
434
|
+
linked: boolean;
|
|
435
|
+
connected: boolean;
|
|
436
|
+
running: boolean;
|
|
437
|
+
lastStartAt: number | null;
|
|
438
|
+
lastStopAt: number | null;
|
|
439
|
+
lastError: string | null;
|
|
440
|
+
lastInboundAt: number | null;
|
|
441
|
+
lastOutboundAt: number | null;
|
|
442
|
+
mode: string;
|
|
443
|
+
webhookPath: string | undefined;
|
|
444
|
+
dmPolicy: WecomDmPolicy;
|
|
445
|
+
allowFrom: string[] | undefined;
|
|
446
|
+
probe: unknown;
|
|
447
|
+
};
|
|
448
|
+
};
|
|
417
449
|
gateway: {
|
|
418
450
|
startAccount: (ctx: {
|
|
419
451
|
cfg: PluginConfig;
|
package/dist/index.js
CHANGED
|
@@ -2317,6 +2317,21 @@ async function configureWechatMp(prompter, cfg) {
|
|
|
2317
2317
|
],
|
|
2318
2318
|
toTrimmedString(existing.replyMode) ?? "passive"
|
|
2319
2319
|
);
|
|
2320
|
+
let activeDeliveryMode;
|
|
2321
|
+
if (replyMode === "active") {
|
|
2322
|
+
activeDeliveryMode = await prompter.askSelect(
|
|
2323
|
+
"\u4E3B\u52A8\u53D1\u9001\u6A21\u5F0F\uFF08activeDeliveryMode\uFF09",
|
|
2324
|
+
[
|
|
2325
|
+
{ value: "split", label: "split\uFF08\u9010\u5757\u53D1\u9001\uFF0C\u63A8\u8350\uFF09" },
|
|
2326
|
+
{ value: "merged", label: "merged\uFF08\u5408\u5E76\u540E\u5355\u6B21\u53D1\u9001\uFF09" }
|
|
2327
|
+
],
|
|
2328
|
+
toTrimmedString(existing.activeDeliveryMode) ?? "split"
|
|
2329
|
+
);
|
|
2330
|
+
}
|
|
2331
|
+
const renderMarkdown = await prompter.askConfirm(
|
|
2332
|
+
"\u542F\u7528 Markdown \u6E32\u67D3\uFF08\u63A8\u8350\u5F00\u542F\uFF09",
|
|
2333
|
+
toBoolean(existing.renderMarkdown, true)
|
|
2334
|
+
);
|
|
2320
2335
|
const welcomeText = await prompter.askText({
|
|
2321
2336
|
label: "\u6B22\u8FCE\u8BED\uFF08\u53EF\u9009\uFF09",
|
|
2322
2337
|
defaultValue: toTrimmedString(existing.welcomeText),
|
|
@@ -2330,6 +2345,8 @@ async function configureWechatMp(prompter, cfg) {
|
|
|
2330
2345
|
encodingAESKey: messageMode === "plain" ? void 0 : encodingAESKey,
|
|
2331
2346
|
messageMode,
|
|
2332
2347
|
replyMode,
|
|
2348
|
+
activeDeliveryMode,
|
|
2349
|
+
renderMarkdown,
|
|
2333
2350
|
welcomeText: welcomeText || void 0
|
|
2334
2351
|
});
|
|
2335
2352
|
}
|
|
@@ -9311,6 +9328,52 @@ async function handleWecomWebhookRequest(req, res) {
|
|
|
9311
9328
|
jsonOk(res, encReply);
|
|
9312
9329
|
return true;
|
|
9313
9330
|
}
|
|
9331
|
+
|
|
9332
|
+
// src/status.ts
|
|
9333
|
+
function resolveWsLinked(runtime2) {
|
|
9334
|
+
if (typeof runtime2?.linked === "boolean") return runtime2.linked;
|
|
9335
|
+
return runtime2?.connectionState === "ready";
|
|
9336
|
+
}
|
|
9337
|
+
function resolveWsConnected(runtime2) {
|
|
9338
|
+
if (typeof runtime2?.connected === "boolean") return runtime2.connected;
|
|
9339
|
+
return runtime2?.connectionState === "ready";
|
|
9340
|
+
}
|
|
9341
|
+
function normalizeStringArray(value) {
|
|
9342
|
+
if (!Array.isArray(value)) return void 0;
|
|
9343
|
+
const normalized = value.map((entry) => entry.trim()).filter(Boolean);
|
|
9344
|
+
return normalized.length > 0 ? normalized : void 0;
|
|
9345
|
+
}
|
|
9346
|
+
function createDefaultWecomRuntime(accountId) {
|
|
9347
|
+
return {
|
|
9348
|
+
accountId,
|
|
9349
|
+
running: false,
|
|
9350
|
+
lastStartAt: null,
|
|
9351
|
+
lastStopAt: null,
|
|
9352
|
+
lastError: null
|
|
9353
|
+
};
|
|
9354
|
+
}
|
|
9355
|
+
function buildWecomAccountSnapshot(params) {
|
|
9356
|
+
const { account, runtime: runtime2, probe } = params;
|
|
9357
|
+
return {
|
|
9358
|
+
accountId: account.accountId,
|
|
9359
|
+
name: account.name,
|
|
9360
|
+
enabled: account.enabled,
|
|
9361
|
+
configured: account.configured,
|
|
9362
|
+
linked: resolveWsLinked(runtime2),
|
|
9363
|
+
connected: resolveWsConnected(runtime2),
|
|
9364
|
+
running: runtime2?.running ?? false,
|
|
9365
|
+
lastStartAt: runtime2?.lastStartAt ?? null,
|
|
9366
|
+
lastStopAt: runtime2?.lastStopAt ?? null,
|
|
9367
|
+
lastError: runtime2?.lastError ?? null,
|
|
9368
|
+
lastInboundAt: runtime2?.lastInboundAt ?? null,
|
|
9369
|
+
lastOutboundAt: runtime2?.lastOutboundAt ?? null,
|
|
9370
|
+
mode: runtime2?.mode ?? account.mode,
|
|
9371
|
+
webhookPath: runtime2?.webhookPath ?? (account.mode === "webhook" ? account.config.webhookPath?.trim() || "/wecom" : void 0),
|
|
9372
|
+
dmPolicy: account.config.dmPolicy ?? "pairing",
|
|
9373
|
+
allowFrom: normalizeStringArray(account.config.allowFrom),
|
|
9374
|
+
probe
|
|
9375
|
+
};
|
|
9376
|
+
}
|
|
9314
9377
|
var DOC_BIZ_TYPE = "doc";
|
|
9315
9378
|
var DEFAULT_DOC_MCP_TYPE = "streamable-http";
|
|
9316
9379
|
var MCP_GET_CONFIG_CMD = "aibot_get_mcp_config";
|
|
@@ -10776,6 +10839,14 @@ var wecomPlugin = {
|
|
|
10776
10839
|
}
|
|
10777
10840
|
}
|
|
10778
10841
|
},
|
|
10842
|
+
status: {
|
|
10843
|
+
defaultRuntime: createDefaultWecomRuntime(DEFAULT_ACCOUNT_ID),
|
|
10844
|
+
buildAccountSnapshot: ({ account, runtime: runtime2, probe }) => buildWecomAccountSnapshot({
|
|
10845
|
+
account,
|
|
10846
|
+
runtime: runtime2,
|
|
10847
|
+
probe
|
|
10848
|
+
})
|
|
10849
|
+
},
|
|
10779
10850
|
gateway: {
|
|
10780
10851
|
startAccount: async (ctx) => {
|
|
10781
10852
|
ctx.setStatus?.({ accountId: ctx.accountId });
|