This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @chat-adapter/discord@4.38.0 ### Minor Changes -a0cba02: Add Vercel Connect credential resolvers and custom webhook verification to the Discord adapter, with `create-chat-sdk --connect` scaffolding for Discord bots. ### Patch Changes -a94995e: Restore attachment downloads across Discord inbound message paths. -4bdf721: Preserve content and attachments from forwarded Discord message snapshots. - Updated dependencies [0f24cc3] - Updated dependencies [bdeb2bf] - Updated dependencies [a0cba02] - Updated dependencies [83ede7e] - Updated dependencies [18d4a23] - chat@4.38.0 - @chat-adapter/shared@4.38.0 ## @chat-adapter/messenger@4.38.0 ### Minor Changes -18d4a23: Add a shared thread API for marking messages as read across WhatsApp, Messenger, and XChat. Note for anyone calling `XchatAdapter.markAsRead()` directly: it now rejects when a receipt fails instead of logging a warning and resolving. Automatic read receipts are unaffected, since the adapter still catches and logs those internally. If you call the method yourself without awaiting it, add a `.catch()` so a failed receipt does not surface as an unhandled rejection. ### Patch Changes - Updated dependencies [0f24cc3] - Updated dependencies [bdeb2bf] - Updated dependencies [a0cba02] - Updated dependencies [83ede7e] - Updated dependencies [18d4a23] - chat@4.38.0 - @chat-adapter/shared@4.38.0 ## @chat-adapter/notion@4.38.0 ### Minor Changes -06b04ac: Add outbound-only Vercel Connect authentication for Notion while retaining native webhook verification and scaffolding. ### Patch Changes - Updated dependencies [0f24cc3] - Updated dependencies [bdeb2bf] - Updated dependencies [a0cba02] - Updated dependencies [83ede7e] - Updated dependencies [18d4a23] - chat@4.38.0 - @chat-adapter/shared@4.38.0 ## @chat-adapter/telegram@4.38.0 ### Minor Changes -0f24cc3: Preserve normalized replied-to message context and populate it from Telegram replies. -7a1150c: Add outbound-only Vercel Connect authentication for Telegram while retaining native webhook verification or polling. -3bbf3ff: Use post-and-edit streaming by default and make native Telegram drafts opt-in. Streams now render the same way in every chat type; set the new `nativeStreaming: true` config option to restore draft previews in private chats. The adapter now owns the post-and-edit loop so edits stay under Telegram's per-chat rate limit. Edits are throttled to a 1100ms floor, configurable with the new `streamingEditIntervalMs` option, and a rate-limited final edit is retried once instead of failing the post. ### Patch Changes -1d2b78d: Deduplicate repeated Telegram webhook updates by their update ID using the configured state adapter. -745fdf5: respect Telegram streaming rate limits and target XChat read receipts exactly - Updated dependencies [0f24cc3] - Updated dependencies [bdeb2bf] - Updated dependencies [a0cba02] - Updated dependencies [83ede7e] - Updated dependencies [18d4a23] - chat@4.38.0 - @chat-adapter/shared@4.38.0 ## @chat-adapter/whatsapp@4.38.0 ### Minor Changes -83ede7e: add native message replies with WhatsApp contextual reply support -18d4a23: Add a shared thread API for marking messages as read across WhatsApp, Messenger, and XChat. Note for anyone calling `XchatAdapter.markAsRead()` directly: it now rejects when a receipt fails instead of logging a warning and resolving. Automatic read receipts are unaffected, since the adapter still catches and logs those internally. If you call the method yourself without awaiting it, add a `.catch()` so a failed receipt does not surface as an unhandled rejection. ### Patch Changes - Updated dependencies [0f24cc3] - Updated dependencies [bdeb2bf] - Updated dependencies [a0cba02] - Updated dependencies [83ede7e] - Updated dependencies [18d4a23] - chat@4.38.0 - @chat-adapter/shared@4.38.0 ## @chat-adapter/x@4.38.0 ### Minor Changes -18d4a23: Add a shared thread API for marking messages as read across WhatsApp, Messenger, and XChat. Note for anyone calling `XchatAdapter.markAsRead()` directly: it now rejects when a receipt fails instead of logging a warning and resolving. Automatic read receipts are unaffected, since the adapter still catches and logs those internally. If you call the method yourself without awaiting it, add a `.catch()` so a failed receipt does not surface as an unhandled rejection. ### Patch Changes -745fdf5: respect Telegram streaming rate limits and target XChat read receipts exactly - Updated dependencies [0f24cc3] - Updated dependencies [bdeb2bf] - Updated dependencies [a0cba02] - Updated dependencies [83ede7e] - Updated dependencies [18d4a23] - chat@4.38.0 - @chat-adapter/shared@4.38.0 ## chat@4.38.0 ### Minor Changes -0f24cc3: Preserve normalized replied-to message context and populate it from Telegram replies. -bdeb2bf: Add a workflow-safe `chat/serialization` entrypoint and isolate automatic Chat class serializers from Node-only runtime dependencies. -a0cba02: Add Vercel Connect credential resolvers and custom webhook verification to the Discord adapter, with `create-chat-sdk --connect` scaffolding for Discord bots. -83ede7e: add native message replies with WhatsApp contextual reply support -18d4a23: Add a shared thread API for marking messages as read across WhatsApp, Messenger, and XChat. Note for anyone calling `XchatAdapter.markAsRead()` directly: it now rejects when a receipt fails instead of logging a warning and resolving. Automatic read receipts are unaffected, since the adapter still catches and logs those internally. If you call the method yourself without awaiting it, add a `.catch()` so a failed receipt does not surface as an unhandled rejection. ## create-chat-sdk@0.4.0 ### Minor Changes -a0cba02: Add Vercel Connect credential resolvers and custom webhook verification to the Discord adapter, with `create-chat-sdk --connect` scaffolding for Discord bots. -06b04ac: Add outbound-only Vercel Connect authentication for Notion while retaining native webhook verification and scaffolding. -7a1150c: Add outbound-only Vercel Connect authentication for Telegram while retaining native webhook verification or polling. ## @chat-adapter/gchat@4.38.0 ### Patch Changes -2f40a32: Fix attachment downloads failing with a 400 when `attachmentDataRef` is present `fetchAttachmentData` called the Chat media endpoint without `alt=media`, so it returned resource metadata rather than file bytes and rejected the arraybuffer request with a bare 400. Every download by `resourceName` failed, which is the path taken for any file uploaded directly to Chat. The download path is also hardened: when `media.download` fails and the attachment carries a `downloadUri`, the adapter now falls back to fetching that URL instead of rejecting, and failures with no fallback are routed through the shared error handling so a 429 surfaces as `AdapterRateLimitError` like every other Chat API call. - Updated dependencies [0f24cc3] - Updated dependencies [bdeb2bf] - Updated dependencies [a0cba02] - Updated dependencies [83ede7e] - Updated dependencies [18d4a23] - chat@4.38.0 - @chat-adapter/shared@4.38.0 ## @chat-adapter/github@4.38.0 ### Patch Changes - Updated dependencies [0f24cc3] - Updated dependencies [bdeb2bf] - Updated dependencies [a0cba02] - Updated dependencies [83ede7e] - Updated dependencies [18d4a23] - chat@4.38.0 - @chat-adapter/shared@4.38.0 ## @chat-adapter/instagram@4.38.0 ### Patch Changes - Updated dependencies [0f24cc3] - Updated dependencies [bdeb2bf] - Updated dependencies [a0cba02] - Updated dependencies [83ede7e] - Updated dependencies [18d4a23] - chat@4.38.0 - @chat-adapter/shared@4.38.0 ## @chat-adapter/linear@4.38.0 ### Patch Changes - Updated dependencies [0f24cc3] - Updated dependencies [bdeb2bf] - Updated dependencies [a0cba02] - Updated dependencies [83ede7e] - Updated dependencies [18d4a23] - chat@4.38.0 - @chat-adapter/shared@4.38.0 ## @chat-adapter/shared@4.38.0 ### Patch Changes - Updated dependencies [0f24cc3] - Updated dependencies [bdeb2bf] - Updated dependencies [a0cba02] - Updated dependencies [83ede7e] - Updated dependencies [18d4a23] - chat@4.38.0 ## @chat-adapter/slack@4.38.0 ### Patch Changes - Updated dependencies [0f24cc3] - Updated dependencies [bdeb2bf] - Updated dependencies [a0cba02] - Updated dependencies [83ede7e] - Updated dependencies [18d4a23] - chat@4.38.0 - @chat-adapter/shared@4.38.0 ## @chat-adapter/teams@4.38.0 ### Patch Changes - Updated dependencies [0f24cc3] - Updated dependencies [bdeb2bf] - Updated dependencies [a0cba02] - Updated dependencies [83ede7e] - Updated dependencies [18d4a23] - chat@4.38.0 - @chat-adapter/shared@4.38.0 ## @chat-adapter/twilio@4.38.0 ### Patch Changes - Updated dependencies [0f24cc3] - Updated dependencies [bdeb2bf] - Updated dependencies [a0cba02] - Updated dependencies [83ede7e] - Updated dependencies [18d4a23] - chat@4.38.0 - @chat-adapter/shared@4.38.0 ## @chat-adapter/web@4.38.0 ### Patch Changes - Updated dependencies [0f24cc3] - Updated dependencies [bdeb2bf] - Updated dependencies [a0cba02] - Updated dependencies [83ede7e] - Updated dependencies [18d4a23] - chat@4.38.0 - @chat-adapter/shared@4.38.0 ## @chat-adapter/state-ioredis@4.38.0 ### Patch Changes - Updated dependencies [0f24cc3] - Updated dependencies [bdeb2bf] - Updated dependencies [a0cba02] - Updated dependencies [83ede7e] - Updated dependencies [18d4a23] - chat@4.38.0 ## @chat-adapter/state-memory@4.38.0 ### Patch Changes - Updated dependencies [0f24cc3] - Updated dependencies [bdeb2bf] - Updated dependencies [a0cba02] - Updated dependencies [83ede7e] - Updated dependencies [18d4a23] - chat@4.38.0 ## @chat-adapter/state-pg@4.38.0 ### Patch Changes - Updated dependencies [0f24cc3] - Updated dependencies [bdeb2bf] - Updated dependencies [a0cba02] - Updated dependencies [83ede7e] - Updated dependencies [18d4a23] - chat@4.38.0 ## @chat-adapter/state-redis@4.38.0 ### Patch Changes - Updated dependencies [0f24cc3] - Updated dependencies [bdeb2bf] - Updated dependencies [a0cba02] - Updated dependencies [83ede7e] - Updated dependencies [18d4a23] - chat@4.38.0 ## @chat-adapter/tests@4.38.0 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@chat-adapter/tests
npm package:
@chat-adapter/tests
Vitest factories, matchers, and setup utilities for testing Chat SDK adapters and bots.
Installation
pnpm add -D @chat-adapter/tests
This package has chat and vitest as peer dependencies — they should already be in your project.
Factories
import {
createMockAdapter,
createMockChatInstance,
createMockState,
createTestMessage,
mockLogger,
} from "@chat-adapter/tests";
createMockAdapter(name?, overrides?)
Returns an Adapter with every method as vi.fn() and sensible defaults. Pass overrides to swap individual methods:
const adapter = createMockAdapter("slack", {
postMessage: vi.fn().mockResolvedValue({ id: "msg-7", raw: {} }),
});
createMockState()
Returns a StateAdapter backed by in-memory Maps — subscriptions, locks, KV, lists, and queues all work end-to-end. Includes a cache: Map<string, unknown> for direct inspection.
createMockChatInstance(options?)
Returns a ChatInstance with every process* handler as vi.fn(). Useful for adapter authors verifying their adapter dispatches incoming events through the right hook.
const state = createMockState();
const chat = createMockChatInstance({ state });
await myAdapter.handleWebhook(req); // your adapter under test
expect(chat.processMessage).toHaveBeenCalledOnce();
createTestMessage(id, text, overrides?)
Builds a Message with parsed markdown AST already wired up.
mockLogger / createMockLogger()
mockLogger is a shared Logger for tests that don't care about isolation. createMockLogger() returns a fresh one per call.
Matchers
Vitest custom matchers covering the most common Chat SDK assertions.
Auto-register via setup file
// vitest.config.ts
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
setupFiles: ["@chat-adapter/tests/setup"],
},
});
Manual registration
import { matchers } from "@chat-adapter/tests/matchers";
expect.extend(matchers);
Available matchers
| Matcher | Asserts |
|---|---|
expect(adapter).toHavePosted(threadId, textPattern?) |
adapter.postMessage was called for this thread (and message text matches textPattern if given) |
expect(adapter).toHaveEdited(threadId, messageId, textPattern?) |
adapter.editMessage was called for this message (and text matches textPattern if given) |
expect(adapter).toHaveDeleted(threadId, messageId) |
adapter.deleteMessage was called for this message |
expect(adapter).toHaveReactedWith(threadId, messageId, emoji) |
adapter.addReaction was called with the emoji (string or EmojiValue.name) |
expect(adapter).toHaveStartedTyping(threadId) |
adapter.startTyping was called for this thread |
expect(adapter).toHavePostedToChannel(channelId, textPattern?) |
adapter.postChannelMessage was called for this channel |
expect(chat).toHaveDispatched(handler) |
The named process* handler on the mock ChatInstance was called |
expect(state).toBeSubscribedTo(threadId) |
state.isSubscribed(threadId) resolves to true (async — needs await) |
expect(adapter).toHavePosted("slack:C1:t1", /hello/);
expect(adapter).toHaveEdited("slack:C1:t1", "msg-1", /updated/);
expect(adapter).toHaveDeleted("slack:C1:t1", "msg-1");
expect(adapter).toHaveReactedWith("slack:C1:t1", "msg-1", "thumbsup");
expect(adapter).toHaveStartedTyping("slack:C1:t1");
expect(adapter).toHavePostedToChannel("slack:C1");
expect(chat).toHaveDispatched("processMessage");
await expect(state).toBeSubscribedTo("slack:C1:t1");
Text-pattern matchers (toHavePosted, toHaveEdited, toHavePostedToChannel) extract a comparable string from AdapterPostableMessage — handling plain strings, PostableMarkdown.markdown, PostableRaw.raw, and PostableCard.fallbackText. AST-shaped messages (PostableAst) and cards without fallbackText aren't text-matchable; assert without textPattern and inspect mock.calls directly for deeper checks.
Audience
- Bot authors — drive simulated events through your handlers, assert on outbound calls.
- Adapter authors — verify your
Adapterimplementation routes webhooks through the rightChatInstance.process*hook with the right normalized payload.
Adapter-specific helpers (e.g. signed Slack webhook builders, Teams claim builders) live in each adapter's own /testing subpath, not in this kit.
AI Coding Agents
If you use an AI coding agent such as OpenAI Codex, Claude Code, or Cursor, install the Chat SDK skill so it knows the SDK APIs, adapter patterns, and project conventions before writing code.
npx skills add vercel/chat
The skill references bundled documentation in node_modules/chat/docs, plus adapter guides and starter templates in the published package.
You can also install the Vercel Plugin for a broader agent toolkit — it includes the Chat SDK skill alongside specialist agents, agent slash commands, and more:
npx plugins add vercel/vercel-plugin
The plugin is optional; the skill alone is enough to build with Chat SDK.
For agent-readable documentation, see chat-sdk.dev/llms.txt (page index) or chat-sdk.dev/llms-full.txt (full text).
License
MIT