- Paths:
pkg/wechat/*pkg/channels/wechat/*
- Initial findings:
nekobotalready has a separated SDK layout:client,auth,cdn,media,messaging,monitor,parse,typing,voice.- Channel-specific glue is isolated under
pkg/channels/wechat/*.
- Paths:
/home/czyt/code/openilink-hub/internal/provider/ilink/*/home/czyt/code/openilink-hub/internal/api/media_handler.go/home/czyt/code/openilink-hub/internal/api/message_handler.go
- Initial findings:
- The project appears to include iLink provider integration plus mock server and binding flows.
- Some capabilities may be hub-side orchestration rather than SDK primitives.
- Identify reusable SDK-layer additions:
- auth/login/binding primitives
- media upload/download helpers
- message send/parse/typing/runtime protocol details
- mock/integration fixtures that improve testability
- Separate out non-reusable hub logic:
- app installation flows
- registry/store/API orchestration
- hub-specific routing and UI workflows
internal/provider/ilink/bind.go- Clear QR bind session lifecycle with session IDs, refresh-on-expire, and confirmed-credential handoff.
internal/provider/ilink/ilink.go- Provider lifecycle semantics worth mirroring in SDK/channel glue: explicit status transitions, sync buffer persistence, session-expired handling, raw response capture for inbound messages, and typed send/media/typing operations.
internal/provider/ilink/mockserver/*- High-value SDK-compatible mock HTTP server and in-memory engine for QR login, polling, media upload/download, typing, and session-expire scenarios.
internal/provider/ilink/silk_test.go- Stronger SILK/WAV round-trip tests and explicit verification of WeChat-compatible STX-prefixed SILK handling.
pkg/wechat/auth/login.go- QR fetch, single status check, and poll-with-refresh behavior already exists.
pkg/wechat/monitor/*- Sync buffer persistence, session guard, and backoff loop already exist in SDK form.
pkg/wechat/media/*andpkg/wechat/voice/*- Media download/decrypt and voice decoding/transcription paths are already separated.
pkg/channels/wechat/control.go- Channel-side runtime control and binding behavior already sit above the SDK.
- Add a SDK-compatible mockserver/test engine into
pkg/wechat/...for protocol-level tests. - Enrich client/auth surfaces so QR bind lifecycle is stateful and easier for channel/web consumers to drive.
- Improve media/voice tests and compatibility handling using the stronger SILK round-trip patterns.
- Optionally expose raw poll/response metadata from the SDK when that improves channel debugging or recovery behavior.
openilink-hub/internal/api/media_handler.go- Useful as product reference for future media proxy UX, but it is server/product code, not SDK code.
openilink-hub/internal/api/message_handler.go- Message listing, retry endpoints, traces, and webhook logs are hub features, not direct SDK migration targets.
- Keep AI chat as the current WeChat channel entry.
- Build push as a separate product path.
- Both paths share the same scanned iLink auth/binding.
- Ignore historical compatibility constraints and design the clean target shape directly.
- Added
pkg/wechat/mockserverwith SDK-compatible QR bind, polling, send, typing, config, and update endpoints for local tests. - Added
pkg/ilinkauthas the shared file-backed owner of:- single binding per backend user
- QR bind session state
- sync cursor paths for the current bound bot
- Rewired
pkg/webui/server.goWeChat binding endpoints to usepkg/ilinkauthinstead ofpkg/channels/wechat/store.go. - Rewired WeChat channel construction to read its current binding from
pkg/ilinkauth. - Preserved current chat behavior, but intentionally did not implement the future push product flow in this batch.
- The WeChat channel runtime is still effectively single-binding at process level. It now reads from shared auth, but it does not yet provide a true per-backend-user multi-runtime chat architecture.
- Push product/API remains unimplemented by design.