-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat(channels): add WeCom intelligent robot channel #6224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 1 commit
Commits
Show all changes
74 commits
Select commit
Hold shift + click to select a range
de769d5
feat(channels): add WeCom smart bot channel
qqqys f32f098
fix(channels): harden wecom review suggestions
qqqys b2dbd5e
fix(channels): address wecom critical review
qqqys 6100fd1
fix(channels): include wecom mixed voice text
qqqys 1f86d11
fix(channels): tighten wecom outbound media
qqqys 30076d4
fix(channels): harden wecom outbound sends
qqqys 067d74c
fix(channels): address wecom review blockers
qqqys 74563a1
fix(channels): address wecom review followups
qqqys 3c14ef9
fix(channels): harden wecom inbound handling
qqqys ccd4f33
fix(channels): address wecom auth and media review
qqqys 4588045
fix(channels): tighten wecom inbound cleanup
qqqys 5a2abaf
fix(channels): harden wecom media safety
qqqys 547f67f
fix(channels): address wecom review typecheck
qqqys 46a2efc
fix(channels): harden wecom media review gaps
qqqys 6c66094
fix(channels): address wecom review blockers
qqqys 9ccf0c9
fix(channels): tighten wecom media edge cases
qqqys 006023d
fix(channels): address wecom review blockers
qqqys 645406b
fix(channels): address wecom media review blockers
qqqys e6a0e3a
fix(channels): address wecom review follow-ups
qqqys 36ea9f9
fix(channels): address wecom review blockers
qqqys 3e923e1
fix(channels): close wecom review blockers
qqqys bc95cb9
fix(channels): close wecom preflight dedup race
qqqys 92d129c
fix(channels): close wecom review gaps
qqqys 7016ea5
fix(channels): harden wecom kick reconnect
qqqys 5ad0c9c
fix(channels): defer wecom session resolution
qqqys 643555d
fix(channels): clean wecom session attachments
qqqys 5a9c9b0
fix(channels): harden wecom reconnect and media cleanup
qqqys 7947aff
fix(channels): address wecom review diagnostics
qqqys 7dea3a7
fix(channels): improve wecom diagnostics
qqqys 9ba9cc9
fix(channels): reset wecom kick retries
qqqys 8ab3343
fix(channels): improve wecom diagnostics
qqqys 05936c1
fix(channels): preserve sync cancel preflight
qqqys d9a9b84
fix(channels): close wecom connection and ssrf gaps
qqqys 6e25684
fix(channels): clean coalesced wecom attachments
qqqys c3350a1
fix(channels): bound wecom sdk connect wait
qqqys f49032b
Merge branch 'main' into codex/issue-6208-wecom-channel
wenshao 40ca360
fix(channels): scope wecom untracked attachment cleanup
qqqys ebb6e63
fix(channels): block wecom nat64 local-use ssrf
qqqys 08dbc93
fix(channels): harden wecom media handling
qqqys f58a17d
fix(channels): harden wecom group gates
qqqys d9bb953
fix(channels): bound wecom kick reconnect cycles
qqqys f091c36
fix(channels): drain loop collect prompts directly
qqqys 907c232
fix(channels): align wecom buffer hooks
qqqys 8bc756d
fix(channels): harden wecom delivery failures
qqqys 003c985
fix(channels): recover from wecom attachment write failures
qqqys 3ba8e95
fix(channels): surface wecom media send failures
qqqys f03c008
fix(channels): harden wecom replay and reconnect
qqqys f1998d1
fix(channels): clarify wecom partial delivery cleanup
qqqys 8a4b6bd
fix(channels): close wecom rejected downloads
qqqys 2bfe8b3
fix(channels): retain wecom dedup after processing starts
qqqys dcd4170
fix(channels): harden wecom reconnect and media errors
qqqys 8f56b3f
fix(channels): add wecom media error context
qqqys 81d6d1c
fix(channels): improve wecom dns diagnostics
qqqys c988e15
fix(channels): keep wecom kick retry alive
qqqys 951c1b5
fix(channels): allow wecom quoted bot replies
qqqys bfaf08f
fix(channels): preserve wecom code fences across chunks
qqqys 3dbcc91
fix(channels): harden wecom reconnect lifecycle
qqqys 0249240
fix(channels): report wecom media dir setup failures
qqqys 60d191b
fix(channels): harden wecom reconnect recovery
qqqys 6e7fab1
fix(channels): align wecom review fixes
qqqys 7661af0
fix(channels): harden wecom marker parsing
qqqys 2380b64
fix(channels): keep wecom reconnect timers alive
qqqys e2da90a
fix(channels): handle wecom tilde fences
qqqys 0fa9f03
fix(channels): preserve wecom fence state
qqqys e0ae776
fix(channels): clean up wecom attachment races
qqqys b650c4c
fix(channels): bind wecom media reads to file handles
qqqys 0fda2a8
fix(channels): prevent wecom symlink media opens
qqqys 4ada37e
fix(channels): address wecom review blockers
qqqys 7d634af
fix(wecom): remove media URL from error messages to prevent credentia…
qqqys 9b5a3cd
fix(wecom): address review feedback — tests, security, correctness
qqqys 5f4b2ab
fix(wecom): wrap client.disconnect() in catch block to preserve conne…
qqqys 8d7c1b6
fix(channels): address wecom reconnect review blockers
qqqys 75bf5b9
fix(channels): harden wecom reconnect review fixes
qqqys 71fc860
fix(channels): harden wecom review blockers
qqqys File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| # WeCom (Enterprise WeChat) | ||
|
|
||
| This guide covers setting up Qwen Code with a WeCom intelligent robot (企业微信智能机器人). | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - A WeCom organization account | ||
| - A WeCom intelligent robot created in API mode | ||
| - The robot's Bot ID and Secret | ||
|
|
||
| ## Creating the Robot | ||
|
|
||
| 1. Open the WeCom admin console and create an intelligent robot. | ||
| 2. Choose API mode. | ||
| 3. Copy the Bot ID and Secret. | ||
| 4. Add the robot to the direct chats or groups where it should be available. | ||
|
|
||
| The intelligent robot uses a WebSocket connection from Qwen Code to WeCom. You do not need a public callback URL, Token, EncodingAESKey, Corp ID, or Agent ID. | ||
|
|
||
| ## Configuration | ||
|
|
||
| Add the channel to `~/.qwen/settings.json`: | ||
|
|
||
| ```json | ||
| { | ||
| "channels": { | ||
| "my-wecom": { | ||
| "type": "wecom", | ||
| "botId": "$WECOM_BOT_ID", | ||
| "secret": "$WECOM_SECRET", | ||
| "senderPolicy": "allowlist", | ||
| "allowedUsers": ["zhangsan"], | ||
| "sessionScope": "user", | ||
| "cwd": "/path/to/your/project", | ||
| "instructions": "You are a concise coding assistant responding via WeCom.", | ||
| "groupPolicy": "open", | ||
| "groups": { | ||
| "*": { "requireMention": true } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Set the credentials as environment variables: | ||
|
|
||
| ```bash | ||
| export WECOM_BOT_ID=<your-bot-id> | ||
| export WECOM_SECRET=<your-secret> | ||
| ``` | ||
|
|
||
| Or define them in the `env` section of `settings.json`: | ||
|
|
||
| ```json | ||
| { | ||
| "env": { | ||
| "WECOM_BOT_ID": "your-bot-id", | ||
| "WECOM_SECRET": "your-secret" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Running | ||
|
|
||
| ```bash | ||
| qwen channel start my-wecom | ||
| ``` | ||
|
|
||
| Open WeCom and send a message to the intelligent robot. | ||
|
|
||
| ## Access Control | ||
|
|
||
| `senderPolicy` works the same way as other IM channels: | ||
|
|
||
| - `allowlist`: only users in `allowedUsers` can use the bot. This is the recommended enterprise default. | ||
| - `pairing`: users must pair before using the bot. | ||
| - `open`: anyone who can message the robot can use it. | ||
|
|
||
| For groups, set `groupPolicy` to `"allowlist"` or `"open"`. By default, group messages require a mention through `"requireMention": true`. | ||
|
|
||
| ## Images and Files | ||
|
|
||
| Users can send text, voice messages with transcription, images, mixed text plus images, files, and videos. Images are passed to the agent as image attachments. Files and videos are downloaded to temporary local paths so the agent can read them with file tools. | ||
|
|
||
| Assistant responses are sent as WeCom markdown. To send local media generated by the agent, include one marker outside code blocks: | ||
|
|
||
| ```text | ||
| [IMAGE: /absolute/path/to/image.png] | ||
| [FILE: /absolute/path/to/report.pdf] | ||
| [VIDEO: /absolute/path/to/demo.mp4] | ||
| [VOICE: /absolute/path/to/audio.amr] | ||
| ``` | ||
|
|
||
| For safety, local media paths must be inside the channel `cwd` or the system temporary directory. | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Bot does not connect | ||
|
|
||
| - Verify the Bot ID and Secret. | ||
| - Make sure the robot is created in API mode. | ||
| - Check that the environment variables are available in the shell running `qwen channel start`. | ||
|
|
||
| ### Bot does not respond in groups | ||
|
|
||
| - Check `groupPolicy`. | ||
| - Mention the bot unless the group config sets `"requireMention": false`. | ||
| - Confirm the robot has been added to the group. | ||
|
|
||
| ### Self-built application credentials do not work | ||
|
|
||
| This channel is for WeCom intelligent robots. Self-built application callback credentials such as Corp ID, Agent ID, Token, and EncodingAESKey are not used by this channel. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| { | ||
| "name": "@qwen-code/channel-wecom", | ||
| "version": "0.19.5", | ||
| "description": "WeCom channel adapter for Qwen Code", | ||
| "type": "module", | ||
| "main": "dist/index.js", | ||
| "types": "dist/index.d.ts", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.ts", | ||
| "default": "./dist/index.js" | ||
| } | ||
| }, | ||
| "files": [ | ||
| "dist" | ||
| ], | ||
| "scripts": { | ||
| "build": "tsc --build", | ||
| "test": "vitest run", | ||
| "test:ci": "vitest run" | ||
| }, | ||
| "dependencies": { | ||
| "@qwen-code/channel-base": "file:../base", | ||
| "@wecom/aibot-node-sdk": "^1.0.7" | ||
| }, | ||
| "devDependencies": { | ||
| "typescript": "^5.0.0" | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Suggestion] This new workspace is versioned as
0.19.5, while the root package and the sibling channel packages in this PR are all0.19.6;package-lock.jsonrecords the same mismatch forpackages/channels/wecom. That leaves the release metadata inconsistent for publishing/version audits. Please bump this package and the corresponding lockfile entry to the current repo version.— GPT-5 Codex via Qwen Code /review