最近两天openclaw更新了3.22/3.23版本,对插件体系彻底重构,导致微信的官方插件报错:

Error: Cannot find module 'openclaw/plugin-sdk/channel-config-schema'
Require stack:
- C:\Users\75665\.openclaw\extensions\openclaw-weixin\index.ts

解决方式很多,把下面的内容给ai让它修复就可以:

本次修复涉及两个问题:


  问题一:插件加载失败

  报错:TypeError: (0 , _pluginSdk.resolvePreferredOpenClawTmpDir) is not a function
  原因:openclaw 2026.3.22 更新后,openclaw/plugin-sdk 主入口不再导出运行时函数,只保留类型导出。所有运行时函数被拆分到各子路径中。
  修改:8 个文件的 import 路径迁移:

  ┌───────────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────────────┐
│ 函数                                                   │ 新路径                                          │
├───────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────┤
  │ resolvePreferredOpenClawTmpDir, withFileLock                                      │ openclaw/plugin-sdk/infra-runtime         │
  │ normalizeAccountId                                                                │ openclaw/plugin-sdk/account-id            │
  │ buildChannelConfigSchema                                                          │ openclaw/plugin-sdk/channel-config-schema │
  │ createTypingCallbacks                                                             │ openclaw/plugin-sdk/channel-runtime       │
  │ resolveSenderCommandAuthorizationWithRuntime, resolveDirectDmAuthorizationOutcome │ openclaw/plugin-sdk/command-auth          │
  │ stripMarkdown                                                                     │ openclaw/plugin-sdk/text-runtime          │
  └───────────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────────────┘

  所有 import type 保持从 openclaw/plugin-sdk 导入不变。


  问题二:插件加载成功但消息无响应

  现象:插件注册成功(setWeixinRuntime called, runtime set successfully),但 gateway 从不调用 startAccount,消息轮询未启动。
  原因:新版 openclaw gateway 要求插件 channel 必须在 openclaw.json 的 channels 中有显式配置条目。之前 channels.openclaw-weixin 不存在,框架直接跳过了账号启动。
  修复:

  openclaw config set channels.openclaw-weixin.enabled true
  openclaw config set channels.openclaw-weixin.accounts.xxxxxxx-im-bot.enabled true
  openclaw config set channels.openclaw-weixin.accounts.xxxxxx-im-bot.enabled true
  openclaw gateway restart

修复成功!

然后再执行这条命令扫描二维码绑定微信

openclaw channels login --channel openclaw-weixin

微信插件,网络一切正常~

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐