Skip to content

Prepare login, ready, logout and group text for the first alpha - #16

Merged
thisnick merged 1 commit into
mainfrom
feat/pre-alpha-lifecycle-groups
Nov 13, 2026
Merged

thisnick merged 1 commit into
mainfrom
feat/pre-alpha-lifecycle-groups

Conversation

@thisnick

Copy link
Copy Markdown
Collaborator

The four items Huan raised before the first npm alpha.

  • login after the profile (Emit login after the account profile loads #12). Neo looks up the account's profile, then emits login, so a login listener reads the nickname. If the lookup fails, login still fires and the name falls back to the WeChat ID, then the username.
  • ready after the initial sync (Emit ready after the initial sync #13). ready now follows the initial sync instead of the first heartbeat.
  • Logout after signing out from the phone (Signing out from the phone exits with an error instead of emitting logout #14). Signing out can close the socket before WeChat sends any code, so the failed sync never looked like a rejected session. When a sync or heartbeat fails without a service code, Neo now reconnects once and repeats it, and WeChat's answer decides: a rejected session that also rejects one renewal emits logout with WeChat ended the session. This uses the typed errors in wechat-protocol 2.2.0 instead of matching error text. Error events also name WeChat's service and code when it answered, for example Neo could not read a sync page: Sync service returned -1.
  • Group messages (Identify group messages and their senders #15). A group message's payload has the group as roomId and the member who posted it as talkerId. WeChat puts the member's ID in front of group text; Neo removes it, following the same rules as agent-wechat's daemon, and skips a group message whose sender it cannot read. messageSendText() accepts a group Neo has received a message from, and the example replies in the group.

The spec and README describe the new lifecycle, group handling and the live acceptance steps.

Testing

  • cargo test, cargo clippy -D warnings and cargo fmt --check pass. New Rust tests cover a socket closed by phone sign-out ending the session, reconnect and renewal limits, typed-only session rejection, and group sender parsing.
  • npm test (build, typecheck, 9 tests) and npm run test:package pass on Node.js 26 (Linux x64). New tests cover the login → initial sync → ready order, group payloads and replies, logout when sync fails after sign-out, and the example replying directly and in a group.
  • Not yet tested live. Next: a fresh QR login showing the nickname, Ding Dong directly and in a group, then signing out from the phone.

Closes #12
Closes #13
Closes #14
Closes #15

🤖 Generated with Claude Code

Emit login after the account profile loads, and ready after the initial
sync. Update wechat-protocol to 2.2.0 and use its typed errors: when a
sync or heartbeat fails without a service code, reconnect once and
repeat it, so signing out from the phone ends in logout rather than an
error. Error events now name WeChat's service and code when it answered.

Group text carries the group as roomId and the member as talkerId, and
the example replies in the group.

Closes #12
Closes #13
Closes #14
Closes #15

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thisnick
thisnick marked this pull request as ready for review November 13, 2026 18:31
@thisnick
thisnick merged commit c09585f into main Nov 13, 2026
11 checks passed
@thisnick
thisnick deleted the feat/pre-alpha-lifecycle-groups branch November 13, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant