Repository navigation
Releases
v0.1.8 — PyPI + Homebrew installable
What's new
fusion-channel is now installable from PyPI and Homebrew (#9).
- PyPI:
pip install fusion-channel— published automatically onv*tags via GitHub Actions (lint + full-test gate,python -m build,twine check, Trusted Publishing). Full package metadata (readme, classifiers, urls) on the PyPI page. Extras:,fastapifor the webhook router. - Homebrew:
brew install dahai80/tap/fusion-channel— formula at dahai80/homebrew-tap, generated byscripts/gen_homebrew_formula.py(pinned sdist resources,virtualenv_install_with_resources, Rust build for cryptography/pydantic-core). Installs into an isolated venv. - New diagnostics CLI (
fusion-channel):version,check-config <yaml>(load-time credential validation),test-connection <yaml> <channel_id>. No new dependencies. __version__now resolves from installed dist metadata (was a stale hardcode).
Verification: 206 tests passing (10 new CLI tests), ruff clean; sdist/wheel twine check PASSED; wheel smoke-tested in a clean venv; publish run green; formula ruby -c clean.
🤖 Generated with Claude Code
v0.1.7 — README Python prerequisite note
What's new
Docs release closing the 2026-11-26 audit findings (#7 / PR #8):
- Audit finding "no README.md": stale —
README.md/README_CN.mdhave been onmainsince 2026-10-25 (commit 4de0ef3) and cover purpose, architecture position, install, config, and test commands. - Real gap fixed: both READMEs' Install sections now state the Python prerequisite —
requires-python = ">=3.12"frompyproject.toml, matching the workspace.python-versionpin. - Docs-only change: CI skipped by design (
paths-ignorefor**.md); verified locally — 196 tests passing, ruff check + format clean.
🤖 Generated with Claude Code
v0.1.6 — CI bootstrap
What's new
CI bootstrap per the fusion#2 checklist (issue #5) — the repo previously had zero GitHub Actions workflows and no CI runs at all.
- Workflow:
.github/workflows/ci.yml— lint (ruff check+ruff format --check) + full pytest suite on Python 3.12, install viapip install -e ".[test,fastapi]". - Concurrency:
ci-<ref>group withcancel-in-progress: truefrom day one. - Dependency cache:
actions/setup-python@v5withcache: pip. - paths-ignore: markdown /
docs//examples/-only changes skip CI. - Tiered gate assessment: suite runs ~15–25s (196 tests), far under the ~5 min threshold — single job, no tiering.
- Run minutes: before = 0 (no workflows existed); after = ~29s per run (job wall time, run 43815475644; the badge/docs runs are similar or skipped by paths-ignore).
- CI badge added to both READMEs. The new lint gate immediately caught one real defect (an unformatted Python code block in
docs/consumer-integration.md) — fixed in this cycle.
No behavior changes: 196 tests passing, ruff clean.
🤖 Generated with Claude Code
v0.1.5 — consumer integration guide
What's new
Documentation release answering the ai-booking-agent M3 integration questions (#4) — new docs/consumer-integration.md, linked from both READMEs:
- Outbound pattern:
registry.send()returns the outbox record id (persist it for correlation); long-running services should use the owned workerregistry.start_outbox()(cancelled byclose()) instead of a manualflush_once()loop;on_permanent_failuremaps to consumer alerting;provider_message_id(TwilioMessageSid) stored on successful sends. - Delivery status: provider status callbacks land as archived
Receipts (store.save_receipt), never dispatched as messages — Postgresnotificationswriteback by subclassingChannelStore.save_receipt, with the CAS/dedup return-value contracts spelled out. - Store choice:
SqliteStorefor single-process; Postgres-backedChannelStorerecommended for a long-running FastAPI service,claim_outboxmust stay a true CAS. - Credential refs: full resolution priority (
env:→ provider key →{channel_id}:{field}default → literal) plus multi-consumer isolation caveats (the literal fallback typo trap; channel id as the in-process isolation unit). - SMS/10DLC: US long codes work out of the box (E.164
from_number); 10DLC registration is Twilio-account-side — the adapter neither blocks nor requires it.
No behavior changes: 196 tests passing, ruff clean.
🤖 Generated with Claude Code
v0.1.4 — gmail_api adapter (Gmail / Google Workspace)
What's new
New gmail_api adapter (#3): pull-mode Gmail / Google Workspace ingestion via the Gmail API with OAuth2 (refresh-token grant).
- Auth: OAuth2 refresh token (
client_id/client_secret/refresh_token/user_id); token cached with one-shot 401 refresh.env:credential refs supported; missing creds fail withConfigErrorat load. - Poll:
historyIdincremental sync when a previous poll (or thehistory_idconfig seed) recorded one, with automatic fallback to the fulllabel_ids+ optionalquerylist when the history window has expired. Per-messageformat=fullfetch (attachment ids live in the payload parts), thenmodifyLabelsstripsUNREADso re-poll dedup matchesemail_imapsemantics; label-strip failure falls back to Message-ID dedup. - Resilience: 429 on the list backs off to the next poll cycle; 429 on a single message skips it. Poll failures are isolated per channel by the registry.
- Threading: Gmail
threadIdandIn-Reply-Toboth surface (conversation.thread_id+raw.gmail_thread_id). - Attachments:
adapter.download_attachment(gmail_message_id, attachment_id)returns real bytes — the document-pipeline path for emailed PDFs. - Outbound:
messages.sendwith raw MIME;draft_mode: trueswitches todrafts.create(human-approval flow). Subject rules matchemail_imap. - Config:
label_ids(defaultINBOX, UNREAD),query,poll_batch_limit(default 25),history_id,draft_mode.
12 adapters total. 196 tests passing (20 new mocked-Gmail tests), ruff clean.
🤖 Generated with Claude Code
v0.1.3
What's new
graph_mail adapter — Microsoft 365 / Exchange Online mail ingestion (#2)
New 11th adapter for consumers that need to ingest mail from M365 shared
mailboxes (e.g. AI agents processing emailed PDF purchase orders). M365 has
basic auth disabled, so the IMAP/password path of email_imap cannot connect
there — graph_mail polls via Microsoft Graph with OAuth2 client credentials.
- Credentials:
tenant_id/client_id/client_secret/mailbox
(register an Entra ID app with theMail.ReadWriteapplication permission
on the shared mailbox). Values support the standardenv:VARrefs; empty
refs fail at registry load with a clearConfigError. - Poll semantics match
email_imap: list unread in the configured folder
(folder, defaultINBOX), fetch the full MIME, mark as read, batch limit
poll_batch_limit(default 20). Polled requests flow through the identical
handle_inboundpipeline (dedup, archive, commands, identity gate). - Attachments: Graph attachment refs land in
MediaRefwith provider ids
and download URLs;adapter.download_attachment(graph_message_id, attachment_id)returns the real bytes for document pipelines. - Outbound:
POST /users/{mailbox}/sendMailthrough the same outbox;
subject rules matchemail_imap(meta={"subject": ...}or first line,
Re:prefix on replies). - Token handling: client-credentials grant with monotonic-clock cache and
one-shot 401 refresh; all error strings secret-redacted.
Other
- Capability matrix extended to 11 adapters (
graph_mailmirrors
email_imap: receive/send/media/threads, cards degrade to fallback text). - 17 new mocked-Graph tests (token fetch/cache/refresh, mark-read verified,
dedup on re-poll, mark-read-failure dedup fallback, attachment download
bytes, sendMail payload shape, error paths). 176 tests total, ruff clean. - README / README_CN / CLAUDE.md updated for the 11-adapter table.
Full changelog: v0.1.2...v0.1.3
🤖 Generated with Claude Code
v0.1.2
Patch release over v0.1.1.
What's in this patch
- QQ Mail live integration E2E (
tests/test_integration_email.py,integrationmarker, skipped by default): real IMAP login + UNSEEN fetch againstimap.qq.com:993, full inbound pipeline with re-poll dedup, and SMTP send-to-self loopback viasmtp.qq.com:587STARTTLS (verified received back in INBOX within 15s). Credentials are env-based only (FUSION_CHANNEL_QQ_EMAIL/FUSION_CHANNEL_QQ_AUTH_CODE). - Docs: README / README_CN updated with live-provider integration test coverage.
- Issue #1 (config Phase 2.2 — adopt
fusion_core.configsingle-point resolution) closed as verified: this repo has no hand-rolled service-key resolution to migrate (check-env.py: 0 findings; no_resolvefunctions; library has no port / data dir / MLX-gateway call sites). Evidence posted on the issue.
Verification
- 159/159 default tests pass; ruff check + format clean.
- Live QQ Mail integration suite 3/3 pass against a real mailbox.
🤖 Generated with Claude Code
v0.1.1 — email channel + pull-mode poll pipeline
What's new
Email channel (email_imap) — the first pull-mode adapter:
- Inbound: IMAP
UNSEENfetch (batch-limited). Adapters that overrideChannelAdapter.poll()fetch their own messages;ChannelRegistry.poll()/start_polling(interval)run them through the exact samehandle_inboundpipeline as webhooks — dedup, archive, command parsing, identity gate. - Verification: no webhook signature exists for email — TLS + account login are the trust boundary;
verify_requestalways passes (logged). - MIME handling stays thin:
text/plainextraction, attachments asMediaRef,In-Reply-Tomapped toconversation.thread_id. - Outbound: same outbox semantics (backoff, CAS claim, token bucket), SMTP + STARTTLS. Subject via
meta={"subject": ...}, defaults to the first line of the text;reply_tosetsIn-Reply-To/References. - Testability:
config["imap_fetch"]/config["smtp_send"]injection — the full suite runs without network.
Also: capability matrix entry for email_imap (CAN_THREADS, cards none), start_polling worker cancelled by close(), example channel config.
Tests
159 tests (14 new), ruff clean.
Install
cd /Users/dahai/fusion && source .venv/bin/activate
pip install -e ".[test]" # add ,fastapi for the webhook router🤖 Generated with Claude Code
v0.1.0
First release of fusion-channel — the Fusion ecosystem's unified messaging channel access layer.
Scope (M1–M3)
- Core abstractions:
ChannelAdapterSPI (abstractverify_request— an adapter without it cannot register),ChannelRegistryfacade (verify → reject-archive → parse → dedup → archive → dispatch), pydantic models. - 9 adapters: Twilio SMS, Aliyun SMS, Tencent SMS, WeCom self-built app, Feishu/Lark app, DingTalk group robot, Slack Events API, WhatsApp Cloud API, Telegram Bot API.
- Outbox: enqueue-first sends,
[30, 120, 600]s backoff, 3 attempts, CAS claim (pending→sendinglease) so two workers never double-send, stale-lease crash recovery, per-channel token-bucket rate limits,on_permanent_failurehook. - Cards: per-
CAN_CARDSdegradation (full / partial / text fallback); text commands and card buttons converge on the sameInteraction. - Storage:
MemoryStore/SqliteStore(aiosqlite); swap in your own DB by subclassing. - Credentials:
CredentialProviderinterface, AES-256-GCM file-backed default (0600 key, atomic writes), env/memory/chained providers; reads return masked values. - Identity:
IdentityMapperexternal-id ↔ fusion-identity mapping,assert_bound_identity()two-factor primitive, optional per-channel identity gate. - FastAPI router: one-line webhook integration, GET handshakes (WeCom echostr, WhatsApp hub.challenge), 1 MiB body cap, fail-closed (never 500).
Hard rules baked in
Verification mandatory at SPI level · archive-first inbound · rejected requests archived · degradation is rendering, not business · credentials never persist in the library · official APIs only (no personal-WeChat reverse protocols).
Review hardening
Two full review batches landed before this tag (commits a3ee4b5, ac2b3cf): dedup-key collision fixes (Slack block_actions trigger_id, DingTalk sessionId, WeCom CreateTime), Aliyun RFC3986 percent-encoding, Tencent phone normalization, WeCom XML/query-param callbacks, Twilio/WhatsApp delivery receipts, Telegram UTF-16 mention offsets, Feishu card.action.trigger, outbox CAS claim, FastAPI catch-all.
Tests: 145 passed, ruff clean. Live-provider tests marked integration (excluded by default).
Install
cd /path/to/fusion && source .venv/bin/activate
pip install -e ".[test]" # add ,fastapi for the webhook router🤖 Generated with Claude Code