@openclaw-china/wecom-app 2026.3.2 → 2026.3.3

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.js CHANGED
@@ -8599,25 +8599,37 @@ var wecomAppPlugin = {
8599
8599
  * 主动发送文本消息
8600
8600
  */
8601
8601
  sendText: async (params) => {
8602
- const account = resolveWecomAppAccount({ cfg: params.cfg, accountId: params.accountId });
8603
- if (!account.canSendActive) {
8602
+ const parsed = parseDirectTarget(params.to);
8603
+ if (!parsed) {
8604
8604
  return {
8605
8605
  channel: "wecom-app",
8606
8606
  ok: false,
8607
8607
  messageId: "",
8608
- error: new Error("Account not configured for active sending (missing corpId, corpSecret, or agentId)")
8608
+ error: new Error(`Unsupported target for WeCom App: ${params.to}`)
8609
8609
  };
8610
8610
  }
8611
- const parsed = parseDirectTarget(params.to);
8612
- if (!parsed) {
8611
+ const accountId = parsed.accountId ?? params.accountId;
8612
+ const account = resolveWecomAppAccount({ cfg: params.cfg, accountId });
8613
+ if (parsed.accountId && accountId && !params.cfg.channels?.["wecom-app"]?.accounts?.[accountId]) {
8614
+ console.error(`[wecom-app] Account "${accountId}" not found in configuration`);
8613
8615
  return {
8614
8616
  channel: "wecom-app",
8615
8617
  ok: false,
8616
8618
  messageId: "",
8617
- error: new Error(`Unsupported target for WeCom App: ${params.to}`)
8619
+ error: new Error(`Account "${accountId}" not configured`)
8620
+ };
8621
+ }
8622
+ if (!account.canSendActive) {
8623
+ return {
8624
+ channel: "wecom-app",
8625
+ ok: false,
8626
+ messageId: "",
8627
+ error: new Error("Account not configured for active sending (missing corpId, corpSecret, or agentId)")
8618
8628
  };
8619
8629
  }
8620
8630
  const target = { userId: parsed.userId };
8631
+ console.log(`[wecom-app] Account resolved: canSendActive=${account.canSendActive}`);
8632
+ console.log("[wecom-app] Target parsed:", target);
8621
8633
  try {
8622
8634
  const result = await sendWecomAppMessage(account, target, params.text);
8623
8635
  return {
@@ -8640,29 +8652,38 @@ var wecomAppPlugin = {
8640
8652
  * OpenClaw outbound 适配器要求的接口
8641
8653
  */
8642
8654
  sendMedia: async (params) => {
8643
- console.log(`[wecom-app] sendMedia called: to=${params.to}, mediaUrl=${params.mediaUrl}`);
8655
+ const parsed = parseDirectTarget(params.to);
8656
+ if (!parsed) {
8657
+ return {
8658
+ channel: "wecom-app",
8659
+ ok: false,
8660
+ messageId: "",
8661
+ error: new Error(`Unsupported target for WeCom App: ${params.to}`)
8662
+ };
8663
+ }
8664
+ const accountId = parsed.accountId ?? params.accountId;
8644
8665
  const account = resolveWecomAppAccount({
8645
8666
  cfg: params.cfg,
8646
- accountId: params.accountId
8667
+ accountId
8647
8668
  });
8648
- console.log(`[wecom-app] Account resolved: canSendActive=${account.canSendActive}`);
8649
- if (!account.canSendActive) {
8650
- const error = new Error("Account not configured for active sending (missing corpId, corpSecret, or agentId)");
8651
- console.error(`[wecom-app] sendMedia error:`, error.message);
8669
+ if (parsed.accountId && accountId && !params.cfg.channels?.["wecom-app"]?.accounts?.[accountId]) {
8670
+ console.error(`[wecom-app] Account "${accountId}" not found in configuration`);
8652
8671
  return {
8653
8672
  channel: "wecom-app",
8654
8673
  ok: false,
8655
8674
  messageId: "",
8656
- error
8675
+ error: new Error(`Account "${accountId}" not configured`)
8657
8676
  };
8658
8677
  }
8659
- const parsed = parseDirectTarget(params.to);
8660
- if (!parsed) {
8678
+ console.log(`[wecom-app] Account resolved: canSendActive=${account.canSendActive}`);
8679
+ if (!account.canSendActive) {
8680
+ const error = new Error("Account not configured for active sending (missing corpId, corpSecret, or agentId)");
8681
+ console.error(`[wecom-app] sendMedia error:`, error.message);
8661
8682
  return {
8662
8683
  channel: "wecom-app",
8663
8684
  ok: false,
8664
8685
  messageId: "",
8665
- error: new Error(`Unsupported target for WeCom App: ${params.to}`)
8686
+ error
8666
8687
  };
8667
8688
  }
8668
8689
  const target = { userId: parsed.userId };