@wecom/wecom-openclaw-plugin 2026.4.7-beta.2 → 2026.4.10-beta.1

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 CHANGED
@@ -479,7 +479,13 @@ In addition to the group allowlist, you can restrict which members within a grou
479
479
 
480
480
  ## ⏰ Cronjob (Scheduled Tasks)
481
481
 
482
- The plugin supports scheduled message delivery via OpenClaw's built-in Cron service. Cron jobs run through the **Agent outbound** channel, so Agent mode must be configured.
482
+ The plugin supports scheduled message delivery via OpenClaw's built-in Cron service. Cron jobs run through the **Agent outbound** channel, so the WeCom Agent mode (`corpId` + `corpSecret` + `agentId`) must be configured for the account used by the cron job.
483
+
484
+ > **Important**: The `--agent` (CLI) or `agentId` (jobs.json) refers to the **OpenClaw agent** that processes the cron job. This OpenClaw agent must be bound (via `bindings`) to a WeCom account that has Agent mode configured. If the bound WeCom account is Bot-only (no `agent` sub-config), delivery will fail with:
485
+ > ```
486
+ > WSClient not connected for account <name> and Agent mode is not configured.
487
+ > ```
488
+ > If `--agent` is omitted, the cron job uses the default OpenClaw agent. Make sure its bound WeCom account (or the `defaultAccount`) has Agent mode enabled.
483
489
 
484
490
  ### Target Formats
485
491
 
@@ -504,7 +510,6 @@ The `delivery.to` field supports the following target formats:
504
510
  ```shell
505
511
  openclaw cron add \
506
512
  --name "daily-report" \
507
- --agent main \
508
513
  --cron "0 9 * * 1-5" \
509
514
  --tz "Asia/Shanghai" \
510
515
  --message "Good morning! Here is your daily briefing." \
@@ -514,6 +519,7 @@ openclaw cron add \
514
519
  ```
515
520
 
516
521
  > **Note**: `--announce` enables delivery mode (broadcasts the AI response to the target chat). Use `--no-deliver` to keep output internal. The deprecated `--deliver` flag is an alias for `--announce`.
522
+ > You can specify `--agent <agentId>` to select a specific OpenClaw agent (e.g. `--agent main`). The agent must be bound to a WeCom account with Agent mode configured.
517
523
 
518
524
  Common CLI commands:
519
525
 
@@ -16,7 +16,7 @@ import { startWebhookGateway, stopWebhookGateway } from "./webhook/index.js";
16
16
  * 优先 Bot WebSocket,不可用时自动回退到 Agent HTTP API
17
17
  */
18
18
  async function sendWeComMessage({ to, content, accountId, cfg, }) {
19
- const resolvedAccountId = accountId ?? DEFAULT_ACCOUNT_ID;
19
+ const resolvedAccountId = accountId ?? (cfg ? resolveDefaultWeComAccountId(cfg) : DEFAULT_ACCOUNT_ID);
20
20
  // 从 to 中提取目标(格式是 "${CHANNEL_ID}:xxx" 或直接是目标字符串)
21
21
  const channelPrefix = new RegExp(`^${CHANNEL_ID}:`, "i");
22
22
  const chatId = to.replace(channelPrefix, "");
@@ -264,7 +264,7 @@ export const wecomPlugin = {
264
264
  return sendWeComMessage({ to, content: text, accountId: accountId ?? undefined, cfg });
265
265
  },
266
266
  sendMedia: async ({ to, text, mediaUrl, mediaLocalRoots, accountId, cfg }) => {
267
- const resolvedAccountId = accountId ?? DEFAULT_ACCOUNT_ID;
267
+ const resolvedAccountId = accountId ?? (cfg ? resolveDefaultWeComAccountId(cfg) : DEFAULT_ACCOUNT_ID);
268
268
  const channelPrefix = new RegExp(`^${CHANNEL_ID}:`, "i");
269
269
  const chatId = to.replace(channelPrefix, "");
270
270
  // 如果没有 mediaUrl,fallback 为纯文本
@@ -508,7 +508,7 @@ export const wecomPlugin = {
508
508
  });
509
509
  },
510
510
  logoutAccount: async ({ cfg, accountId }) => {
511
- const resolvedAccountId = accountId ?? DEFAULT_ACCOUNT_ID;
511
+ const resolvedAccountId = accountId ?? resolveDefaultWeComAccountId(cfg);
512
512
  const isMulti = hasMultiAccounts(cfg);
513
513
  let nextCfg = { ...cfg };
514
514
  let cleared = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wecom/wecom-openclaw-plugin",
3
- "version": "2026.4.7-beta.2",
3
+ "version": "2026.4.10-beta.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",