{"_id":"@apexglory/agent-wechat2-wechaty-puppet","name":"@apexglory/agent-wechat2-wechaty-puppet","dist-tags":{"latest":"0.11.15"},"versions":{"0.11.15":{"name":"@apexglory/agent-wechat2-wechaty-puppet","version":"0.11.15","description":"Wechaty Puppet for agent-wechat2 — bridges Wechaty bots to WeChat via the agent-wechat2 REST/WebSocket server","type":"module","main":"./dist/mod.js","types":"./dist/mod.d.ts","exports":{".":{"import":"./dist/mod.js","types":"./dist/mod.d.ts"}},"peerDependencies":{"wechaty-puppet":"^1.10.2"},"dependencies":{"file-box":"^1.4.15"},"devDependencies":{"@types/node":"^22","esbuild":"^0.25.0","tsx":"^4.19.0","typescript":"^5.4.5","wechaty-puppet":"^1.20.2","@apexglory/agent-wechat2-shared":"0.11.15"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/apexglory/agent-wechat.git","directory":"packages/wechaty-puppet"},"scripts":{"build":"esbuild src/mod.ts --bundle --format=esm --platform=node --outfile=dist/mod.js --external:wechaty-puppet --external:file-box && tsc --emitDeclarationOnly","typecheck":"tsc --noEmit","test":"node --import tsx --test src/*.test.ts","test:puppet":"node --import tsx scripts/test-puppet.ts","test:contacts":"node --import tsx scripts/test-contacts.ts","test:ding-dong":"node --import tsx scripts/test-ding-dong.ts"},"_id":"@apexglory/agent-wechat2-wechaty-puppet@0.11.15","bugs":{"url":"https://github.com/apexglory/agent-wechat/issues"},"homepage":"https://github.com/apexglory/agent-wechat#readme","_integrity":"sha512-PxG6qwxt4JrLA3dvz0V+AMFp4Hbl5QjoVZth4zFR/fVYCUuqjZigbeVCphb96PLb6f6G3yWWQ0F6eu4ET4V23g==","_resolved":"/private/var/folders/yf/4y5rz5254qg7k8v7bplkjjm40000gn/T/6c45a47cc17d502a3b9e53ce6931ccf3/apexglory-agent-wechat2-wechaty-puppet-0.11.15.tgz","_from":"file:apexglory-agent-wechat2-wechaty-puppet-0.11.15.tgz","_nodeVersion":"24.11.0","_npmVersion":"11.6.1","dist":{"integrity":"sha512-PxG6qwxt4JrLA3dvz0V+AMFp4Hbl5QjoVZth4zFR/fVYCUuqjZigbeVCphb96PLb6f6G3yWWQ0F6eu4ET4V23g==","shasum":"47fe3874f86b771683206a9b0979ee7428156926","tarball":"https://registry.npmjs.org/@apexglory/agent-wechat2-wechaty-puppet/-/agent-wechat2-wechaty-puppet-0.11.15.tgz","fileCount":9,"unpackedSize":181396,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDq9T/+kEfv92W3wDBPNvWJdd1ADM03o5pXwYF4IpYb9wIgGV3r8d9bBOoIuwfXiZ+xrorX2F0UO+8x2rCnUxokKy4="}]},"_npmUser":{"name":"apexglory","email":"gloryofapex@gmail.com"},"directories":{},"maintainers":[{"name":"apexglory","email":"gloryofapex@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/agent-wechat2-wechaty-puppet_0.11.15_1778841840911_0.9080628732966305"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-15T10:44:00.805Z","0.11.15":"2026-05-15T10:44:01.063Z","modified":"2026-05-15T10:44:01.647Z"},"maintainers":[{"name":"apexglory","email":"gloryofapex@gmail.com"}],"description":"Wechaty Puppet for agent-wechat2 — bridges Wechaty bots to WeChat via the agent-wechat2 REST/WebSocket server","homepage":"https://github.com/apexglory/agent-wechat#readme","repository":{"type":"git","url":"git+https://github.com/apexglory/agent-wechat.git","directory":"packages/wechaty-puppet"},"bugs":{"url":"https://github.com/apexglory/agent-wechat/issues"},"readme":"# @apexglory/agent-wechat2-wechaty-puppet\n\nWechaty Puppet for [agent-wechat](https://github.com/apexglory/agent-wechat). Bridges any Wechaty bot to WeChat via the agent-wechat REST/WebSocket server.\n\n**[Documentation](https://apexglory.github.io/agent-wechat/integrations/wechaty/puppet-setup/)**\n\n## Prerequisites\n\n- **An agent-wechat server** running — set up via the CLI or from the [agent-wechat repo](https://github.com/apexglory/agent-wechat):\n  ```bash\n  npx @apexglory/agent-wechat2-cli up     # starts the Docker container\n  ```\n  Login is not required as a separate CLI step; you can log in through the puppet QR flow.\n- **Node.js >= 22**\n\n## Install\n\n```bash\nnpm install @apexglory/agent-wechat2-wechaty-puppet wechaty wechaty-puppet\n```\n\n## Usage\n\n```ts\nimport { WechatyBuilder } from 'wechaty'\nimport PuppetAgentWeChat from '@apexglory/agent-wechat2-wechaty-puppet'\n\nconst bot = WechatyBuilder.build({\n  puppet: new PuppetAgentWeChat({\n    serverUrl: 'http://localhost:6174',  // optional, this is the default\n    token: 'your-token',                 // optional, reads from ~/.config/agent-wechat2/token\n  })\n})\n\nbot.on('scan', (qrcode, status) => {\n  console.log(`Scan QR Code to login: ${status}\\nhttps://wechaty.js.org/qrcode/${encodeURIComponent(qrcode)}`)\n})\n\nbot.on('login', user => console.log(`Logged in: ${user}`))\n\nbot.on('message', async msg => {\n  if (msg.text() === 'ding') {\n    await msg.say('dong')\n  }\n})\n\nawait bot.start()\n```\n\n## Configuration\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `serverUrl` | string | `http://localhost:6174` | agent-wechat server URL |\n| `token` | string | auto | Auth token. Falls back to `AGENT_WECHAT_TOKEN` env var, then `~/.config/agent-wechat2/token` |\n| `pollIntervalMs` | number | `2000` | Message polling interval in milliseconds |\n\n## Supported Features\n\n| Feature | Status | Notes |\n|---------|--------|-------|\n| QR Login | Yes | Via WebSocket `/api/ws/login` |\n| Logout | Yes | |\n| Receive Text | Yes | Polling-based |\n| Receive Image | Yes | Via media endpoint |\n| Receive Voice | Yes | Via media endpoint |\n| Receive Video | Yes | Via media endpoint |\n| Receive Emoticon | Yes | |\n| Send Text | Yes | |\n| Send Image | Yes | |\n| Send File | Yes | |\n| Contact List | Yes | Full address book via `/api/contacts` |\n| Contact Alias | Read | From remark field |\n| Room List | Partial | Recent group chats only |\n| Room Topic | Read | From group name |\n| Forward Text | Yes | |\n| Send URL | Partial | Sent as plain text |\n| Message Recall | No | |\n| Room Create | No | |\n| Room Add/Remove | No | |\n| Friendship | No | |\n| Tags | No | |\n| Moments/Posts | No | |\n\n## How It Works\n\nThe puppet connects to the agent-wechat REST API (Rust server running inside a Docker container alongside WeChat desktop). It does not interact with WeChat directly.\n\n- **Login**: WebSocket subscription to `/api/ws/login` drives QR scan events\n- **Messages**: Polls `GET /api/chats` for unreads, then `GET /api/messages/{chatId}` for new messages\n- **Sending**: `POST /api/messages/send` with text, image, or file payloads\n- **Media**: `GET /api/messages/{chatId}/media/{localId}` for image/voice/video downloads\n- **Contacts**: Full address book via `GET /api/contacts`\n- **Rooms**: Derived from `GET /api/chats` (group chats)\n","readmeFilename":"README.md","_rev":"1-dbff7c7fa61a3945337da5a82fc7509e"}