Skip to content

feat: add Signal adapter#169

Open
sudodaksh wants to merge 8 commits intovercel:mainfrom
sudodaksh:feat/signal-adapter
Open

feat: add Signal adapter#169
sudodaksh wants to merge 8 commits intovercel:mainfrom
sudodaksh:feat/signal-adapter

Conversation

@sudodaksh
Copy link

@sudodaksh sudodaksh commented Mar 3, 2026

Summary

Adds @chat-adapter/signal — a new adapter for Signal bots powered by signal-cli-rest-api.

Supports send/edit/delete, reactions, typing indicators, file attachments, DM and group threads, and three receive modes (webhook, WebSocket via json-rpc, REST polling). Identity canonicalization handles phone/UUID/source aliases. Message truncation at 4096 chars.

Chat SDK core changes

  • chat.openDM() now infers Signal adapter from signal:-prefixed IDs and E.164 phone numbers
  • Message deduplication key includes edit revision suffix so edited messages aren't swallowed as duplicates

Also included

  • Example app wiring in examples/nextjs-chat
  • 8 standalone local testing scripts in examples/signal-local/
  • Setup guide in README (Docker, device linking, registration, captcha handling)
  • Changeset for @chat-adapter/signal (minor) and chat (minor)

Test plan

  • pnpm validate passes (full monorepo lint + typecheck + tests + build)
  • @chat-adapter/signal: 18 unit tests covering webhook parsing, edit dispatch, polling, sync messages, identity alias stability, group normalization, init failure modes, CRUD operations, and HTTP error mappings
  • chat: 60 tests pass including new Signal DM inference and edit deduplication tests
  • Manually tested against local signal-cli-rest-api (json-rpc/WebSocket): send, edit, delete, reactions, typing, DM + group echo bot
  • Manually tested all 8 examples/signal-local/ scripts

@vercel
Copy link
Contributor

vercel bot commented Mar 3, 2026

@sudodaksh is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

@sudodaksh sudodaksh mentioned this pull request Mar 3, 2026
12 tasks
haydenbleasel and others added 7 commits March 6, 2026 16:38
Resolve conflict in chat.ts by combining the PR's edit dedup suffix
with main's atomic setIfNotExists approach.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The nextjs-chat integration is sufficient for demonstrating Signal adapter
usage. No other adapter has a dedicated example directory.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move Signal checks after existing adapters (GChat, Teams, Slack, Discord)
to avoid any theoretical collisions with established adapter patterns.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The atomic deduplication change (cc65dc3) switched from set() to
setIfNotExists(), but this test still asserted on the old API.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Break 2,217-line index.ts into focused modules:
- identity.ts: identifier canonicalization, alias registration, cycle detection
- cache.ts: message cache operations, pagination, timestamp parsing

Also simplifies normalizePositiveInteger() and makes SignalPollingOptions
internal (not exported).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- identity.test.ts: 17 tests covering canonicalization, cycle detection,
  alias registration, phone number preference
- cache.test.ts: 22 tests covering store/retrieve, pagination, timestamp
  lookup, deletion

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add 30 new tests covering: attachment handling (image/video/audio/file),
attachment downloads, remote delete, bot mention via text pattern,
DM vs group identification, openDM, channel info, thread info, group
posting, empty message rejection, message truncation, text mode handling,
single message fetch, env var validation, network errors, identity alias
transitions, polling lifecycle, and renderFormatted.

Total: 18 -> 87 tests across 3 files, coverage 66% -> 83%.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link
Contributor

vercel bot commented Mar 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
chat Ready Ready Preview, Comment, Open in v0 Mar 7, 2026 1:03am
chat-sdk-nextjs-chat Ready Ready Preview, Comment, Open in v0 Mar 7, 2026 1:03am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants