Files
ironclaw/channels-src
Coffee f948e11293 feat: wechat channel (#1666)
* Add Weixin channel with QR login and web setup flow

* Add Weixin interactive login integration tests

* Rename Weixin channel integration to WeChat

* Add WeChat typing indicators to the DM channel

* Fix WeChat extension status and login i18n

* Add WeChat image messaging and QR login polish

* Fix web auth event type after AppEvent migration

* Add WeChat inbound file and voice attachment support

* Add SILK voice fallback and WeChat polling diagnostics

* chore: lock file

* fix: error params

* fix: remove logs

* Remove redundant serde defaults from optional fields

* Add configurable WeChat merge windows and clean debug logs

* Add WeChat video and file media parity

* Treat video uploads as documents and fix web test fixtures

* Harden WeChat login randomness and add regression tests

* Harden WeChat login base URL and dedupe inbound messages

* Handle missing WeChat ret fields as errors

* Harden WeChat safety checks and secret fallback handling

* chore: fmt

* Update pairing store setup in wasm channel tests

* chore: fmt

* chore: fmt

* Harden WeChat host routing and login base URL validation

* docs

* Fix merge leftovers in web and extension tests

* Streamline WeChat QR login flow in web UI

* Remove stray image event_id and fix wrapper tests

* chore: fmt

* Improve WeChat media handling and image delivery

* Send WeChat attachments before text responses

* Handle WeChat owner scope and skip empty emitted messages

* Send generated images as inline channel attachments

* Scope WeChat channel credentials to bound users

* chore: fmt

* Release WeChat login lock during polling

* Handle missing WeChat getUpdates ret as normal

* Add requires_binding to bridge test fixtures

* chore(wechat): isolate silk-rs in standalone ironclaw-silk-decoder helper

Move all SILK decoding into a workspace-excluded crate
(`crates/ironclaw_silk_decoder/`) and invoke it from the host as a
subprocess over stdin/stdout. The main `cargo build` no longer pulls
`silk-rs` (and its `bindgen`/`libclang` build chain), addressing the
review concern flagged on PR #1666 by zmanian and Copilot.

Behavior is unchanged when the helper is installed: WeChat voice
attachments are transcoded SILK→WAV and `mime_type` rewritten to
`audio/wav`. Without the helper, the existing graceful-degrade path
preserves raw `audio/silk` bytes and logs that the decoder is missing.

The host looks up the helper in this order:
1. `IRONCLAW_SILK_DECODER` env var
2. Sibling of the running `ironclaw` executable
3. `ironclaw-silk-decoder` on `$PATH`

Caller-level tests use a Unix shell stub binary (under `tempfile`) to
drive the spawn-binary path through `maybe_transcode_wechat_silk_attachment`,
covering success, decoder-failure (caller fallback), non-RIFF rejection,
and empty-input cases.

WIP: this is the native-binary variant. A WASM-target follow-up may
replace the native binary with a single `silk-decoder.wasm` artifact
matching the WeChat channel distribution pattern.

https://claude.ai/code/session_01C5cjqPY1PkVRexraKWmmsz

* chore(silk-decoder): mark crate as standalone, commit lockfile

Add an explicit empty `[workspace]` table so cargo treats the crate as
its own root rather than trying to inherit the IronClaw workspace.
Without this, `cargo build --manifest-path crates/ironclaw_silk_decoder/Cargo.toml`
errors with "current package believes it's in a workspace when it's not".

Commit the standalone Cargo.lock for reproducible builds of the helper.

https://claude.ai/code/session_01C5cjqPY1PkVRexraKWmmsz

* fix(silk-decoder): address clippy::question_mark + assertions_on_constants

Two lints the Clippy job flagged on the silk-decoder host integration:

1. `question_mark` — replace `if let Err(error) = writer.await.map_err(...)?
   { return Err(error); }` with `writer.await.map_err(...)??;`. Same
   semantics, idiomatic.
2. `assertions_on_constants` — promote the runtime
   `assert!(MAX_DECODED_WAV_BYTES >= MAX_ATTACHMENT_BYTES)` invariant
   to a `const _: () = assert!(...)` so it's checked at compile time
   and doesn't burn a test slot.

No behavioral change.

https://claude.ai/code/session_01C5cjqPY1PkVRexraKWmmsz

* fix(silk-decoder/tests): serialize env-var mutation via lock_env

Three async stub-binary tests and two resolve-command tests all mutate
the same `IRONCLAW_SILK_DECODER` env var. Under cargo's parallel
test threads they trampled each other, causing flaky failures (each
test passed in isolation, two failed when run together). The CI
"Run Tests" job hit this on the latest commit.

Adopt the existing `crate::config::helpers::lock_env()` mutex pattern
already used by shell.rs, llm/recording.rs, pairing/approval.rs,
restart.rs, etc. EnvGuard now holds the lock as a field so the env
var stays restored before another test takes the lock; ordering is
guaranteed because Drop runs the custom restoration body before
field-drop releases the mutex.

Verified locally: all 13 channels::wasm::attachment_hydration tests
pass with the default parallel test runner.

https://claude.ai/code/session_01C5cjqPY1PkVRexraKWmmsz

* chore(silk-decoder): switch silk-rs -> silk-codec 0.2.0

silk-codec is a sibling fork of the same upstream Skype SILK SDK
sources used by silk-rs, but newer and better-maintained:

- bindgen 0.72 (vs silk-rs's 0.59 from 2021)
- cc 1.2 (vs older)
- thiserror 2.0
- Identical decode_silk(src, sample_rate) -> Result<Vec<u8>, SilkError>
  signature; both implementations skip the 0x02 Tencent flag and
  require the "#!SILK_V3" header, so behavior on WeChat voice notes
  is unchanged.

This is purely a tooling refresh in the standalone helper crate. The
main IronClaw build still has zero SILK / libclang dependency. The
host's subprocess invocation, capability gating, size caps, and
graceful-degrade-to-raw-SILK fallback are all unchanged.

Verified locally:
- crates/ironclaw_silk_decoder: 6/6 unit tests pass
- ironclaw lib: 13/13 attachment_hydration tests pass (parallel runner)
- cargo fmt --check: clean

Note: PR #1666's spec-compatibility comment in Cargo.toml previously
named silk-rs; the renamed comment in this commit reflects the new
dependency. No other host code references either crate by name.

https://claude.ai/code/session_01C5cjqPY1PkVRexraKWmmsz

---------

Co-authored-by: Robert Yan <46699230+think-in-universe@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-05-07 14:19:41 +00:00
..
2026-05-07 14:19:41 +00:00