npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

codex-wechat-channel

v0.1.2

Published

Bridge WeChat ClawBot messages into Codex app-server threads

Readme

codex-wechat-channel

把微信 ClawBot 消息桥接进 Codex,会话底层走 codex app-server,而不是 Claude Code 的 development channels。

设计取舍

参考 claude-code-wechat-channel 的整体链路,但 Codex 当前公开可用的是 app-server / mcp,没有 Claude 那套 channel 扩展加载入口。因此这个项目采用的是:

WeChat (ClawBot)
  -> ilink API
  -> codex-wechat-channel
  -> embedded Codex app-server
  -> per-chat Codex thread
  -> plain-text reply back to WeChat

这意味着:

  • 它会自己拉起一个 codex app-server
  • 每个私聊 / 群聊维护一个独立 Codex thread
  • 回复默认走纯文本,适合 WeChat 聊天窗口
  • 图片消息会尽量下载并作为 localImage 输入传给 Codex

前置要求

  • Node.js >= 22
  • 已安装 codex CLI,且已登录可用
  • 微信 iOS ClawBot 可用

如果当前 shell 没有导出 OPENAI_API_KEY,桥接会优先复用 codex login 写入的 ~/.codex/auth.json。两者都缺失时,启动会在连接 app-server 前直接报错。

快速开始

安装方式

推荐直接运行:

npx codex-wechat-channel help

如果你想长期使用:

npm install -g codex-wechat-channel
codex-wechat-channel help

在本地仓库开发时,仍可继续使用 node cli.mjs ...npm run ...

发布为 npm 包

npm login
npm pack
npm publish --access public

发布后即可直接使用:

npx codex-wechat-channel help

1. 微信扫码登录

codex-wechat-channel setup

凭据会保存在:

~/.codex/channels/wechat/account.json

2. 启动桥接

codex-wechat-channel start

如果需要指定工作目录或模型:

codex-wechat-channel start --cwd D:\workspace\myrepo --model gpt-5.4

3. 探活 Codex app-server

codex-wechat-channel probe

预期输出:

PONG

运维快捷命令

如果你想把桥接放到后台运行,可直接使用:

codex-wechat-channel bridge start
codex-wechat-channel bridge status
codex-wechat-channel probe
codex-wechat-channel bridge stop
codex-wechat-channel service install --cwd /home/ubuntu

需要透传启动参数时:

codex-wechat-channel bridge start --cwd D:\workspace\myrepo --model gpt-5.4

如果你是在本地仓库内开发,也可以继续用:

npm run bridge:start
npm run bridge:status
npm run bridge:probe
npm run bridge:stop

Linux systemd 自启与自动重载

如果你在 Linux 服务器上跑 bridge,并且希望:

  • 开机自启
  • bridge 异常退出自动拉起
  • 修改 ~/.codex/config.toml~/.codex/AGENTS.md~/.codex/skills/~/.codex/prompts/ 后自动重启 bridge

可以直接执行:

sudo codex-wechat-channel service install --cwd /home/ubuntu

如果你是通过 sudo 执行,安装命令会优先使用 SUDO_USER 对应的用户与 home 目录来写入 systemd 配置和 PIDFile。如果你的部署用户不是当前 sudo 来源,也可以显式覆盖:

sudo codex-wechat-channel service install --cwd /srv/repo --user ubuntu --home /home/ubuntu

重复执行 service install 会覆盖已有 unit 文件,并强制重启正在运行的 bridge / watcher,让新配置立即生效。

安装后会创建:

  • codex-wechat-channel.service
  • codex-wechat-channel-watch.service

查看状态:

codex-wechat-channel service status

卸载:

sudo codex-wechat-channel service uninstall

常用环境变量

CODEX_BIN=codex
CODEX_WECHAT_CWD=D:\workspace\repo
CODEX_WECHAT_MODEL=gpt-5.4
CODEX_WECHAT_SANDBOX=danger-full-access
CODEX_WECHAT_APPROVAL_POLICY=never
CODEX_WECHAT_APP_SERVER_URL=ws://127.0.0.1:4501
CODEX_WECHAT_BASE_URL=https://ilinkai.weixin.qq.com
CODEX_WECHAT_DEVELOPER_INSTRUCTIONS=Always answer as a senior engineer.
OPENAI_API_KEY=sk-...

持久化状态

项目会在 ~/.codex/channels/wechat/ 下维护:

  • account.json:微信 bot token
  • bridge.pid:后台桥接进程 PID
  • bridge.stdout.log:后台桥接标准输出
  • bridge.stderr.log:后台桥接标准错误
  • context_tokens.json:WeChat reply context
  • threads.json:conversation -> Codex thread 映射
  • sync_buf.txt:微信 long polling 游标
  • media/:下载下来的图片附件

发布说明

注意事项

  • 默认 approvalPolicy=never,因为这是一个无人值守桥。如果你改成需要审批,桥接会卡住。
  • 默认 sandbox=danger-full-access,方便远端无人值守运行。若你需要收紧权限,可显式设置 CODEX_WECHAT_SANDBOX=workspace-writeread-only
  • 若未显式设置 OPENAI_API_KEY,embedded app-server 会尝试读取 ~/.codex/auth.json 中由 codex login 保存的 key。
  • WeChat 端仍是纯文本最佳,尽量不要让 Codex 输出 Markdown 表格或长代码块。