Commit Graph

198 Commits

Author SHA1 Message Date
github-actions[bot] e3c136b6dc chore(release): version packages (#710)
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.35.0

### Minor Changes

- 26c0522: Add an opt-in channel allowlist for treating non-bot Discord
messages as directed to the bot without requiring a mention. Configure
via `respondToChannelIds` or the `DISCORD_RESPOND_TO_CHANNEL_IDS` env
var (comma-separated).

### Patch Changes

- b605cf6: Preserve Discord's angle-bracket syntax for suppressing link
previews when rendering markdown.
- Updated dependencies [80def3a]
- Updated dependencies [4cb7e5d]
- Updated dependencies [46681f5]
- Updated dependencies [93a58af]
- Updated dependencies [25f3099]
  - chat@4.35.0
  - @chat-adapter/shared@4.35.0
## @chat-adapter/slack@4.35.0

### Minor Changes

- bb7cd12: Expose sender email addresses on normalized incoming Slack
message authors. `message.author.email` is populated from the same
cached `users.info` lookup used for display names and requires the
`users:read.email` scope; without it the field stays undefined.
- 907450d: Enterprise Grid fixes:

- `handleOAuthCallback` now handles org-wide installs
(`is_enterprise_install`): Slack returns `team: null` for these, and the
installation is now keyed by the enterprise ID — the same key webhook
token resolution looks up — instead of failing. The result includes
`enterpriseId` and `isEnterpriseInstall`, and `SlackInstallation`
records both.
- Socket mode now resolves per-installation tokens for events, slash
commands, and interactive payloads in multi-workspace deployments
(matching the HTTP webhook path), and no longer drops `enterprise_id` /
`is_enterprise_install` / `is_ext_shared_channel` from event payloads.
- The user profile cache and display-name mention reverse index are now
scoped by installation in multi-workspace deployments, so profiles
fetched with one workspace's token no longer bleed into another and
mentions can no longer resolve to a same-named user from a different
workspace. Existing cache entries repopulate on first lookup
(single-workspace keys are unchanged). `withBotToken` accepts an
optional `{ installationId }` so proactive/cron posts outside webhook
handling scope these caches too.
- API calls made while handling an event from an org-wide install now
pass the event's `team_id` explicitly, as Slack requires for
workspace-scoped methods (`conversations.list`, `usergroups.*`, …) on
org tokens. When an event carries a `context_team_id` (shared channels
hosted on an "away" workspace), channel-addressed calls echo it back as
`client_context_team_id`.
- Retried event deliveries (`x-slack-retry-num`, socket `retry_num`) are
dropped when the original delivery was already dispatched, using an
`event_id` marker in the state adapter (24-hour TTL). Events whose first
delivery never arrived are still recovered via the retry.
- Bare `@W…` mentions in outgoing messages are now recognized as raw
Enterprise Grid user IDs (previously only `@U…` was), so they render as
real mentions instead of being treated as display names.
- Event token resolution now prefers the envelope's `authorizations[0]`
— Slack's documented location for the event's installation identity —
over the top-level `team_id`/`enterprise_id`, which can name a different
workspace for Slack Connect shared-channel events. Top-level fields
remain as a fallback.

### Patch Changes

- 80def3a: Add optional `isSystem` field to the normalized message
`Author` type to distinguish platform-generated messages from humans and
bots. The Slack adapter now sets `isSystem: true` for messages authored
by Slack's reserved `USLACK` user (e.g. "@user archived the channel"
notifications in DMs), so consumers no longer need to hard-code
Slack-specific user IDs.
- 92530dd: Return a replyable Slack thread ID from `channel.post()` by
using the posted top-level message's timestamp as the thread root.
- Updated dependencies [80def3a]
- Updated dependencies [4cb7e5d]
- Updated dependencies [46681f5]
- Updated dependencies [93a58af]
- Updated dependencies [25f3099]
  - chat@4.35.0
  - @chat-adapter/shared@4.35.0
## @chat-adapter/teams@4.35.0

### Minor Changes

- 5eb8b84: Add support for adding and removing reactions from Microsoft
Teams messages.
- 46681f5: Expose Microsoft Graph email addresses on normalized incoming
Teams message authors. Resolved user profiles are cached in the state
adapter (1 hour, failed lookups 5 minutes) so the lookup doesn't add a
Graph call per message.
- 160140e: Add native Microsoft Teams targeted message support via
`thread.postEphemeral()` and `channel.postEphemeral()`.
- e06b4b6: Add a `token` config option to `TeamsAdapterConfig` for
supplying a custom token factory, forwarded to the Teams SDK's
`AppOptions.token`. This lets bots authenticate on runtimes that can't
reach Azure IMDS (so `federated` managed identity isn't reachable) but
can still mint access tokens through an external mechanism, without
needing a static client secret.

### Patch Changes

- 3895ab3: Fall back to Microsoft Graph's user principal name when a
Teams user has no mail address.
- 93a58af: Show explicitly configured progress as a native Teams DM
status while preserving native streaming.
- Updated dependencies [80def3a]
- Updated dependencies [4cb7e5d]
- Updated dependencies [46681f5]
- Updated dependencies [93a58af]
- Updated dependencies [25f3099]
  - chat@4.35.0
  - @chat-adapter/shared@4.35.0
## @chat-adapter/telegram@4.35.0

### Minor Changes

- 54eea71: Add an optional Telegram user allowlist via `allowedUserIds`
or the comma-separated `TELEGRAM_ALLOWED_USER_IDS` environment variable.

### Patch Changes

- 0701679: Cache the compiled bot-mention regex in `isBotMentioned`
instead of recompiling it per message, and make the protected `sleep`
helper accept an optional `AbortSignal` so `stopPolling()` interrupts
the polling backoff delay immediately.
- Updated dependencies [80def3a]
- Updated dependencies [4cb7e5d]
- Updated dependencies [46681f5]
- Updated dependencies [93a58af]
- Updated dependencies [25f3099]
  - chat@4.35.0
  - @chat-adapter/shared@4.35.0
## chat@4.35.0

### Minor Changes

- 4cb7e5d: Add a `chat/workflow` subpath with `requestApproval()`:
durable human-in-the-loop approvals built on Workflow SDK. It posts an
approval card with Approve/Deny buttons, suspends the workflow until a
user decides (or an optional timeout elapses), validates approvers,
finalizes the card with the outcome, and returns `{ approved, timedOut,
user }`. Also exports the `buildApprovalCard` and `buildResolvedCard`
builders. Requires the new optional `workflow` peer dependency.
- 46681f5: Expose Microsoft Graph email addresses on normalized incoming
Teams message authors. Resolved user profiles are cached in the state
adapter (1 hour, failed lookups 5 minutes) so the lookup doesn't add a
Graph call per message.

### Patch Changes

- 80def3a: Add optional `isSystem` field to the normalized message
`Author` type to distinguish platform-generated messages from humans and
bots. The Slack adapter now sets `isSystem: true` for messages authored
by Slack's reserved `USLACK` user (e.g. "@user archived the channel"
notifications in DMs), so consumers no longer need to hard-code
Slack-specific user IDs.
- 93a58af: Show explicitly configured progress as a native Teams DM
status while preserving native streaming.
- 25f3099: `toAiMessages` no longer drops messages that have no text. A
message with an empty text body is now kept when it has links or
attachments the converter can include: images and text files (`text/*`,
JSON, XML, YAML, etc.) with a working `fetchData()`. Messages whose only
attachments are unsupported (video, audio, other file types, or
attachments without `fetchData()`) are still skipped, and
`onUnsupportedAttachment` now fires for video/audio attachments on these
previously filtered messages.

Note: multipart `content` no longer always starts with a text part. When
a kept message had no text, its `content` array contains only attachment
parts.
## @chat-adapter/gchat@4.35.0

### Patch Changes

- 270b1c2: fix(gchat): accept `endpointUrl` as a direct-webhook verifier
and verify each token type correctly

When a Google Chat app's connection setting **Authentication audience**
is set
to **HTTP endpoint URL** — Google's recommended option for HTTP-hosted
apps
not behind Cloud Run IAM, and the only mode available for Workspace
Add-on
Chat apps — incoming tokens are Google OIDC ID tokens whose `aud` is the
endpoint URL rather than the GCP project number. Previously the adapter
only
verified against `googleChatProjectNumber`, so URL-audience tokens
always
failed with 401 Unauthorized. The adapter now accepts `endpointUrl` as a
direct-webhook verifier (including in the constructor's fail-closed
check),
validating the OIDC token's audience plus the Google Chat issuer email
claims
  (`chat@system.gserviceaccount.com`, or the
`service-{projectNumber}@gcp-sa-gsuiteaddons.iam.gserviceaccount.com`
service
identity for Workspace Add-on Chat apps) with `email_verified: true` — a
public endpoint URL audience alone is not sufficient to forge a request.

  Project-number-audience tokens are now verified per Google's reference
  implementation: they are JWTs self-signed by
`chat@system.gserviceaccount.com`, so the adapter checks them against
that
  service account's X.509 certificates with issuer
`chat@system.gserviceaccount.com` (previously it used `verifyIdToken`,
which
only accepts Google OIDC issuers and certs and therefore rejected every
real
project-number token). When both verifiers are configured, either token
type
  is accepted.

  The adapter still infers an endpoint URL from incoming requests for
button-click action routing only — that inferred value is never used as
a
JWT verification audience, and inference now only happens after a
request
has passed verification (or verification was explicitly disabled),
because
  `request.url` derives from the attacker-controllable `Host` header in
  serverless runtimes.

- Updated dependencies [80def3a]
- Updated dependencies [4cb7e5d]
- Updated dependencies [46681f5]
- Updated dependencies [93a58af]
- Updated dependencies [25f3099]
  - chat@4.35.0
  - @chat-adapter/shared@4.35.0
## @chat-adapter/github@4.35.0

### Patch Changes

- Updated dependencies [80def3a]
- Updated dependencies [4cb7e5d]
- Updated dependencies [46681f5]
- Updated dependencies [93a58af]
- Updated dependencies [25f3099]
  - chat@4.35.0
  - @chat-adapter/shared@4.35.0
## @chat-adapter/linear@4.35.0

### Patch Changes

- Updated dependencies [80def3a]
- Updated dependencies [4cb7e5d]
- Updated dependencies [46681f5]
- Updated dependencies [93a58af]
- Updated dependencies [25f3099]
  - chat@4.35.0
  - @chat-adapter/shared@4.35.0
## @chat-adapter/messenger@4.35.0

### Patch Changes

- Updated dependencies [80def3a]
- Updated dependencies [4cb7e5d]
- Updated dependencies [46681f5]
- Updated dependencies [93a58af]
- Updated dependencies [25f3099]
  - chat@4.35.0
  - @chat-adapter/shared@4.35.0
## @chat-adapter/shared@4.35.0

### Patch Changes

- Updated dependencies [80def3a]
- Updated dependencies [4cb7e5d]
- Updated dependencies [46681f5]
- Updated dependencies [93a58af]
- Updated dependencies [25f3099]
  - chat@4.35.0
## @chat-adapter/twilio@4.35.0

### Patch Changes

- Updated dependencies [80def3a]
- Updated dependencies [4cb7e5d]
- Updated dependencies [46681f5]
- Updated dependencies [93a58af]
- Updated dependencies [25f3099]
  - chat@4.35.0
  - @chat-adapter/shared@4.35.0
## @chat-adapter/web@4.35.0

### Patch Changes

- Updated dependencies [80def3a]
- Updated dependencies [4cb7e5d]
- Updated dependencies [46681f5]
- Updated dependencies [93a58af]
- Updated dependencies [25f3099]
  - chat@4.35.0
  - @chat-adapter/shared@4.35.0
## @chat-adapter/whatsapp@4.35.0

### Patch Changes

- 09b72e9: fix whatsapp card media duplication

- Prevent card titles and body content from appearing twice when sending
cards with files on WhatsApp.
- Avoid adding the full card fallback text as an image caption when an
interactive message follows.
- Keep interactive WhatsApp messages responsible for rendering card
titles, bodies, and actions.

- Updated dependencies [80def3a]
- Updated dependencies [4cb7e5d]
- Updated dependencies [46681f5]
- Updated dependencies [93a58af]
- Updated dependencies [25f3099]
  - chat@4.35.0
  - @chat-adapter/shared@4.35.0
## @chat-adapter/x@4.35.0

### Patch Changes

- Updated dependencies [80def3a]
- Updated dependencies [4cb7e5d]
- Updated dependencies [46681f5]
- Updated dependencies [93a58af]
- Updated dependencies [25f3099]
  - chat@4.35.0
  - @chat-adapter/shared@4.35.0
## @chat-adapter/state-ioredis@4.35.0

### Patch Changes

- Updated dependencies [80def3a]
- Updated dependencies [4cb7e5d]
- Updated dependencies [46681f5]
- Updated dependencies [93a58af]
- Updated dependencies [25f3099]
  - chat@4.35.0
## @chat-adapter/state-memory@4.35.0

### Patch Changes

- Updated dependencies [80def3a]
- Updated dependencies [4cb7e5d]
- Updated dependencies [46681f5]
- Updated dependencies [93a58af]
- Updated dependencies [25f3099]
  - chat@4.35.0
## @chat-adapter/state-pg@4.35.0

### Patch Changes

- d88789c: Fix `setIfNotExists()` so it can claim a cache key whose
existing row has expired. Previously the query used `ON CONFLICT DO
NOTHING`, so an expired row in `chat_state_cache` still blocked
acquisition until opportunistic cleanup deleted it — diverging from the
memory and Redis adapters, which treat expired entries as absent. Keys
stored without a TTL remain permanent and are never overwritten.
- Updated dependencies [80def3a]
- Updated dependencies [4cb7e5d]
- Updated dependencies [46681f5]
- Updated dependencies [93a58af]
- Updated dependencies [25f3099]
  - chat@4.35.0
## @chat-adapter/state-redis@4.35.0

### Patch Changes

- Updated dependencies [80def3a]
- Updated dependencies [4cb7e5d]
- Updated dependencies [46681f5]
- Updated dependencies [93a58af]
- Updated dependencies [25f3099]
  - chat@4.35.0
## @chat-adapter/tests@4.35.0

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-24 22:21:13 +01:00
Max 54eea71501 feat(telegram): add user allowlist (#742)
## Summary

Add an opt-in `allowedUserIds` Telegram adapter option, with
`TELEGRAM_ALLOWED_USER_IDS` as a comma-separated environment fallback.
Updates from other or unidentified users are ignored before dispatch.

This follows the adapter-level targeting pattern from [the Discord
channel response allowlist](https://github.com/vercel/chat/pull/715),
while enforcing an ingress allowlist instead of expanding mention
routing.

## Test plan

- `pnpm --filter @chat-adapter/telegram test`
- `pnpm --filter @chat-adapter/telegram typecheck`
- `pnpm check`
- `pnpm konsistent`
- `TURBO_CONCURRENCY=2 pnpm validate`

## Checklist

- [x] All commits are signed and verified
- [x] All commits are signed off for the DCO (`git commit -s`)
- [x] `pnpm validate` passes
- [x] Changeset added (or N/A — see
[CONTRIBUTING.md](./CONTRIBUTING.md))
- [x] Documentation updated (or N/A)

Signed-off-by: onmax <maximogarciamtnez@gmail.com>
2026-07-24 21:06:44 +01:00
Aamir Jawaid 160140e32b feat(teams): add targeted ephemeral messages (#737)
## Summary

Microsoft Teams supports targeted messages that are visible only to a
selected conversation member, but the Teams adapter did not expose that
native behavior through the SDK's ephemeral-message API. This PR wires
`postEphemeral` for Teams to send native targeted messages while
preserving normal `postMessage` behavior by default.

The adapter now creates explicit targeted outbound activities with
`MessageActivity.withRecipient(recipient, true)` for text and
adaptive-card messages, returns `usedFallback: false`, and keeps the
feature gated behind `thread.postEphemeral()` /
`channel.postEphemeral()`. It also bumps the Teams SDK packages to
`^2.0.13`, adds targeted coverage, updates public docs/matrices, and
includes a changeset.

Live verification found that Teams targeted messages require the app to
be installed in the shared conversation. Group chats and channels both
worked after using the Teams install picker with `Open -> select
placement -> Go`; personal bot chat targeted sends returned a Teams
`BadArgument` response.

## Test plan

Previously validated with:

- `corepack pnpm --filter @chat-adapter/teams exec vitest run
src/index.test.ts --coverage.enabled=false`
- `corepack pnpm --filter @chat-adapter/teams exec tsc --noEmit`
- `corepack pnpm --filter example-nextjs-chat exec tsc --noEmit`
- `corepack pnpm --filter chat exec vitest run src/emoji.test.ts
--coverage.enabled=false`
- `corepack pnpm --filter @chat-adapter/teams exec tsup`
- Targeted `ultracite check` on changed files

Live verified `TeamsAdapter.postEphemeral(...)` in:

- Group chat `Demo Test 2`: Teams UI showed `Only you can see this
message`.
- Channel `General / Teams SDK`: Teams returned message ID
`1784749118197`, and the UI showed `Only you can see this message`.

<img width="884" height="299" alt="Screenshot 2026-07-22 at 12 41 41 PM"
src="https://github.com/user-attachments/assets/cd350ac8-c158-4779-8028-3450eb8670f2"
/>
<img width="1098" height="559" alt="Screenshot 2026-07-22 at 12 41
33 PM"
src="https://github.com/user-attachments/assets/bf6ea12b-ab11-46ee-a3a8-ff5e9583066d"
/>


## Checklist

- [ ] All commits are signed and verified - unsigned commit created
after local GPG/SSH signing was unavailable and user approved continuing
- [ ] `pnpm validate` passes - full validate not run; targeted
validation listed above
- [x] Changeset added (or N/A - see
[CONTRIBUTING.md](./CONTRIBUTING.md))
- [x] Documentation updated (or N/A)

---------

Co-authored-by: dancer <josh@afterima.ge>
Copilot-Session: 601a7414-48f0-4e6d-ba03-28fa4d2d5c0a
2026-07-23 19:53:13 +01:00
Cole 25f30998ce fix(chat): keep attachment/link-only messages in toAiMessages (#713)
- `toAiMessages` previously filtered out any message with empty or
whitespace-only text (`sorted.filter((msg) => msg.text.trim())`). This
discarded messages that carry meaningful content without text — e.g. an
image uploaded with no caption, a file-only upload, or a link-only
message.
- Now messages are kept as long as they have usable content (text,
image/file attachments, or links). Only messages with *none* of those
are skipped.
- When an attachment-only message is included, no empty `text` part is
prepended (an empty text part would be rejected by the AI SDK).
Link-only messages render a standalone `Links:\n...` block.

## Changes

- `packages/chat/src/ai/messages.ts` — drop the text-only pre-filter;
build text conditionally; skip only truly empty messages.
- `packages/chat/src/ai/messages.test.ts` — add tests for image-only,
link-only, interleaved, whitespace-with-attachment, and fully-empty
cases.
- `apps/docs/content/docs/ai/to-ai-messages.mdx` — update the documented
filtering behavior.
- Changeset added (`chat`: patch).

---------

Co-authored-by: Cole Corrente <cole.corrente@snowflake.com>
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
2026-07-22 14:40:41 +10:00
Ben Sabic 4cb7e5d58e feat(chat): durable human-in-the-loop approvals via chat/workflow (#728)
Adds a `chat/workflow` subpath export with `requestApproval()`. This is
the DX from #284, rebuilt on Workflow SDK so the approval survives
deploys, restarts, and arbitrarily long waits. No in-memory promises, no
approvals registry, no restart-recovery machinery: the workflow suspends
on a webhook and resumes when a button is clicked.

`requestApproval()` posts a card with Approve/Deny buttons whose
`callbackUrl` targets a `createWebhook()` URL, suspends the workflow
until a decision (or optional durable-sleep timeout), validates
approvers, finalizes the card in place with the outcome (removing the
buttons, leaving an audit trail), and returns the decision.

```typescript
import { requestApproval } from "chat/workflow";
import type { Thread } from "chat";
export async function deployApproval(opts: { thread: Thread; version: string }) {
  "use workflow";
  const { approved, user, timedOut } = await requestApproval(opts.thread, {
    title: `Deploy ${opts.version}?`,
    fields: { Version: opts.version },
    timeout: "24h",
    approvers: ["U_ALICE", "U_BOB"],
  });
  if (approved) {
    await deploy(opts.version);
  }
}
```

Starting it from a handler is one line. `Thread` instances serialize
across the workflow boundary automatically via the existing
`@workflow/serde` hooks on `ThreadImpl` (requires
`chat.registerSingleton()`):

```typescript
import { start } from "workflow/api";
bot.onNewMention(async (thread, message) => {
  await start(deployApproval, [{ thread, version: parseVersion(message.text) }]);
});
```

**Details**

- `workflow` is a new **optional** peer dependency (same pattern as
`ai`); the subpath is the only code that imports it
- Unauthorized clicks (when `approvers` is set) and unrecognizable
payloads post a notice / are ignored, and the workflow keeps waiting
- On timeout the card is finalized as timed out and the result has
`timedOut: true`
- Card builders (`buildApprovalCard`, `buildResolvedCard`) are exported
for custom flows
- Verified the published `dist` preserves the `"use step"` directives
and down-levels `using` correctly, so the app-side Workflow SDK compiler
handles the library code
- Docs page under Interactivity; changeset (`chat` minor); 8 unit tests
mocking the `workflow` primitives

**Deliberate deviation from #284:** no `thread.requestApproval()`
method. The function must suspend at workflow level, so hanging it off
`ThreadImpl` would make `workflow` a hard dependency of core (or require
prototype patching). The standalone `requestApproval(thread, options)`
keeps the dependency optional.

---------

Signed-off-by: Ben Sabic <bensabic@users.noreply.github.com>
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
2026-07-22 10:18:38 +10:00
Max 26c052258c feat(discord): add channel response allowlist (#715)
## Summary

Adds an opt-in `respondToChannelIds` Discord adapter option. Non-bot
messages in configured parent channels and their child threads are
routed through mention handlers without requiring an @mention; top-level
messages keep the adapter's existing automatic thread creation, and
forwarded Gateway packets preserve the parent channel for thread
replies.

I understand this might be something you want to keep out but I find it
very useful for my own "Hermes-like" agent :)

## Test plan

- `pnpm --filter @chat-adapter/discord test`
- `pnpm --filter @chat-adapter/discord typecheck`
- `pnpm check`
- `pnpm konsistent`
- `pnpm typecheck`
- `pnpm validate`

## Checklist

- [x] All commits are signed and verified
- [x] All commits are signed off for the DCO (`git commit -s`)
- [x] `pnpm validate` passes
- [x] Changeset added (or N/A — see
[CONTRIBUTING.md](./CONTRIBUTING.md))
- [x] Documentation updated (or N/A)

---------

Signed-off-by: onmax <maximogarciamtnez@gmail.com>
Signed-off-by: Ben Sabic <bensabic@users.noreply.github.com>
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
2026-07-18 22:29:56 +10:00
Ben Sabic 80def3ab17 feat: add author.isSystem to distinguish platform-generated messages (#707)
Closes #653

Chat SDK's normalized author only distinguished the current bot from
other bots (`isBot`/`isMe`), so Slack system notifications authored by
the reserved `USLACK` user — which carry no `bot_id` and no system
subtype — were dispatched to handlers as if human-authored. Consumers
had to hard-code `message.author.userId === "USLACK"`, leaking
Slack-specific identifiers into adapter-independent code.

This adds an optional `isSystem?: boolean` to the normalized `Author`
type, documented so that an absent value means `false`. Keeping it
optional avoids breaking existing custom adapters and serialized
messages, as proposed in the issue. The Slack adapter now sets it in
both parse paths (`parseSlackMessage` and the sync `parseMessage` path)
via a `SLACK_SYSTEM_USER_ID` constant, so applications can write:

```ts
bot.onNewMention(async (thread, message) => {
  if (message.author.isSystem) {
    return;
  }
  await generateAssistantResponse(thread, message);
});
```

Other adapters can adopt the same field when their platforms expose
equivalent system-generated messages.

Also included:

- Regression tests covering the issue's exact case (`USLACK` DM, no
`bot_id`, no subtype) across all three layers: async parse, sync
`parseMessage`, and end-to-end `handleWebhook` dispatch — plus the
negative case for human authors.
- A `USLACK` webhook fixture in `sample-messages.md`.
- `isSystem` documented in the Author type table on the Message API docs
page.
- Changesets for `chat` and `@chat-adapter/slack`.

---------

Co-authored-by: mdnanocom <arnaud@massive-dynamic.ai>
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
Co-authored-by: dancer <josh@afterima.ge>
2026-07-16 00:46:05 +10:00
Max 46681f50cb fix(teams): hydrate incoming author email (#711)
## Summary

Adds optional email to normalized message authors and preserves it
through message serialization.

For incoming Teams messages, resolves the sender with the activity's
Entra object ID before dispatch, falling back to the cached ID when the
activity omits it. The lookup reuses the existing `mail ??
userPrincipalName` mapping from #708, and missing permissions or Graph
failures leave email undefined without blocking message delivery.

This deliberately revisits the author-profile boundary discussed in
#239: the core field is optional, and Teams populates it only when
Microsoft Graph can resolve the sender.

## Test plan

- [x] `pnpm --filter chat exec vitest run src/message.test.ts`
- [x] `pnpm --filter @chat-adapter/teams exec vitest run
src/index.test.ts`
- [x] Chat and Teams package typechecks and builds
- [x] `TURBO_CONCURRENCY=2 pnpm validate`

## Checklist

- [x] All commits are signed and verified
- [x] All commits are signed off for the DCO (`git commit -s`)
- [x] `pnpm validate` passes
- [x] Changeset added (or N/A — see
[CONTRIBUTING.md](./CONTRIBUTING.md))
- [x] Documentation updated (or N/A)

---------

Signed-off-by: onmax <maximogarciamtnez@gmail.com>
Signed-off-by: Ben Sabic <bensabic@users.noreply.github.com>
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
2026-07-15 14:37:56 +10:00
Max 93a58af563 fix(teams): preserve native streaming with placeholders (#709)
## Summary

Preserves Teams native DM streaming when
`fallbackStreamingPlaceholderText` is explicitly configured. Direct
messages show the text through the Teams SDK native informative status
before streaming the answer, group chats use the core post-and-edit
fallback, `null` disables progress, and omitted configuration keeps the
existing native-DM/buffered-group behavior.

## Test plan

- [x] `pnpm --filter @chat-adapter/teams exec vitest run
src/index.test.ts`
- [x] `pnpm --filter chat exec vitest run src/chat.test.ts
src/thread.test.ts`
- [x] Teams and Chat package typechecks and builds
- [x] `TURBO_CONCURRENCY=2 pnpm validate`

## Checklist

- [x] All commits are signed and verified
- [x] All commits are signed off for the DCO (`git commit -s`)
- [x] `pnpm validate` passes
- [x] Changeset added (or N/A — see
[CONTRIBUTING.md](./CONTRIBUTING.md))
- [x] Documentation updated (or N/A)

Signed-off-by: onmax <maximogarciamtnez@gmail.com>
2026-07-15 01:15:15 +10:00
github-actions[bot] f84b5911e7 chore(release): version packages (#695)
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.34.0

### Minor Changes

- 0fdb902: Add opt-in Discord Components v2 rendering for Chat SDK cards
via `contentFormat: DiscordContentFormat.ComponentsV2`.
- 5341f90: Ignore `@everyone`/`@here` pings by default in gateway mode.
Previously the legacy gateway listener treated global pings as bot
mentions, so the bot responded to announcements. A new
`respondToGlobalMentions` config option (default `false`) restores the
old behavior when enabled, and also lets forwarded gateway messages opt
in via the `mention_everyone` field.
- 6c2a391: Add support for renaming native Discord thread channels.

### Patch Changes

- Updated dependencies [5c926f1]
- Updated dependencies [2531a42]
- Updated dependencies [1721fa0]
- Updated dependencies [4717a38]
- Updated dependencies [6714efc]
  - chat@4.34.0
  - @chat-adapter/shared@4.34.0
## @chat-adapter/slack@4.34.0

### Minor Changes

- 1721fa0: Add support for Slack's Agent messaging experience
(`agent_view`).

- New core event `onAppContextChanged` with a normalized
`AppContextEntity[]` describing the user's active view (channel / canvas
/ list / message / unknown).
- `AppHomeOpenedEvent` now carries the folded active-view context as
`entities` and the opened `tab` (Slack: `"home"` / `"messages"`), so
handlers can tell a Home-tab open from the DM-open signal under
`agent_view`.
- Slack adapter: new `agentView` config flag (under `agent_view`,
`app_home_opened` is the DM-open signal regardless of tab and folded
context is surfaced), routing for the `app_context_changed` event, and a
`getAppContext(message)` helper to read the folded context on DM
messages.
- `setSuggestedPrompts` now accepts an optional thread reference
(agent_view lets prompts sit at the top of the agent conversation).
- Under `agentView`, DM (Messages-tab) messages are threaded per new
Slack's model — each user message is a thread root (`thread_ts ?? ts`).
Conversation-scoped threads returned by `openDM()` keep working: when
that thread is subscribed, incoming top-level DM messages route to it.
- `createSlackAdapter` env auth fallback (`SLACK_BOT_TOKEN` /
`SLACK_CLIENT_ID` / `SLACK_CLIENT_SECRET`) is now disabled only when an
auth or verification field (`botToken`, `clientId`, `clientSecret`,
`installationProvider`, `signingSecret`, `webhookVerifier`) is passed
explicitly, instead of by any config object — so `createSlackAdapter({
agentView: true })` still picks up env credentials, while
explicit-secret configs stay immune to ambient env vars.
- Bumped `@slack/web-api` to `^7.18.0` (adds the optional `thread_ts`
typing for `setSuggestedPrompts`).

- 4717a38: Add chart support and richer table rendering, with native
Slack data table and data visualization blocks.

- New core `ChartElement` and `Chart()` builder (JSX supported) with
pie, bar, area, and line charts, mirroring Slack's data visualization
model: pie charts take `segments`, series charts take named `series`
plotted against shared `categories` with optional `xLabel`/`yLabel`.
- `TableElement` / `Table()` gain optional `caption` (accessible table
description) and `pageSize` (rows per page) fields.
- Charts degrade gracefully on platforms without native chart support:
the underlying data renders as a text table via the shared card fallback
(new `chartElementToFallbackText` helper).
- Slack adapter: card tables now render as [data table
blocks](https://docs.slack.dev/reference/block-kit/blocks/data-table-block)
by default — paginated and sortable — instead of plain table blocks.
Header-only tables keep the plain table block; tables exceeding Slack
limits (100 data rows, 20 columns, 10,000 characters) fall back to ASCII
as before.
- Slack adapter: card charts render as [data visualization
blocks](https://docs.slack.dev/reference/block-kit/blocks/data-visualization-block).
Charts violating Slack constraints (50-character title, 12
segments/series, 20 categories, 20-character labels, one data point per
category, max 2 charts per message) fall back to a text rendering
instead of being rejected by the API.
- The `@chat-adapter/slack/blocks` subpath gets the same treatment:
`SlackChartElement` types, `chart` card children, data table rendering,
and matching limits.
- `postMessage` now surfaces Slack's per-block validation details when
the API rejects blocks (`invalid_blocks`), instead of the bare "An API
error occurred" message.

- 0f743c9: Add declarative agent-experience config and harden native
streaming:

- `suggestedPrompts` — a static payload or per-thread resolver, applied
automatically when an assistant/agent thread opens
(`assistant_thread_started` in legacy `assistant_view`, or a
Messages-tab `app_home_opened` under `agentView`, where prompts pin at
the top of the agent conversation without a `thread_ts`). The resolver
receives the thread context (`channelId`, `userId`, legacy
`threadTs`/`teamId`/`enterpriseId`, and active-view `entities` under
`agentView`); returning `null`/`undefined` skips the thread. Prompts
beyond Slack's 4-prompt limit are dropped with a warning, and
resolver/API failures are logged without failing the webhook.
- `loadingMessages` — default rotating status strings for the assistant
thinking indicator, used by `startTyping` and `setAssistantStatus` when
no explicit status/messages are passed.
- `nativeStreaming` config (default `true`). Set `false` on Slack
flavours without the `chat.startStream` family (e.g. GovSlack) to always
stream via post-and-edit.
- If the workspace rejects the first native streaming call, `stream()`
now falls back to throttled post-and-edit mid-stream instead of failing
the reply; already-consumed text is preserved. Permanent platform errors
(`unknown_method`, `method_deprecated`, `feature_not_enabled`) latch
native streaming off for subsequent streams on the adapter instance.
Structured chunks (`task_update` / `plan_update`) are skipped in
fallback mode.

- `feedbackButtons` — append Slack's native thumbs up/down
(`context_actions` + `feedback_buttons` block) to every streamed reply.
Pass `true` for defaults or an options object (`actionId`, labels,
values); clicks dispatch through `bot.onAction` with a positive/negative
value. A `buildFeedbackButtonsBlock(options?)` helper is exported for
attaching the block to non-streamed messages.

New exported types: `SlackFeedbackButtonsOptions`,
`SlackSuggestedPrompt`, `SlackSuggestedPrompts`,
`SlackSuggestedPromptsContext`, `SlackSuggestedPromptsOptions`.

### Patch Changes

- Updated dependencies [5c926f1]
- Updated dependencies [2531a42]
- Updated dependencies [1721fa0]
- Updated dependencies [4717a38]
- Updated dependencies [6714efc]
  - chat@4.34.0
  - @chat-adapter/shared@4.34.0
## @chat-adapter/telegram@4.34.0

### Minor Changes

- 8d7ccdb: Add Telegram media group uploads for multiple files and
attachments.

### Patch Changes

- 2531a42: Fix `detectMention` (and the Telegram adapter's
`isBotMentioned`) falsely matching `@bot` when `@bot-dev` is mentioned.
`\b` (word boundary) matches between a word character and a hyphen, so
`/@bot\b/` incorrectly matches `@bot-dev`. Replaced with `(?![\w-])` to
exclude hyphens.
- Updated dependencies [5c926f1]
- Updated dependencies [2531a42]
- Updated dependencies [1721fa0]
- Updated dependencies [4717a38]
- Updated dependencies [6714efc]
  - chat@4.34.0
  - @chat-adapter/shared@4.34.0
## @chat-adapter/web@4.34.0

### Minor Changes

- 6714efc: Support AI SDK v7 as a peer dependency.

- `chat` now accepts `ai@^6.0.182 || ^7.0.0` (`chat/ai` tools work with
both majors).
- `@chat-adapter/web` now accepts `ai@^6 || ^7`, `@ai-sdk/react@^3 ||
^4`, `@ai-sdk/svelte@^4 || ^5`, and `@ai-sdk/vue@^3 || ^4`.
- The `chat/ai` tool factories now declare explicit `Tool<Input,
Output>` return types instead of relying on inference, so the published
declarations no longer depend on `ai` internals that changed in v7. The
public type surface is unchanged.

### Patch Changes

- Updated dependencies [5c926f1]
- Updated dependencies [2531a42]
- Updated dependencies [1721fa0]
- Updated dependencies [4717a38]
- Updated dependencies [6714efc]
  - chat@4.34.0
  - @chat-adapter/shared@4.34.0
## @chat-adapter/whatsapp@4.34.0

### Minor Changes

- 2338a66: Add `sendTemplate()` for sending pre-approved template
messages, enabling business-initiated conversations outside the 24-hour
customer service window
- 8bd8a57: Implement outbound file and attachment sending for the
WhatsApp adapter.

Supports binary `FileUpload` uploads, typed `Attachment` payloads
(binary or HTTPS link passthrough), multi-file sequential sends, smart
MIME-to-message-type mapping, caption placement with audio/long-text
fallbacks, and card+file sequencing.

### Patch Changes

- Updated dependencies [5c926f1]
- Updated dependencies [2531a42]
- Updated dependencies [1721fa0]
- Updated dependencies [4717a38]
- Updated dependencies [6714efc]
  - chat@4.34.0
  - @chat-adapter/shared@4.34.0
## @chat-adapter/x@4.34.0

### Minor Changes

- 4bca64f: add image upload support to X posts and DMs via the chunked
media upload endpoints

### Patch Changes

- Updated dependencies [5c926f1]
- Updated dependencies [2531a42]
- Updated dependencies [1721fa0]
- Updated dependencies [4717a38]
- Updated dependencies [6714efc]
  - chat@4.34.0
  - @chat-adapter/shared@4.34.0
## chat@4.34.0

### Minor Changes

- 1721fa0: Add support for Slack's Agent messaging experience
(`agent_view`).

- New core event `onAppContextChanged` with a normalized
`AppContextEntity[]` describing the user's active view (channel / canvas
/ list / message / unknown).
- `AppHomeOpenedEvent` now carries the folded active-view context as
`entities` and the opened `tab` (Slack: `"home"` / `"messages"`), so
handlers can tell a Home-tab open from the DM-open signal under
`agent_view`.
- Slack adapter: new `agentView` config flag (under `agent_view`,
`app_home_opened` is the DM-open signal regardless of tab and folded
context is surfaced), routing for the `app_context_changed` event, and a
`getAppContext(message)` helper to read the folded context on DM
messages.
- `setSuggestedPrompts` now accepts an optional thread reference
(agent_view lets prompts sit at the top of the agent conversation).
- Under `agentView`, DM (Messages-tab) messages are threaded per new
Slack's model — each user message is a thread root (`thread_ts ?? ts`).
Conversation-scoped threads returned by `openDM()` keep working: when
that thread is subscribed, incoming top-level DM messages route to it.
- `createSlackAdapter` env auth fallback (`SLACK_BOT_TOKEN` /
`SLACK_CLIENT_ID` / `SLACK_CLIENT_SECRET`) is now disabled only when an
auth or verification field (`botToken`, `clientId`, `clientSecret`,
`installationProvider`, `signingSecret`, `webhookVerifier`) is passed
explicitly, instead of by any config object — so `createSlackAdapter({
agentView: true })` still picks up env credentials, while
explicit-secret configs stay immune to ambient env vars.
- Bumped `@slack/web-api` to `^7.18.0` (adds the optional `thread_ts`
typing for `setSuggestedPrompts`).

- 4717a38: Add chart support and richer table rendering, with native
Slack data table and data visualization blocks.

- New core `ChartElement` and `Chart()` builder (JSX supported) with
pie, bar, area, and line charts, mirroring Slack's data visualization
model: pie charts take `segments`, series charts take named `series`
plotted against shared `categories` with optional `xLabel`/`yLabel`.
- `TableElement` / `Table()` gain optional `caption` (accessible table
description) and `pageSize` (rows per page) fields.
- Charts degrade gracefully on platforms without native chart support:
the underlying data renders as a text table via the shared card fallback
(new `chartElementToFallbackText` helper).
- Slack adapter: card tables now render as [data table
blocks](https://docs.slack.dev/reference/block-kit/blocks/data-table-block)
by default — paginated and sortable — instead of plain table blocks.
Header-only tables keep the plain table block; tables exceeding Slack
limits (100 data rows, 20 columns, 10,000 characters) fall back to ASCII
as before.
- Slack adapter: card charts render as [data visualization
blocks](https://docs.slack.dev/reference/block-kit/blocks/data-visualization-block).
Charts violating Slack constraints (50-character title, 12
segments/series, 20 categories, 20-character labels, one data point per
category, max 2 charts per message) fall back to a text rendering
instead of being rejected by the API.
- The `@chat-adapter/slack/blocks` subpath gets the same treatment:
`SlackChartElement` types, `chart` card children, data table rendering,
and matching limits.
- `postMessage` now surfaces Slack's per-block validation details when
the API rejects blocks (`invalid_blocks`), instead of the bare "An API
error occurred" message.

- 6714efc: Support AI SDK v7 as a peer dependency.

- `chat` now accepts `ai@^6.0.182 || ^7.0.0` (`chat/ai` tools work with
both majors).
- `@chat-adapter/web` now accepts `ai@^6 || ^7`, `@ai-sdk/react@^3 ||
^4`, `@ai-sdk/svelte@^4 || ^5`, and `@ai-sdk/vue@^3 || ^4`.
- The `chat/ai` tool factories now declare explicit `Tool<Input,
Output>` return types instead of relying on inference, so the published
declarations no longer depend on `ai` internals that changed in v7. The
public type surface is unchanged.

### Patch Changes

- 5c926f1: Preserve markdown structural whitespace when extracting
normalized message text.
- 2531a42: Fix `detectMention` (and the Telegram adapter's
`isBotMentioned`) falsely matching `@bot` when `@bot-dev` is mentioned.
`\b` (word boundary) matches between a word character and a hyphen, so
`/@bot\b/` incorrectly matches `@bot-dev`. Replaced with `(?![\w-])` to
exclude hyphens.
## @chat-adapter/gchat@4.34.0

### Patch Changes

- Updated dependencies [5c926f1]
- Updated dependencies [2531a42]
- Updated dependencies [1721fa0]
- Updated dependencies [4717a38]
- Updated dependencies [6714efc]
  - chat@4.34.0
  - @chat-adapter/shared@4.34.0
## @chat-adapter/github@4.34.0

### Patch Changes

- Updated dependencies [5c926f1]
- Updated dependencies [2531a42]
- Updated dependencies [1721fa0]
- Updated dependencies [4717a38]
- Updated dependencies [6714efc]
  - chat@4.34.0
  - @chat-adapter/shared@4.34.0
## @chat-adapter/linear@4.34.0

### Patch Changes

- Updated dependencies [5c926f1]
- Updated dependencies [2531a42]
- Updated dependencies [1721fa0]
- Updated dependencies [4717a38]
- Updated dependencies [6714efc]
  - chat@4.34.0
  - @chat-adapter/shared@4.34.0
## @chat-adapter/messenger@4.34.0

### Patch Changes

- Updated dependencies [5c926f1]
- Updated dependencies [2531a42]
- Updated dependencies [1721fa0]
- Updated dependencies [4717a38]
- Updated dependencies [6714efc]
  - chat@4.34.0
  - @chat-adapter/shared@4.34.0
## @chat-adapter/shared@4.34.0

### Patch Changes

- Updated dependencies [5c926f1]
- Updated dependencies [2531a42]
- Updated dependencies [1721fa0]
- Updated dependencies [4717a38]
- Updated dependencies [6714efc]
  - chat@4.34.0
## @chat-adapter/teams@4.34.0

### Patch Changes

- Updated dependencies [5c926f1]
- Updated dependencies [2531a42]
- Updated dependencies [1721fa0]
- Updated dependencies [4717a38]
- Updated dependencies [6714efc]
  - chat@4.34.0
  - @chat-adapter/shared@4.34.0
## @chat-adapter/twilio@4.34.0

### Patch Changes

- Updated dependencies [5c926f1]
- Updated dependencies [2531a42]
- Updated dependencies [1721fa0]
- Updated dependencies [4717a38]
- Updated dependencies [6714efc]
  - chat@4.34.0
  - @chat-adapter/shared@4.34.0
## @chat-adapter/state-ioredis@4.34.0

### Patch Changes

- Updated dependencies [5c926f1]
- Updated dependencies [2531a42]
- Updated dependencies [1721fa0]
- Updated dependencies [4717a38]
- Updated dependencies [6714efc]
  - chat@4.34.0
## @chat-adapter/state-memory@4.34.0

### Patch Changes

- Updated dependencies [5c926f1]
- Updated dependencies [2531a42]
- Updated dependencies [1721fa0]
- Updated dependencies [4717a38]
- Updated dependencies [6714efc]
  - chat@4.34.0
## @chat-adapter/state-pg@4.34.0

### Patch Changes

- Updated dependencies [5c926f1]
- Updated dependencies [2531a42]
- Updated dependencies [1721fa0]
- Updated dependencies [4717a38]
- Updated dependencies [6714efc]
  - chat@4.34.0
## @chat-adapter/state-redis@4.34.0

### Patch Changes

- Updated dependencies [5c926f1]
- Updated dependencies [2531a42]
- Updated dependencies [1721fa0]
- Updated dependencies [4717a38]
- Updated dependencies [6714efc]
  - chat@4.34.0
## @chat-adapter/tests@4.34.0

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-13 16:41:59 +01:00
Remon Oldenbeuving 5c926f1987 fix(chat): preserve markdown whitespace in plain text (#604)
## Problem
When I mention a Chat SDK-powered bot on GitHub like this:

```
@bot
hi there!
```

The mention doesn't trigger any handling, because the `mdastToString`
helper replaces all newlines with an empty string, so the logs look like
this:

```
[chat-sdk] Checking message patterns { patternCount: 0, patterns: [], messageText: '@bothi there' }
[chat-sdk] No handlers matched message {
  threadId: 'github:RSO/chat:issue:29',
  text: '@bothi there'
}
```

## Summary
- Preserve structural markdown whitespace when extracting normalized
plain text from mdast.
- Add regression coverage for newline-separated bot mentions in core
markdown extraction, GitHub issue/review comments, and Chat mention
routing.
- Add a patch changeset for the behavior fix.

## Testing
- `pnpm check`
- `pnpm knip`
- `pnpm test:workspace`
- `pnpm --filter chat test`
- `pnpm --filter @chat-adapter/github test`
- `pnpm --filter chat typecheck`
- `pnpm --filter @chat-adapter/github typecheck`

## Notes
- `pnpm validate` was attempted and reached the full Turbo test graph,
but failed on `packages/integration-tests/src/replay-discord.test.ts`
(`should skip bot's own messages in subscribed threads`). Rerunning
`pnpm --filter @chat-adapter/integration-tests test --
src/replay-discord.test.ts` passed, so this appears unrelated to the
markdown whitespace change.
- `.github/CONTRIBUTING.md` requires signed commits. This environment
has no `gpg` binary and no SSH signing identities loaded, so the commit
in this PR is currently unsigned and may need to be re-signed before
merge.

---------

Signed-off-by: dancer <josh@afterima.ge>
Co-authored-by: dancer <josh@afterima.ge>
2026-07-13 13:40:17 +01:00
C. T. Lin 6714efc3a1 feat: support AI SDK v7 (ai@7) as a peer dependency (#691)
Closes #690

## What

Widens the AI SDK peer dependency ranges so the Chat SDK installs
cleanly next to `ai@7`:

- `chat`: `ai@^6.0.182 || ^7.0.0`
- `@chat-adapter/web`: `ai@^6 || ^7`, `@ai-sdk/react@^3 || ^4`,
`@ai-sdk/svelte@^4 || ^5`, `@ai-sdk/vue@^3 || ^4`

This also unbreaks `create-chat-sdk` scaffolds, which install
`ai@latest` (now v7) next to `chat` and currently hit a peer conflict
out of the box.

## The one real v6 → v7 break

In v7, `tool()` with an `execute` function returns
`ExecutableTool<Tool<...>>` — an internal type from
`@ai-sdk/provider-utils` that `ai` does not re-export. The `chat/ai`
tool factories relied on inference, so declaration emit failed with
TS2742 (17 errors). The factories now declare explicit `Tool<Input,
Output>` return types, which is exactly the shape the previously
published `.d.ts` already had — the public type surface is unchanged,
and the emitted declarations only reference types from `ai` (portable
for consumers on either major).

Everything else checked out compatible:

- v7 stream parts keep `text-delta` / `finish-step` shapes, so
`fromFullStream` duck-typing works unchanged; `fullStream` remains as a
deprecated alias
- tool-level `needsApproval` is deprecated in v7 but still typed and
honored
- `createUIMessageStream`, `createUIMessageStreamResponse`,
`isTextUIPart`, `UIMessage`, `UIMessageStreamWriter`, `ChatInit`,
`DefaultChatTransport` all still exported — `@chat-adapter/web` needed
zero source changes

## Other changes

- devDependencies move to v7 so the workspace develops/tests against the
latest major
- `examples/nextjs-chat` and `examples/nuxt-chat` move to `ai@^7`
(required — mixing majors across the workspace fails typecheck, since
`chat`'s d.ts resolves `ai` types from its own devDependency)
- Test-only: the `ToolExecutionOptions` stub type is now derived from
`Tool["execute"]` because v7 made the generic parameter required
- Changeset included (minor for `chat` and `@chat-adapter/web`)

## Verification

The same source was verified against **both majors** (`ai@6.0.182` and
`ai@7.0.17`): `tsc --noEmit` and the full test suites (`chat`: 1035
tests, `@chat-adapter/web`: 21 tests) pass on each. `pnpm validate`
(knip + check + typecheck + test + build, including both examples) is
green on v7.

Note for adopters: `ai@7` itself requires Node.js ≥ 22 and is ESM-only;
`chat` keeps `engines.node >= 20` since `ai` is an optional peer.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: chentsulin <chentsulin@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: dancer <josh@afterima.ge>
2026-07-13 21:50:27 +10:00
Takuma Shibuya 2531a4227e fix username regexp (#621)
## Summary

<!-- What does this PR do? -->

Fix `detectMention` falsely matching `@bot` when `@bot-dev` is
mentioned. `\b` (word boundary) matches between a word character and a
hyphen, so `/@bot\b/` incorrectly matches `@bot-dev`. Replaced with
`(?![\w-])` to exclude hyphens.

## Test plan

<!-- How did you verify the changes? -->

## Checklist

- [x] All commits are signed and verified
- [x] `pnpm validate` passes
- [x] Changeset added (or N/A — see
[CONTRIBUTING.md](./CONTRIBUTING.md))
- [x] Documentation updated (or N/A)

---------

Signed-off-by: sivchari <shibuuuu5@gmail.com>
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
2026-07-13 20:39:20 +10:00
Ben Sabic 4717a38407 feat(slack): support data table and data visualization blocks (#696)
Adds support for Slack's [data
table](https://docs.slack.dev/reference/block-kit/blocks/data-table-block)
and [data
visualization](https://docs.slack.dev/reference/block-kit/blocks/data-visualization-block)
Block Kit blocks.

- **`chat`**: new cross-platform `ChartElement` + `Chart()` builder (JSX
supported) mirroring Slack's model — pie `segments`, or bar/area/line
`series` against shared `categories`. `Table()` gains optional `caption`
and `pageSize`. Charts degrade to a text table on other platforms via
the shared card fallback (`chartElementToFallbackText`).
- **`@chat-adapter/slack`**: card tables now render as paginated,
sortable `data_table` blocks by default (header-only tables keep the
plain `table` block; oversized tables still fall back to ASCII). Charts
render as `data_visualization` blocks; charts violating Slack
constraints — including the undocumented **max 2 charts per message** —
fall back to a text rendering instead of an API rejection. Same
treatment in the `@chat-adapter/slack/blocks` subpath.
- **`postMessage`** now surfaces Slack's per-block validation messages
on `invalid_blocks` errors (this is how the 2-chart limit was found).
- Example app gets a **Show Charts** button and table pagination on
**Show Table**; docs, feature matrices, and changeset updated.

Verified live against Slack: data table pagination/sorting and both
chart types render natively.

<table>
  <tr>
    <th>Data Table</th>
    <th>Data Charts</th>
  </tr>
  <tr>
<td><img width="979" height="896" alt="CleanShot 2026-07-12 at 23 28 32"
src="https://github.com/user-attachments/assets/3307bd90-9322-452f-86fb-07d46446822d"
/></td>
<td><img width="955" height="879" alt="CleanShot 2026-07-12 at 23 29 02"
src="https://github.com/user-attachments/assets/ddb31a1b-e3fd-457c-a2e6-bde4934afebe"
/></td>
  </tr>
</table>

---------

Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
2026-07-13 07:57:40 +01:00
damianborowy-nexos 1721fa01e7 feat(slack): add Slack Agent messaging experience (agent_view) support (#684)
## Summary

Add support for Slack's Agent messaging experience (`agent_view`), the
2026 replacement for `assistant_view`.

## Core (`chat`)

- New `onAppContextChanged` event carrying the active-view context as a
normalized `AppContextEntity[]` (`channel` / `canvas` / `list` /
`message` / `unknown`) describing what the user is currently viewing.
- `AppHomeOpenedEvent` now carries:
  - the same folded active-view context as optional `entities`
- the opened `tab` (`"home"` / `"messages"`), so handlers can
distinguish a Home-tab open from the DM-open signal under `agent_view`

## Slack adapter (`@chat-adapter/slack`)

- **`agentView` config flag.** Under `agent_view`:
- `app_home_opened` is the DM-open signal and fires regardless of tab
(branch on `event.tab` if you also publish a Home view)
- DM messages are threaded per Slack's new model — each user message is
a thread root (`thread_ts ?? ts`)
- conversation-scoped threads returned by `openDM()` keep working: when
that thread is subscribed, incoming top-level DM messages route to it,
so `onSubscribedMessage` and per-thread state behave the same as in
legacy mode
- **`app_context_changed` routing** with normalized entities. Malformed
payloads degrade gracefully: a missing `context` yields `entities: []`,
and entities with a null/malformed `value` normalize to `kind:
"unknown"` — never a webhook 500.
- **`getAppContext(message)`** helper to read the folded active-view
context off a DM message.
- **`setSuggestedPrompts`** accepts an optional thread reference
(`agent_view` lets prompts sit at the top of the agent conversation).
- **Env auth fallback now keys off auth fields**: `SLACK_BOT_TOKEN` /
`SLACK_CLIENT_ID` / `SLACK_CLIENT_SECRET` fallback is disabled only when
an auth-related field (`botToken`, `clientId`, `clientSecret`,
`installationProvider`) is passed explicitly, rather than by the
presence of any config object. This lets non-auth options compose with
env auth — e.g. `createSlackAdapter({ agentView: true })` picks up env
credentials — and matches the semantics documented in the adapter's
AGENTS.md. *(Behavior change for callers passing non-auth-only configs
while relying on env vars being ignored.)*
- Bumped `@slack/web-api` to `^7.18.0` (adds the optional `thread_ts`
typing for `setSuggestedPrompts`).

## Docs

- New "Agent messaging experience" section on the Slack adapter page
(config, manifest snippet, threading model, openDM bridge).
- "Handling active-view context" section in handling-events, plus
`tab`/`entities` rows on the app-home event table.
- Callout: under `agent_view`, bot replies are threaded per user
message, so `conversations.history` only returns the user's side of a DM
— build AI conversation history from transcripts instead of channel
history.

## Example app (`examples/nextjs-chat`)

- Plain `SLACK_BOT_TOKEN` adapter branch (previously Slack was only
wired via Vercel Connect).
- DM AI history built from transcripts instead of channel history (see
docs callout above); assistant turns persisted.
- The `dm me` trigger regex now matches mention text, which carries the
`@bot` prefix on Slack.

## Test plan

- `pnpm validate` and `pnpm konsistent` pass.
- Unit tests cover the new events, entity normalization (including
malformed payloads), `agent_view` DM threading, the openDM subscription
bridge, `tab` passthrough, `setSuggestedPrompts` thread handling, and
env-fallback behavior; an integration replay test exercises the full
webhook flow.
- Verified manually against a live `agent_view` workspace:
`onAppContextChanged` entities, folded context on `app_home_opened` and
DM messages, `tab` values for both tabs, per-message DM threading, the
openDM subscription bridge, and signed malformed-payload replays (all
return 200).
- Legacy regression pass with `agentView` off: conversation-scoped DM
threading, Home-tab-only `app_home_opened`, mention flow unchanged.

### Slack references

- Agent messaging experience:
https://docs.slack.dev/changelog/2026/06/30/agent-messages-tab/
- Active-view context:
https://docs.slack.dev/changelog/2026/07/02/app-context/

## Checklist

- [x] All commits are signed and verified
- [x] All commits are signed off for the DCO (`git commit -s`)
- [x] `pnpm validate` passes
- [x] Changeset added
- [x] Documentation updated

---------

Signed-off-by: Damian Borowy <301205838+damianborowy-nexos@users.noreply.github.com>
Signed-off-by: Ben Sabic <bensabic@users.noreply.github.com>
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
2026-07-12 19:35:28 +10:00
josh b3123815fa docs: use xai/grok-4.5 across docs, guides, and examples (#687)
## summary

- swap chat model strings to `xai/grok-4.5` across the docs site, the
shipped guides, and the example bots, so the docs lead with the latest
model
- apps/docs: ai overview, ai-sdk-tools, and streaming pages, the two
landing-page code samples, and the live chat demo route
(`app/api/chat/route.ts`, previously `openai/gpt-4.1-mini`)
- packages/chat/resources/guides: the seven guides that use a chat model
(slack connect, slack + ai sdk, liveblocks, vercel blob, github code
review, daily digest, ai gateway)
- examples: nextjs-chat and nuxt-chat bots
- deliberately left non-chat model strings as they were, since grok-4.5
cannot fill those roles: the `openai/text-embedding-3-small` embedding
model and the `openai/gpt-4o-mini` reranker
- in the ai gateway guide, grok-4.5 is now the primary model but the
fallback list stays cross-provider (`anthropic/claude-opus-4.8`,
`google/gemini-3.1-pro-preview`) so the failover example still
demonstrates real cross-provider fallback
- also fixed a pre-existing prose/code mismatch in that guide, the
fallback prose said `claude-opus-4.7` while the code listed `4.8`, now
aligned to `4.8`

---------

Signed-off-by: dancer <josh@afterima.ge>
2026-07-09 13:35:36 +10:00
github-actions[bot] b1940d2374 chore(release): version packages (#660)
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/github@4.33.0

### Minor Changes

- 6750d59: Add Vercel Connect support to the GitHub adapter. A new
`installationToken` config option (string or resolver) supplies
installation access tokens directly, skipping the GitHub App private-key
JWT exchange, and an optional `webhookVerifier` verifies inbound
webhooks (e.g. Connect trigger-forwarded requests via a Vercel OIDC
token) in place of the GitHub webhook secret. Pair with
`connectGitHubAdapter()` from `@vercel/connect/chat`.

`botUserId` now also auto-detects from the `GITHUB_BOT_USER_ID` env var,
and the adapter learns its bot user id from the first comment it posts.
In Connect mode (where the bot user id can't be auto-detected from an
installation token) set `botUserId` / `GITHUB_BOT_USER_ID` to enable
self-message detection and avoid the adapter replying to its own
comments.

Note: the `connectGitHubAdapter()` helper ships in `@vercel/connect` —
release this adapter together with (or after) the `@vercel/connect`
version that adds the `@vercel/connect/chat` subpath so the documented
helper resolves.

### Patch Changes

- Updated dependencies [3abdc69]
- Updated dependencies [0b63791]
- Updated dependencies [0c761f1]
- Updated dependencies [ef2542c]
- Updated dependencies [24a04d5]
- Updated dependencies [d4c52ca]
- Updated dependencies [076fe5d]
  - chat@4.33.0
  - @chat-adapter/shared@4.33.0
## @chat-adapter/linear@4.33.0

### Minor Changes

- 4115c94: Add Vercel Connect support to the Linear adapter. The
`accessToken` config option now accepts a resolver (`() => string |
Promise<string>`) in addition to a string, so tokens can be sourced from
Vercel Connect at runtime, and a new optional `webhookVerifier` verifies
inbound webhooks (e.g. Connect trigger-forwarded requests via a Vercel
OIDC token) in place of the Linear webhook secret. Pair with
`connectLinearAdapter()` from `@vercel/connect/chat`. Connect-mode
outbound calls outside webhook handling are supported via
`withInstallation(organizationId, fn)`.

Note: the `connectLinearAdapter()` helper ships in `@vercel/connect` —
release this adapter together with (or after) the `@vercel/connect`
version that adds the `@vercel/connect/chat` subpath so the documented
helper resolves.

### Patch Changes

- Updated dependencies [3abdc69]
- Updated dependencies [0b63791]
- Updated dependencies [0c761f1]
- Updated dependencies [ef2542c]
- Updated dependencies [24a04d5]
- Updated dependencies [d4c52ca]
- Updated dependencies [076fe5d]
  - chat@4.33.0
  - @chat-adapter/shared@4.33.0
## @chat-adapter/shared@4.33.0

### Minor Changes

- d4c52ca: add `replaceBareMentions`, a context-aware bare-`@mention`
resolver that skips code spans, URLs, schemeless hosts, and existing
angle-bracket tokens before handing each real `@name` to a
platform-specific replacer

### Patch Changes

- Updated dependencies [3abdc69]
- Updated dependencies [0b63791]
- Updated dependencies [0c761f1]
- Updated dependencies [ef2542c]
- Updated dependencies [24a04d5]
- Updated dependencies [076fe5d]
  - chat@4.33.0
## @chat-adapter/x@4.33.0

### Minor Changes

- ef2542c: add X (Twitter) adapter: reply to public mentions, send and
receive direct messages, post and edit from the bot account, and like
posts, using the X API v2 with OAuth 2.0 and managed token refresh

### Patch Changes

- Updated dependencies [3abdc69]
- Updated dependencies [0b63791]
- Updated dependencies [0c761f1]
- Updated dependencies [ef2542c]
- Updated dependencies [24a04d5]
- Updated dependencies [d4c52ca]
- Updated dependencies [076fe5d]
  - chat@4.33.0
  - @chat-adapter/shared@4.33.0
## chat@4.33.0

### Minor Changes

- ef2542c: add X (Twitter) adapter: reply to public mentions, send and
receive direct messages, post and edit from the bot account, and like
posts, using the X API v2 with OAuth 2.0 and managed token refresh

### Patch Changes

- 3abdc69: docs(adapters): add Cloudflare Agents as a vendor-official
state adapter (`agents/chat-sdk`) to the catalog and docs listing. It is
hidden from the create-chat-sdk CLI (Worker/Durable Objects runtime),
and the interactive state picker now filters out CLI-incompatible state
adapters.
- 0b63791: Raise the default message dedupe TTL from 5 to 10 minutes so
it outlives the longest platform redelivery window. Slack's Events API
retries up to ~5 minutes after the original delivery — exactly at the
old TTL boundary, where a retried event could miss the expired dedupe
entry from its first processing and be handled twice. Configurable
behavior is unchanged (`dedupeTtlMs` still overrides).
- 0c761f1: docs(adapters): add Dial as a vendor-official adapter
(`@getdial/chat-sdk-adapter`) to the catalog, docs listing, and CLI
scaffold spec
- 24a04d5: docs(adapters): add Photon as a vendor-official adapter
(`@photon-ai/chat-adapter-imessage`) to the catalog, docs listing, and
CLI scaffold spec
- 076fe5d: preserve skipped mention routing for debounce and message
patterns
## create-chat-sdk@0.2.0

### Minor Changes

- ba375ce: Add Vercel Connect support to the scaffolder. Pass
`--connect` (or choose **Vercel Connect** at the new interactive
auth-mode prompt) to authenticate the Slack, GitHub, and Linear adapters
with a Vercel Connect connector instead of stored provider secrets. The
generated `src/lib/bot.ts` spreads the matching helper from
`@vercel/connect/chat` into the adapter factory, `@vercel/connect` is
added to dependencies, and `.env.example` lists each connector UID (for
example `SLACK_CONNECTOR`) plus the recommended `GITHUB_BOT_USER_ID` for
GitHub, in place of native secrets.
- ef2542c: add X (Twitter) adapter: reply to public mentions, send and
receive direct messages, post and edit from the bot account, and like
posts, using the X API v2 with OAuth 2.0 and managed token refresh

### Patch Changes

- 3abdc69: docs(adapters): add Cloudflare Agents as a vendor-official
state adapter (`agents/chat-sdk`) to the catalog and docs listing. It is
hidden from the create-chat-sdk CLI (Worker/Durable Objects runtime),
and the interactive state picker now filters out CLI-incompatible state
adapters.
- 0c761f1: docs(adapters): add Dial as a vendor-official adapter
(`@getdial/chat-sdk-adapter`) to the catalog, docs listing, and CLI
scaffold spec
- 24a04d5: docs(adapters): add Photon as a vendor-official adapter
(`@photon-ai/chat-adapter-imessage`) to the catalog, docs listing, and
CLI scaffold spec
## @chat-adapter/tests@4.33.0

### Minor Changes

- e7a396a: Add two shared behavioral test contracts for adapter authors:

- `threadIdContract` — verifies an adapter's thread-id codec round-trips
(`decode(encode(x))`), prefixes ids with the adapter name, matches any
pinned encoded strings, and (optionally) distinguishes DM from non-DM
threads.
- `selfMessageContract` — verifies an adapter dispatches inbound
messages from other users (to `processMessage` by default) but ignores
messages the bot authored itself, so it never replies to itself.
Requires the matchers to be registered via `setupFiles:
["@chat-adapter/tests/setup"]`.

- a7fb1bc: Add `connectWebhookContract`, a shared Vitest suite for
verifying an adapter's Vercel Connect webhook verification. Given a
small per-adapter descriptor (how to build the adapter in Connect mode
and craft an inbound webhook), it asserts the behavior every
Connect-capable adapter shares: a `webhookVerifier` replaces the native
signature/secret check and gates inbound requests — accept (`200`) on a
truthy result, reject (`401`) on a thrown error or falsy result — and is
invoked with the request and raw body. Connect-capable adapters can opt
in with ~10 lines.
## @chat-adapter/discord@4.33.0

### Patch Changes

- d4c52ca: use the shared `replaceBareMentions` scanner for `@mention`
conversion so email addresses, `@handles` inside URLs, and mentions
inside code spans are no longer mangled into Discord mentions, and
already-formatted `<@id>` tokens are not double-wrapped
- 6de4572: Implement `rehydrateAttachment` on the Discord adapter.
Serialization strips an attachment's `fetchData` closure (queue/debounce
strategies), and consumers rebuild it via `adapter.rehydrateAttachment`.
The Discord adapter did not implement the method, so downstream
consumers could not download inbound Discord attachments after
deserialization. The Discord CDN `url` survives serialization, so
`fetchData` is now rebuilt to fetch that url (preserving its signed
query params), matching how the other adapters implement the method.
- Updated dependencies [3abdc69]
- Updated dependencies [0b63791]
- Updated dependencies [0c761f1]
- Updated dependencies [ef2542c]
- Updated dependencies [24a04d5]
- Updated dependencies [d4c52ca]
- Updated dependencies [076fe5d]
  - chat@4.33.0
  - @chat-adapter/shared@4.33.0
## @chat-adapter/gchat@4.33.0

### Patch Changes

- Updated dependencies [3abdc69]
- Updated dependencies [0b63791]
- Updated dependencies [0c761f1]
- Updated dependencies [ef2542c]
- Updated dependencies [24a04d5]
- Updated dependencies [d4c52ca]
- Updated dependencies [076fe5d]
  - chat@4.33.0
  - @chat-adapter/shared@4.33.0
## @chat-adapter/messenger@4.33.0

### Patch Changes

- Updated dependencies [3abdc69]
- Updated dependencies [0b63791]
- Updated dependencies [0c761f1]
- Updated dependencies [ef2542c]
- Updated dependencies [24a04d5]
- Updated dependencies [d4c52ca]
- Updated dependencies [076fe5d]
  - chat@4.33.0
  - @chat-adapter/shared@4.33.0
## @chat-adapter/slack@4.33.0

### Patch Changes

- 0b63791: Process Slack Socket Mode retry envelopes instead of
discarding them. Slack redelivers an event (immediately, +1 min, +5 min)
when a prior delivery wasn't acknowledged — including events sent while
the app had no open socket, e.g. during a restart or a routine
connection refresh. The adapter previously acked and dropped every
envelope with `retry_num > 0`, so such events were permanently lost even
though Slack redelivered them. Retries are now routed like first
deliveries (logged at info with `retry_num`/`retry_reason`);
`Chat.processMessage`'s message-id dedupe drops true duplicates.
- Updated dependencies [3abdc69]
- Updated dependencies [0b63791]
- Updated dependencies [0c761f1]
- Updated dependencies [ef2542c]
- Updated dependencies [24a04d5]
- Updated dependencies [d4c52ca]
- Updated dependencies [076fe5d]
  - chat@4.33.0
  - @chat-adapter/shared@4.33.0
## @chat-adapter/teams@4.33.0

### Patch Changes

- d4c52ca: use the shared `replaceBareMentions` scanner for `@mention`
conversion so email addresses, `@handles` inside URLs, and mentions
inside code spans are no longer mangled into `<at>` mention tags
- Updated dependencies [3abdc69]
- Updated dependencies [0b63791]
- Updated dependencies [0c761f1]
- Updated dependencies [ef2542c]
- Updated dependencies [24a04d5]
- Updated dependencies [d4c52ca]
- Updated dependencies [076fe5d]
  - chat@4.33.0
  - @chat-adapter/shared@4.33.0
## @chat-adapter/telegram@4.33.0

### Patch Changes

- Updated dependencies [3abdc69]
- Updated dependencies [0b63791]
- Updated dependencies [0c761f1]
- Updated dependencies [ef2542c]
- Updated dependencies [24a04d5]
- Updated dependencies [d4c52ca]
- Updated dependencies [076fe5d]
  - chat@4.33.0
  - @chat-adapter/shared@4.33.0
## @chat-adapter/twilio@4.33.0

### Patch Changes

- Updated dependencies [3abdc69]
- Updated dependencies [0b63791]
- Updated dependencies [0c761f1]
- Updated dependencies [ef2542c]
- Updated dependencies [24a04d5]
- Updated dependencies [d4c52ca]
- Updated dependencies [076fe5d]
  - chat@4.33.0
  - @chat-adapter/shared@4.33.0
## @chat-adapter/web@4.33.0

### Patch Changes

- Updated dependencies [3abdc69]
- Updated dependencies [0b63791]
- Updated dependencies [0c761f1]
- Updated dependencies [ef2542c]
- Updated dependencies [24a04d5]
- Updated dependencies [d4c52ca]
- Updated dependencies [076fe5d]
  - chat@4.33.0
  - @chat-adapter/shared@4.33.0
## @chat-adapter/whatsapp@4.33.0

### Patch Changes

- Updated dependencies [3abdc69]
- Updated dependencies [0b63791]
- Updated dependencies [0c761f1]
- Updated dependencies [ef2542c]
- Updated dependencies [24a04d5]
- Updated dependencies [d4c52ca]
- Updated dependencies [076fe5d]
  - chat@4.33.0
  - @chat-adapter/shared@4.33.0
## @chat-adapter/state-ioredis@4.33.0

### Patch Changes

- Updated dependencies [3abdc69]
- Updated dependencies [0b63791]
- Updated dependencies [0c761f1]
- Updated dependencies [ef2542c]
- Updated dependencies [24a04d5]
- Updated dependencies [076fe5d]
  - chat@4.33.0
## @chat-adapter/state-memory@4.33.0

### Patch Changes

- Updated dependencies [3abdc69]
- Updated dependencies [0b63791]
- Updated dependencies [0c761f1]
- Updated dependencies [ef2542c]
- Updated dependencies [24a04d5]
- Updated dependencies [076fe5d]
  - chat@4.33.0
## @chat-adapter/state-pg@4.33.0

### Patch Changes

- Updated dependencies [3abdc69]
- Updated dependencies [0b63791]
- Updated dependencies [0c761f1]
- Updated dependencies [ef2542c]
- Updated dependencies [24a04d5]
- Updated dependencies [076fe5d]
  - chat@4.33.0
## @chat-adapter/state-redis@4.33.0

### Patch Changes

- Updated dependencies [3abdc69]
- Updated dependencies [0b63791]
- Updated dependencies [0c761f1]
- Updated dependencies [ef2542c]
- Updated dependencies [24a04d5]
- Updated dependencies [076fe5d]
  - chat@4.33.0

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-07 23:22:51 +01:00
josh ef2542c5fd feat(x): add X (Twitter) adapter (#682)
## summary

new `@chat-adapter/x` adapter for X (Twitter), built on the X API v2 and
the X Activity API. write bot logic once and reply to mentions, hold DM
conversations, post from the account, and like posts, like the other
Chat SDK adapters

what it supports:
- reply to public mentions (`post.mention.create`) and top-level posts
via `channel.post`
- send and receive direct messages (`dm.received` / `dm.sent`)
- edit and delete owned posts, delete own DM events
- likes as the only reaction (`emoji.heart` or `"like"`)
- buffered streaming: accumulates an LLM stream and posts once instead
of post+edit churn on a public timeline
- OAuth 2.0 user context with managed token refresh (rotating refresh
token persisted in the state adapter, optional AES-256-GCM encryption)
- webhook CRC and `x-twitter-webhooks-signature` verification

key design decisions:
- DMs are threaded by the other participant's user id (`x:dm:{userId}`)
because X DM webhooks carry no conversation id, only participants
- OAuth 2.0 only at runtime: DM send and read are verified to work on
OAuth 2.0 user tokens, so no OAuth 1.0a in the adapter (subscription and
webhook setup is one-time and handled in the X developer console)
- parsers were written against real captured payloads: mentions use the
v2 shape (author hydrated in `includes.users`), DMs use the legacy
Account Activity shape (`direct_message_events`,
`message_create.message_data`, a `users` map, and no conversation id)

also includes the `chat/adapters` catalog entry, docs page, CLI scaffold
spec, and `sample-messages.md` with real captured payloads

<details><summary>usage</summary>

```typescript
import { Chat } from "chat";
import { createXAdapter } from "@chat-adapter/x";

const bot = new Chat({
  userName: "mybot",
  adapters: { x: createXAdapter() },
});

bot.onNewMention(async (thread, message) => {
  await thread.post(`hi @${message.author.userName}!`);
});

bot.onDirectMessage(async (thread) => {
  await thread.post("hello from X");
});
```
</details>

## test plan

- adapter unit tests pass against the real captured payload shapes, with
regression tests for author-from-`includes` (mentions) and the legacy
`direct_message_events` shape (DMs)
- real captured `post.mention.create` and `dm.received` payloads
verified end-to-end through `handleWebhook`: signature verification,
routing, author resolution, and participant threading, plus
bad-signature rejection returns 401
- every write and read path fired live against the X API through the
adapter: top-level post, reply to a mention, like and unlike, edit,
delete, DM send, DM read, DM delete
- OAuth 2.0 managed token refresh exercised live (access and refresh
token rotation)

---------

Signed-off-by: dancer <josh@afterima.ge>
2026-07-07 23:07:36 +01:00
OmriBenShoham 0c761f1bdd docs(adapters): add Dial as vendor-official adapter (#676)
Adds Dial as a vendor-official adapter — SMS, MMS, iMessage, and inbound
voice-call transcripts for Chat SDK.

- `vendor-official/dial.mdx` adapter page (following the Photon / Linq /
Sendblue format)
- catalog entry in `packages/chat/src/adapters/index.ts` with
`DIAL_API_KEY` / `DIAL_FROM_NUMBER_ID` / `DIAL_WEBHOOK_SECRET`
- `create-chat-sdk` scaffold spec entry
- registry entry in `adapters.json` + `dial` added to vendor-official
`meta.json`
- integration-test doc lists + changeset

Repo: https://github.com/GetDial-AI/chat-sdk-adapter · npm:
`@getdial/chat-sdk-adapter` · Dial docs:
https://docs.getdial.ai/integrations/agent-clients/vercel-chat-sdk

The adapter maps a phone conversation to a Chat SDK thread (identified
by the pair of phone numbers — Dial-owned and peer), an SMS/MMS/iMessage
to a message with optional media attachments, and a completed voice
call's transcript to a message on the caller's thread. Outbound sends
and transcript fetches go through the official `@getdial/sdk`; inbound
webhooks are HMAC-SHA256 verified against a per-subscription signing
secret with constant-time compare.

### Validation
- `pnpm --filter chat build` — clean
- `pnpm --filter chat typecheck` — clean
- `pnpm --filter create-chat-sdk typecheck` — clean
- `pnpm --filter @chat-adapter/integration-tests exec vitest run
src/docs-adapters.test.ts` — 361/361 passed
- `pnpm check` (ultracite) — clean
- `pnpm konsistent` — 34 files, no violations
2026-07-06 09:21:34 +10:00
Thomas Dietert 0b63791b66 fix(slack): process Socket Mode retry envelopes instead of dropping them (#667)
Fixes #666

## Summary

Both `slack_event` handlers (`startSocketMode` and
`runSocketModeListener`) ack and discard every envelope with `retry_num
> 0`. Slack retries an event (immediately, +1 min, +5 min) when a prior
delivery wasn't acked — including events that arrived while the app had
**no open socket** (restart, deploy, or Slack's routine connection
refreshes). For those, the retry is the only delivery the app ever sees,
so dropping it permanently loses the event (production incident details
in #666).

- **`@chat-adapter/slack`**: route retry envelopes through
`routeSocketEvent` like first deliveries (it acks per envelope type,
preserving the 3s ack window), and log them at info with `retry_num` /
`retry_reason` so redelivery is observable. Duplicate protection is
unchanged and sufficient: `Chat.processMessage` dedupes on `message.id`
(the Slack event `ts`, identical on a retry) via `state.setIfNotExists`.
- **`chat`**: raise the default `DEDUPE_TTL_MS` from 5 to 10 minutes.
Slack's final retry fires ~5 minutes after the original delivery —
exactly at the old TTL boundary, where the dedupe entry from the first
processing could expire just before the retry arrives and cause a
double-process. `dedupeTtlMs` config still overrides.

Behavior note for review: apps that relied on retries being invisible
will now see redelivered events flow through — deduped when already
handled, processed when not. That is the intended semantic:
at-least-once delivery from Slack, exactly-once handling via the SDK's
dedupe.

## Test plan

- Replaced the `"skips retries"` test with `"processes retries like
first deliveries (dedupe drops true duplicates)"` — asserts a
`retry_num: 1` envelope is acked and reaches `processMessage`.
- Updated the default-TTL test to 10 minutes; the custom-`dedupeTtlMs`
test is unchanged.
- `pnpm validate` passes end to end (knip, check, typecheck, test,
build); `pnpm --filter chat --filter @chat-adapter/slack test` = 1028 +
506 passing.


Signed-off-by: tdietert <thomasd@mercury.com>
2026-07-02 17:26:27 +01:00
Ben Sabic 3abdc69103 docs(adapters): add Cloudflare Agents as vendor-official state adapter (#669)
Adds Cloudflare Agents as a vendor-official **state** adapter —
`agents/chat-sdk`'s `createChatSdkState()`, a Chat SDK `StateAdapter`
that stores subscriptions, locks, queues, dedupe keys, thread/channel
state, transcripts, and history in Durable Object SQLite via
`ChatSdkStateAgent` sub-agents.

- `vendor-official/cloudflare-agents.mdx` state-adapter page (Agent
setup, wrangler DO migration, sharding, config, storage/cleanup)
- catalog entry in `packages/chat/src/adapters/index.ts` (`group:
vendor-official`, `type: state`)
- registry entry in `adapters.json` + `cloudflare-agents` in
vendor-official `meta.json`
- integration-test doc lists + changeset

Repo: https://github.com/cloudflare/agents · package `agents`
(`agents/chat-sdk`) ·
[docs](https://developers.cloudflare.com/agents/runtime/communication/chat-sdk/)

### Not wired into the create-chat-sdk CLI
This adapter runs inside a Cloudflare Worker with Durable Objects, not
the generated Next.js runtime, so it is intentionally kept out of the
scaffold:
- added to `CLI_INCOMPATIBLE_ADAPTERS` (rejected via `--adapter`, hidden
from the platform picker and e2e run, like `lark`/`matrix`)
- new `listCliStateAdapters()` filters the interactive **state** picker
and the `--help` adapter list (the state picker previously used raw
`listStateAdapters()` and would have offered it, then thrown on
selection)

### Tests
- `catalog/display.test.ts` — `listCliStateAdapters`: returns only state
adapters, includes `memory`/`redis`, and excludes `cloudflare-agents`
while asserting it *is* in the raw catalog
- `catalog/selection.test.ts` —
`resolveAdapterValue("cloudflare-agents")` throws "not supported"
- `cli/program.test.ts` — `buildAdapterList()` help text omits
`cloudflare-agents`
- existing `CLI_SCAFFOLD_SPEC covers every catalog adapter` +
docs-adapters/docs-content suites cover the catalog entry, registry
parity, and MDX imports

### Validation
- create-chat-sdk: **178 passed**, typecheck clean
- integration docs suites pass; Biome + knip clean

---------

Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
2026-07-03 01:55:05 +10:00
Ben Sabic 24a04d5653 docs(adapters): add Photon as vendor-official adapter (#668)
Adds Photon as a vendor-official adapter — iMessage for Chat SDK.

- `vendor-official/photon.mdx` adapter page (following the Linq /
Sendblue / Kapso format)
- catalog entry in `packages/chat/src/adapters/index.ts` with
cloud/self-host credential modes
- `create-chat-sdk` scaffold spec entry
- registry entry in `adapters.json` + `photon` added to vendor-official
`meta.json`
- integration-test doc lists + changeset

Repo: https://github.com/photon-hq/vercel-chat-adapter-imessage · npm:
`@photon-ai/chat-adapter-imessage` · built on
[spectrum-ts](https://github.com/photon-hq/spectrum-ts)

The adapter runs in three modes — **Cloud** ([Spectrum
Cloud](https://app.photon.codes)), **self-hosted** (gRPC), and **local**
(on-device, macOS) — auto-detected from environment variables. Cloud
mode delivers inbound messages via HMAC-signed webhooks; DMs can be
replied to cold from a webhook delivery.

### Notes
- Catalog slug is `photon`; docs code examples use `imessage` as the
adapter key to match the upstream README.
- Feature flags encode the README's remote-only caveats (reactions /
editing / typing / modals as `partial`, mentions as DMs-only; no
history, thread info, or reaction removal).

### Validation
- `docs-adapters` integration tests — 1237 passed (catalog↔registry
parity, peerDeps↔PackageInstall alignment)
- `create-chat-sdk` e2e scaffold — 175 passed (scaffolds every catalog
adapter, incl. photon)
- `chat` + `create-chat-sdk` typecheck, Biome check, and konsistent —
clean

Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
2026-07-03 01:40:06 +10:00
Ben Sabic 6750d59e72 feat(github): add Vercel Connect support (#650)
Adds Vercel Connect support to the GitHub adapter:

- A new `installationToken` config option (string or resolver) supplies
installation access tokens directly, skipping the GitHub App private-key
JWT exchange.
- A new optional `webhookVerifier` verifies inbound webhooks (Connect
trigger-forwarded requests via a Vercel OIDC token) in place of the
GitHub webhook secret.

Pair with `connectGitHubAdapter()` from `@vercel/connect/chat`. Includes
a changeset (`@chat-adapter/github` minor).

Stacked on #647 (base `vercel-connect/base`).

## Companion

`@vercel/connect/chat` subpath: vercel/vercel#16826.

<img width="933" height="755" alt="CleanShot 2026-06-30 at 12 02 18"
src="https://github.com/user-attachments/assets/cc834560-0486-4f09-b8d5-8264be360544"
/>

---------

Signed-off-by: Ben Sabic <bensabic@users.noreply.github.com>
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
2026-07-03 01:38:51 +10:00
josh 076fe5dc43 fix(chat): preserve skipped mention routing (#659)
## summary

fixes skipped mention routing for collapsed concurrency messages

queue and burst already passed skipped message context, but mention
routing could still swallow message pattern handlers when no
`onNewMention` handler was registered

this also makes debounce preserve skipped context so an earlier
debounced bot mention can still route to `onNewMention` when the latest
message does not mention the bot
2026-07-01 19:04:58 +10:00
github-actions[bot] 6f18930cf3 chore(release): version packages (#623)
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.32.0

### Minor Changes

- 022a502: Add a Discord adapter interactionFlags callback for ephemeral
slash command responses.

### Patch Changes

- 0d4e3ee: fix: render bare URLs and autolinks as bare URLs instead of
`[url](url)` masked links, which Discord only renders inside embeds (in
normal messages they showed up as literal text)
- 490fa00: fix bare-mention conversion so it no longer mangles
surrounding text: email addresses and `word@word` handles are left
intact (the `@` must be at a word boundary), already-formatted mentions
like `<@123>` are no longer double-wrapped into `<<@123>>`, and a real
mention that follows a period (e.g. `docs.@everyone`) still converts
-   Updated dependencies [eccc6b9]
-   Updated dependencies [438f551]
-   Updated dependencies [d034b8b]
-   Updated dependencies [06af3e1]
-   Updated dependencies [2e47351]
-   Updated dependencies [efa9610]
    -   chat@4.32.0
    -   @chat-adapter/shared@4.32.0

## chat@4.32.0

### Minor Changes

- 2e47351: Add `autoCompletePrevious` option to `Plan.addTask()`.
Defaults to `true` so sequential workflows keep auto-completing existing
in-progress tasks; pass `false` to keep multiple tasks in progress for
parallel execution.

### Patch Changes

-   eccc6b9: detect bot mentions in skipped queue and burst messages
- 438f551: Fix lightweight thread handles so streaming posts without an
incoming message context no longer crash.
- d034b8b: docs(adapters): add Linq as a vendor-official adapter
(`@linqapp/chat-sdk-adapter`) to the catalog, docs listing, and CLI
scaffold spec
- 06af3e1: docs(adapters): add Novu as a vendor-official adapter
(`@novu/chat-sdk-adapter`) to the catalog, docs listing, and CLI
scaffold spec
- efa9610: Sync bundled KB resources from Edge Config: add four new
guides (Vercel Connect, the Slack Vercel Connect bot, AI Gateway + AI
SDK, and the daily digest bot), refresh existing guide bodies, and
regenerate `resources/templates.json`. The `sync-resources` script now
fetches and validates all guides before writing (so a failed fetch
leaves the tree untouched), validates the source config shape, rejects
duplicate slugs, retries transient fetches, and mirrors `SKILL.md` to
all four committed copies.

## @chat-adapter/gchat@4.32.0

### Patch Changes

-   Updated dependencies [eccc6b9]
-   Updated dependencies [438f551]
-   Updated dependencies [d034b8b]
-   Updated dependencies [06af3e1]
-   Updated dependencies [2e47351]
-   Updated dependencies [efa9610]
    -   chat@4.32.0
    -   @chat-adapter/shared@4.32.0

## @chat-adapter/github@4.32.0

### Patch Changes

- fc7df9c: Remove raw GitHub webhook payload previews from adapter logs.

Debug and error logs now report only request-shape metadata, such as
body size, event type, content type, and signature presence, instead of
copying provider payload content into logs.

-   Updated dependencies [eccc6b9]

-   Updated dependencies [438f551]

-   Updated dependencies [d034b8b]

-   Updated dependencies [06af3e1]

-   Updated dependencies [2e47351]

-   Updated dependencies [efa9610]
    -   chat@4.32.0
    -   @chat-adapter/shared@4.32.0

## @chat-adapter/linear@4.32.0

### Patch Changes

-   Updated dependencies [eccc6b9]
-   Updated dependencies [438f551]
-   Updated dependencies [d034b8b]
-   Updated dependencies [06af3e1]
-   Updated dependencies [2e47351]
-   Updated dependencies [efa9610]
    -   chat@4.32.0
    -   @chat-adapter/shared@4.32.0

## @chat-adapter/messenger@4.32.0

### Patch Changes

-   Updated dependencies [eccc6b9]
-   Updated dependencies [438f551]
-   Updated dependencies [d034b8b]
-   Updated dependencies [06af3e1]
-   Updated dependencies [2e47351]
-   Updated dependencies [efa9610]
    -   chat@4.32.0
    -   @chat-adapter/shared@4.32.0

## @chat-adapter/shared@4.32.0

### Patch Changes

-   Updated dependencies [eccc6b9]
-   Updated dependencies [438f551]
-   Updated dependencies [d034b8b]
-   Updated dependencies [06af3e1]
-   Updated dependencies [2e47351]
-   Updated dependencies [efa9610]
    -   chat@4.32.0

## @chat-adapter/slack@4.32.0

### Patch Changes

- a8c4af7: prevent cached slack display names inside urls from being
resolved as user mentions before payload formatting
- 07c1112: Fix `@mention` rewriting so handles inside inline code spans
(`` `@vercel/postgres` ``) and fenced code blocks (```` ``` ````) are no
longer turned into `<@USER_ID>` Slack mentions. Agents printing npm
package names or shell snippets previously had those handles corrupted
into bot user IDs. Mention linking now skips whole code spans and code
blocks; handles outside code (including the same name mentioned
elsewhere in the message) still resolve normally.
-   Updated dependencies [eccc6b9]
-   Updated dependencies [438f551]
-   Updated dependencies [d034b8b]
-   Updated dependencies [06af3e1]
-   Updated dependencies [2e47351]
-   Updated dependencies [efa9610]
    -   chat@4.32.0
    -   @chat-adapter/shared@4.32.0

## @chat-adapter/teams@4.32.0

### Patch Changes

-   Updated dependencies [eccc6b9]
-   Updated dependencies [438f551]
-   Updated dependencies [d034b8b]
-   Updated dependencies [06af3e1]
-   Updated dependencies [2e47351]
-   Updated dependencies [efa9610]
    -   chat@4.32.0
    -   @chat-adapter/shared@4.32.0

## @chat-adapter/telegram@4.32.0

### Patch Changes

- 937cac9: fix(telegram): stop `trimToMarkdownV2SafeBoundary` from
truncating valid messages at entity-marker characters (`_`, `*`, `~`)
inside link URLs. Per the MarkdownV2 spec, only `)` and `\` are special
inside the `(...)` part of an inline link, so URLs with raw underscores
in query parameters (e.g. `?a_b=1&c_d=2&e_f=3`) are now left intact
instead of being sliced mid-URL and degraded to plain text. Hard
truncation that cuts inside a link URL now trims back to before the
link's `[`.
- 4ee187a: Send Telegram typing actions immediately when private message
updates arrive.
-   Updated dependencies [eccc6b9]
-   Updated dependencies [438f551]
-   Updated dependencies [d034b8b]
-   Updated dependencies [06af3e1]
-   Updated dependencies [2e47351]
-   Updated dependencies [efa9610]
    -   chat@4.32.0
    -   @chat-adapter/shared@4.32.0

## @chat-adapter/twilio@4.32.0

### Patch Changes

-   Updated dependencies [eccc6b9]
-   Updated dependencies [438f551]
-   Updated dependencies [d034b8b]
-   Updated dependencies [06af3e1]
-   Updated dependencies [2e47351]
-   Updated dependencies [efa9610]
    -   chat@4.32.0
    -   @chat-adapter/shared@4.32.0

## @chat-adapter/web@4.32.0

### Patch Changes

-   Updated dependencies [eccc6b9]
-   Updated dependencies [438f551]
-   Updated dependencies [d034b8b]
-   Updated dependencies [06af3e1]
-   Updated dependencies [2e47351]
-   Updated dependencies [efa9610]
    -   chat@4.32.0
    -   @chat-adapter/shared@4.32.0

## @chat-adapter/whatsapp@4.32.0

### Patch Changes

-   Updated dependencies [eccc6b9]
-   Updated dependencies [438f551]
-   Updated dependencies [d034b8b]
-   Updated dependencies [06af3e1]
-   Updated dependencies [2e47351]
-   Updated dependencies [efa9610]
    -   chat@4.32.0
    -   @chat-adapter/shared@4.32.0

## create-chat-sdk@0.1.1

### Patch Changes

- d034b8b: docs(adapters): add Linq as a vendor-official adapter
(`@linqapp/chat-sdk-adapter`) to the catalog, docs listing, and CLI
scaffold spec
- 06af3e1: docs(adapters): add Novu as a vendor-official adapter
(`@novu/chat-sdk-adapter`) to the catalog, docs listing, and CLI
scaffold spec

## @chat-adapter/state-ioredis@4.32.0

### Patch Changes

-   Updated dependencies [eccc6b9]
-   Updated dependencies [438f551]
-   Updated dependencies [d034b8b]
-   Updated dependencies [06af3e1]
-   Updated dependencies [2e47351]
-   Updated dependencies [efa9610]
    -   chat@4.32.0

## @chat-adapter/state-memory@4.32.0

### Patch Changes

-   Updated dependencies [eccc6b9]
-   Updated dependencies [438f551]
-   Updated dependencies [d034b8b]
-   Updated dependencies [06af3e1]
-   Updated dependencies [2e47351]
-   Updated dependencies [efa9610]
    -   chat@4.32.0

## @chat-adapter/state-pg@4.32.0

### Patch Changes

-   Updated dependencies [eccc6b9]
-   Updated dependencies [438f551]
-   Updated dependencies [d034b8b]
-   Updated dependencies [06af3e1]
-   Updated dependencies [2e47351]
-   Updated dependencies [efa9610]
    -   chat@4.32.0

## @chat-adapter/state-redis@4.32.0

### Patch Changes

-   Updated dependencies [eccc6b9]
-   Updated dependencies [438f551]
-   Updated dependencies [d034b8b]
-   Updated dependencies [06af3e1]
-   Updated dependencies [2e47351]
-   Updated dependencies [efa9610]
    -   chat@4.32.0

## @chat-adapter/tests@4.32.0

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-01 04:59:43 +01:00
Anudeep 2e4735118e fix: let Plan tasks run in parallel without implicit auto-completion (#632)
## Summary

Plan’s task list API always marked existing in-progress steps as
complete whenever a new step was added. That made sense for simple
sequential bots, but it blocked parallel work — even though the docs
already showed a parallel pattern and per-task updates by ID were added
earlier.

This PR adds an optional flag on task creation so callers can keep
multiple steps in progress at once, while leaving the old sequential
behavior as the default.


**Opt-out flag, default on**. We considered removing auto-completion
entirely. That would’ve been cleaner for parallel use but would’ve
broken existing sequential bots that rely on implicit “move to next
step” behavior. Defaulting to the current behavior keeps upgrades safe;
parallel callers pass the flag off.

**No broader API redesign**. Task completion stays explicit via status
updates and the existing “complete plan” flow. The change is scoped to
when a new task is appended.


closes #630
2026-07-01 04:26:48 +01:00
josh eccc6b91bf fix(chat): detect mentions in skipped queued messages (#656)
## summary

fixes #613

detects bot mentions across queued and burst skipped messages before
routing handlers

this makes `onNewMention` fire when an earlier skipped message mentions
the bot and the latest collapsed message does not, while preserving
`message.isMention` on the latest message

adds regression coverage for both `queue` and `burst`
2026-07-01 03:52:41 +01:00
Ben Sabic 99c598505f docs: refresh agent docs, README badges, and Chat SDK skill (#646)
- Replace npm version/download badges with Agent Stack and MIT badges on
the root README and all published package READMEs
- Streamline root `AGENTS.md`: fix title, add an accurate monorepo map,
trim duplicated CONTRIBUTING/Ultracite/env-var content, and link to
package-level `AGENTS.md` files
- Slim the Chat SDK agent skill (`skills/chat/SKILL.md` and published
copies) to defer to bundled docs, chat-sdk.dev, Vercel KB, and
`llms.txt` instead of inlining CLI flags, quick-start code, and API
tables
- Polish root README copy (install examples, adapter/build links, Vercel
Plugin URL, Vercel KB link, “Made by Vercel” badge)
- Minor `CONTRIBUTING.md` fixes: simplify DCO wording, correct
preview-branch proxy file references (`proxy.ts` vs middleware)

---------

Signed-off-by: Ben Sabic <bensabic@users.noreply.github.com>
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
2026-06-27 14:06:13 +10:00
Akazawa Daisuke 438f5513b0 fix: avoid dummy message context for lightweight threads (#633)
## summary

fixes #631

removes dummy `Message` casts from lightweight thread, action, and
reaction paths when no incoming message context exists

this keeps the existing `currentMessage` guard meaningful and prevents
streaming through `chat.thread(threadId)`, `chat.openDM(...)`, action
threads, and reaction threads from reading fields from an empty object

when Slack lacks the thread or recipient context required by
`chat.startStream`, the adapter now returns `null` before consuming the
stream so Chat SDK can transparently use its post-and-edit fallback

native Slack streaming remains available for webhook-created threads and
DM threads with valid native stream context

---------

Co-authored-by: dancer <josh@afterima.ge>
2026-06-22 14:42:07 +01:00
Ben Sabic efa96108bd docs: sync KB resources and harden sync-resources script (#635)
Syncs the bundled Chat SDK KB resources from Edge Config and hardens the
`sync-resources` script that generates them.

- **New guides** (4): Vercel Connect, the Slack Vercel Connect bot, AI
Gateway + AI SDK, and the daily digest bot. Existing guide bodies
refreshed and `templates.json` regenerated.
- **Script hardening** (`scripts/sync-resources.ts`):
- Fetch + validate all guides into memory **before** wiping the
resources dir — a failed fetch now leaves the working tree untouched.
- Validate the `resources-edge-config.json` shape with a clear error
instead of a blind cast.
  - Reject duplicate guide slug collisions.
- Retry transient fetches (5xx / network) with exponential backoff; fail
fast on 4xx, bad content-type, and oversized bodies.
- Mirror `skills/chat/SKILL.md` to **all four** committed copies (docs
site `.well-known` + `AGENTS.md`, and the two `create-chat-sdk` scaffold
templates).
  - TSDoc on every function.
- **Tests**: new offline consistency test in
`packages/integration-tests` — every guide has a non-empty file with no
orphans, `templates.json` mirrors the config, no duplicate slugs, and
all four `SKILL.md` copies are byte-identical to the source.

---------

Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
2026-06-22 14:56:17 +10:00
George McCain d034b8b575 docs(adapters): add Linq as vendor-official adapter (#625)
Adds Linq as a vendor-official adapter — iMessage and SMS for Chat SDK.

- `vendor-official/linq.mdx` adapter page (following the Velt /
AgentPhone format)
- catalog entry in `adapters.json`
- `linq` added to the vendor-official `meta.json`

Repo: https://github.com/linq-team/linq-chat-sdk · npm:
`@linqapp/chat-sdk-adapter` (Apache-2.0)

The adapter is built and tested end-to-end against the live Linq API and
the Chat SDK runtime (real iMessage round-trip, webhooks, reactions,
media). Confirmed with Benji that a repo link works and Apache-2.0 is
fine. Happy to adjust the page to match any conventions I missed.

---------

Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
2026-06-20 11:47:57 +10:00
Dima Grossman 06af3e12fd docs(adapters): add Novu as vendor-official adapter (#622)
## Summary

Adds Novu as a vendor official adapter to Chat SDK allowing
multi-channel notification delivery and quick channel setup for
multi-tenant apps.

Official change log entry:
https://novu.co/changelog/novu-chat-sdk-adapter/
Official social post: https://x.com/novuhq/status/2067870170320679158 

## Test plan

Manually tested with our team to ensure compatability with the create
chat sdk and template apps, also created an example repo:
https://github.com/novuhq/novu-chat-sdk-example

## Checklist

- [x] All commits are signed and verified
- [x] `pnpm validate` passes
- [x] Changeset added (or N/A — see
[CONTRIBUTING.md](./CONTRIBUTING.md))
- [x] Documentation updated (or N/A)

---------

Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
2026-06-19 22:11:33 +10:00
github-actions[bot] 2a553aa948 chore(release): version packages (#600)
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/slack@4.31.0

### Minor Changes

- 8336a3e: Add `webClientOptions` to `SlackAdapterConfig`, forwarded to
both the default and per-token `@slack/web-api` `WebClient` instances.
This exposes Web API settings such as `retryConfig`, per-request
`timeout`, and `rejectRateLimitedCalls`. Use the existing `apiUrl`
option to override the Slack Web API base URL.
- 171657a: Adding support for stable IDs to link button action handlers

### Patch Changes

- a8bf99a: Fix `@mention` rewriting so an `@handle` inside a URL is no
longer turned into a `<@handle>` Slack mention, which corrupted the
link. Mention linking now skips whole `http(s)://…` spans, so handles in
paths (`https://hackmd.io/@jkyang/abc`), query strings
(`?user=@george`), and fragments (`#@george`) are preserved; the
lookbehind also excludes a `/` immediately before `@` to cover
schemeless URLs (`mastodon.social/@user`). Whitespace- and
punctuation-led mentions (e.g. `(cc @george)`), emails, and `<mailto:…>`
links are unaffected.
-   Updated dependencies [778ae69]
-   Updated dependencies [171657a]
    -   chat@4.31.0
    -   @chat-adapter/shared@4.31.0

## @chat-adapter/teams@4.31.0

### Minor Changes

-   8c71411: Add low-level Teams primitive subpaths for custom runtimes.

### Patch Changes

-   Updated dependencies [778ae69]
-   Updated dependencies [171657a]
    -   chat@4.31.0
    -   @chat-adapter/shared@4.31.0

## @chat-adapter/telegram@4.31.0

### Minor Changes

- 4662309: add native rich message formatting and streaming for Telegram
Bot API 10.1
- 9c936f8: Add support for routing Telegram bot commands to Chat SDK
slash command handlers

### Patch Changes

-   Updated dependencies [778ae69]
-   Updated dependencies [171657a]
    -   chat@4.31.0
    -   @chat-adapter/shared@4.31.0

## chat@4.31.0

### Minor Changes

- 778ae69: Add a zero-dependency `chat/adapters` catalog subpath for
official and vendor-official adapter metadata, environment specs, and
setup helpers.
- 171657a: Adding support for stable IDs to link button action handlers

## create-chat-sdk@0.1.0

### Minor Changes

- 8f3af76: Add the `create-chat-sdk` CLI for scaffolding webhook-only
Next.js Chat SDK bot projects. Supports interactive prompts,
non-interactive `--adapter` selection from the `chat/adapters` catalog,
coding-agent detection with an `--interactive` escape hatch, and
generated `src/lib/bot.ts`, `.env.example`, `next.config.ts`, and README
output per selected adapter.

## @chat-adapter/state-ioredis@4.31.0

### Minor Changes

- 8f3af76: Make `logger` optional in `createIoRedisState`, defaulting to
a console logger, matching `@chat-adapter/state-redis`.

### Patch Changes

-   Updated dependencies [778ae69]
-   Updated dependencies [171657a]
    -   chat@4.31.0

## @chat-adapter/discord@4.31.0

### Patch Changes

-   Updated dependencies [778ae69]
-   Updated dependencies [171657a]
    -   chat@4.31.0
    -   @chat-adapter/shared@4.31.0

## @chat-adapter/gchat@4.31.0

### Patch Changes

-   Updated dependencies [778ae69]
-   Updated dependencies [171657a]
    -   chat@4.31.0
    -   @chat-adapter/shared@4.31.0

## @chat-adapter/github@4.31.0

### Patch Changes

-   Updated dependencies [778ae69]
-   Updated dependencies [171657a]
    -   chat@4.31.0
    -   @chat-adapter/shared@4.31.0

## @chat-adapter/linear@4.31.0

### Patch Changes

-   Updated dependencies [778ae69]
-   Updated dependencies [171657a]
    -   chat@4.31.0
    -   @chat-adapter/shared@4.31.0

## @chat-adapter/messenger@4.31.0

### Patch Changes

-   Updated dependencies [778ae69]
-   Updated dependencies [171657a]
    -   chat@4.31.0
    -   @chat-adapter/shared@4.31.0

## @chat-adapter/shared@4.31.0

### Patch Changes

-   Updated dependencies [778ae69]
-   Updated dependencies [171657a]
    -   chat@4.31.0

## @chat-adapter/twilio@4.31.0

### Patch Changes

-   Updated dependencies [778ae69]
-   Updated dependencies [171657a]
    -   chat@4.31.0
    -   @chat-adapter/shared@4.31.0

## @chat-adapter/web@4.31.0

### Patch Changes

-   Updated dependencies [778ae69]
-   Updated dependencies [171657a]
    -   chat@4.31.0
    -   @chat-adapter/shared@4.31.0

## @chat-adapter/whatsapp@4.31.0

### Patch Changes

-   Updated dependencies [778ae69]
-   Updated dependencies [171657a]
    -   chat@4.31.0
    -   @chat-adapter/shared@4.31.0

## @chat-adapter/state-memory@4.31.0

### Patch Changes

-   Updated dependencies [778ae69]
-   Updated dependencies [171657a]
    -   chat@4.31.0

## @chat-adapter/state-pg@4.31.0

### Patch Changes

-   Updated dependencies [778ae69]
-   Updated dependencies [171657a]
    -   chat@4.31.0

## @chat-adapter/state-redis@4.31.0

### Patch Changes

-   Updated dependencies [778ae69]
-   Updated dependencies [171657a]
    -   chat@4.31.0

## @chat-adapter/tests@4.31.0

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-06-16 11:00:02 +01:00
Ben Sabic 8f3af76565 feat: add create-chat-sdk CLI (#603)
Adds `create-chat-sdk`, a CLI that scaffolds a Next.js Chat SDK bot
project:

```bash
npm create chat-sdk@latest my-bot

# non-interactive
npm create chat-sdk@latest -- my-bot --adapter slack redis -y
```

The user picks platform and state adapters interactively or via
`--adapter`, and the CLI generates a webhook-only project with
`src/lib/bot.ts`, `.env.example`, `next.config.ts`, `package.json`, and
a README, then optionally runs `git init` and installs dependencies.
There are no pages or client UI in the template.

Adapter choices come straight from the `chat/adapters` catalog, so the
CLI has no adapter registry of its own. When a coding agent such as
Cursor or Claude Code runs the CLI, it uses non-interactive defaults and
requires an explicit platform adapter. `--interactive` forces prompts.

## also in this pr

- `google-chat` is renamed to `gchat` everywhere, including docs pages,
the OG image, and adapter catalog. Old URLs redirect permanently,
including language-prefixed and `/og` paths
- a new docs page is available at `chat-sdk.dev/docs/create-chat-sdk`,
and the CLI is promoted on the homepage, package READMEs, and agent
skill
- `create-chat-sdk` releases independently with a minor changeset for
its initial `0.1.0` release

---------

Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
Co-authored-by: dancer <josh@afterima.ge>
2026-06-16 08:48:38 +01:00
Ben Sabic 778ae69abc add zero-dependency chat/adapters for adapters catalog (#599)
Adapter Catalog:
- Adds a zero-dependency `chat/adapters` subpath for official and
vendor-official adapter metadata.
- Includes typed catalog entries, env specs, peer dependency metadata,
and helper APIs for setup and onboarding flows.
- Wires the subpath into the `chat` package export map and build config.

Code Coverage:
- Adds unit coverage for catalog integrity, registry sync, helper
behavior, official env declarations, and peer dependency derivation.
- Extends docs integration coverage for `chat/adapters` imports and
vendor-official package install metadata.

Documentation:
- Documents the new catalog on the adapter overview page.
- Splits platform-specific adapter guidance into a new
`/docs/platform-adapters` page.
- Renames `/docs/state` to `/docs/state-adapters` and adds a redirect
for the old slug.

Agent Guidance:
- Updates repo-local and public agent guidance so agents know when and
how to use `chat/adapters`.
- Adds focused `AGENTS.md` guidance inside `packages/chat/src/adapters`
for future catalog maintenance.

---------

Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
2026-06-09 10:43:00 +10:00
Vishal Yathish 171657a019 [chat] adding stable id to link button action handlers (#598)
Enabling overriding the `link:<url>` action ID for `LinkButton` events.
2026-06-08 08:36:24 -07:00
Ben Sabic 9921dcd1c4 docs(seo): improve npm metadata, README discoverability, and structured data (#587)
Improves Chat SDK discoverability across npm, READMEs, and the docs site
for search engines and AI coding agents.

- **npm metadata**: point every published package `homepage` at
chat-sdk.dev deep links; expand `chat` keywords/description; fix
`repository.directory` (`packages/chat-sdk` → `packages/chat`); align
state adapter keywords
- **READMEs**: add npm callouts, Documentation/Guides links, and AI
Coding Agents sections (skill install, optional Vercel Plugin,
`llms.txt` / `llms-full.txt`) across all published packages and the repo
root
- **docs JSON-LD**: `HowTo` / `TechArticle` on getting-started,
streaming, and cards; `CollectionPage` + official-only `ItemList` on
`/adapters` (with split human vs JSON-LD descriptions)
- **UTMs**: add `chat-sdk_site` / `chat-sdk_repo` tracking params to
Resources links in selected MDX pages and adapter READMEs (discord,
github, slack, liveblocks, getting-started, ai index)
- **contract tests**: integration-tests guardrails for npm metadata and
README discoverability so future package additions don't drift

---------

Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
2026-06-05 14:00:18 +10:00
josh f40c4d4840 docs(chat): clarify isMe semantics for adapter authors (#582)
## summary

clarifies that `author.isMe` means the message was sent by the current
bot runtime and should be filtered from handler dispatch

documents that adapters backed by user-owned accounts should not map
platform fields like `fromMe` directly to `isMe`

recommends tracking message ids returned by `postMessage` so webhook
echoes can be identified without filtering legitimate user-authored
messages
2026-06-03 13:40:58 -07:00
github-actions[bot] a5b118f1dc chore(release): version packages (#546)
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/slack@4.30.0

### Minor Changes

-   4c46c26: add lightweight Slack formatting primitives subpath
- dbd8dc5: expose runtime-free Block Kit helpers for Slack card
conversion
-   aba6aa9: add lightweight Slack API primitives subpath
-   b332a03: add lightweight Slack webhook primitives subpath
- 6ed4a43: add low-level Slack helpers for files, thread replies, views,
interactions, and input blocks

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)

- 073ff92: surface Slack file upload confirmation ids in postMessage
results

-   b63c042: fix(slack): resolve reaction user display names

Slack reaction events now resolve the reacting user's display name and
real name
through the existing cached user lookup path. If lookup fails, the
adapter falls
    back to the Slack user ID.

-   1294490: reuse low-level Slack formatting helpers in the adapter

- 999d268: pass the Slack bot token through native stream append and
stop calls

-   Updated dependencies [5461ea9]
    -   chat@4.30.0
    -   @chat-adapter/shared@4.30.0

## @chat-adapter/telegram@4.30.0

### Minor Changes

- 5461ea9: Add native Telegram private chat draft streaming with
fallback streaming elsewhere.

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0
    -   @chat-adapter/shared@4.30.0

## @chat-adapter/twilio@4.30.0

### Minor Changes

- 25ebc3b: add Twilio SMS, MMS, and voice helpers with webhook,
messaging, and formatting primitives

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0
    -   @chat-adapter/shared@4.30.0

## @chat-adapter/whatsapp@4.30.0

### Minor Changes

- ffc43fc: Add WhatsApp typing indicator support by sending Meta's
read-plus-typing payload when a recent inbound message is available.
Update the default API version to v25.0.

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0
    -   @chat-adapter/shared@4.30.0

## chat@4.30.0

### Minor Changes

- 5461ea9: Add native Telegram private chat draft streaming with
fallback streaming elsewhere.

## @chat-adapter/discord@4.30.0

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0
    -   @chat-adapter/shared@4.30.0

## @chat-adapter/gchat@4.30.0

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
- 177735a: - Fix redundant mailto link rendering in Google Chat adapter
- Google Chat adapter was emitting redundant `<mailto:...|...>` tokens
when rendering autolinked email addresses. This change collapses
`mailto:` URLs when the visible text equals the email address, ensuring
cleaner output consistent with plain text rendering in Google Chat.
-   Updated dependencies [5461ea9]
    -   chat@4.30.0
    -   @chat-adapter/shared@4.30.0

## @chat-adapter/github@4.30.0

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0
    -   @chat-adapter/shared@4.30.0

## @chat-adapter/linear@4.30.0

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0
    -   @chat-adapter/shared@4.30.0

## @chat-adapter/messenger@4.30.0

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0
    -   @chat-adapter/shared@4.30.0

## @chat-adapter/shared@4.30.0

### Patch Changes

-   Updated dependencies [5461ea9]
    -   chat@4.30.0

## @chat-adapter/teams@4.30.0

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0
    -   @chat-adapter/shared@4.30.0

## @chat-adapter/web@4.30.0

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0
    -   @chat-adapter/shared@4.30.0

## @chat-adapter/state-ioredis@4.30.0

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0

## @chat-adapter/state-memory@4.30.0

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0

## @chat-adapter/state-pg@4.30.0

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0

## @chat-adapter/state-redis@4.30.0

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0

## @chat-adapter/tests@4.30.0

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-06-01 18:18:35 -07:00
Ben Sabic 9b8d8c4518 Discoverability lift: link KB guides, broaden npm keywords, mirror to AGENTS.md (#560)
Broad SEO/AEO pass across the docs site, adapter READMEs and AGENTS.md
files, and npm package metadata so Chat SDK content shows up better in
search engines, in LLM-driven package recommendations, and in
IDE/coding-agent context.

**Docs site**

- Adds a `## Resources` section to the Getting Started and AI overview
pages and to the Slack, Discord, GitHub, Liveblocks, and Sendblue
adapter pages, each linking to applicable guides/templates with
descriptions sourced from `resources-edge-config.json` and a cross-link
back to the central `/resources` hub.

**Adapter packages**

- Mirrors the same Resources sections into the Slack, Discord, and
GitHub READMEs (so they surface on npm) and into their AGENTS.md files
(so coding agents see them alongside the API notes).
- Expands `keywords` on every published adapter and state package — adds
`chat-sdk`, `chatbot`, `ai-agent`, `ai-sdk`, `vercel`, plus
platform-specific terms like `slack-bot`, `block-kit`, `slash-commands`,
`github-app`, `whatsapp-business`, `state-adapter`.

**Resources registry**

- Registers four new entries in `resources-edge-config.json`
(Human-in-the-Loop guide, Liveblocks AI agent guide, Slack + Vercel Blob
guide, Durable iMessage Agent template) and runs `pnpm sync-resources`
so the bundled `chat` package guides, `templates.json`, and
`skills/chat/SKILL.md` all pick them up.
- Fixes the synced Slack AI agent guide to import `toAiMessages` from
`chat/ai` instead of the deprecated `chat` re-export path (the upstream
KB source has also been updated, so future syncs will preserve this).

**Drive-by fixes**

- Resend adapter doc quick start: corrects `MemoryStateAdapter` class
import to the `createMemoryState()` factory (matching every other
adapter doc).
- Zalo adapter doc: drops the "community adapter" callout that
duplicated frontmatter.

**Tooling / CI**

- Adds `tsx` as a root devDependency so `pnpm sync-resources` works out
of the box (it previously relied on `npx tsx`, which hung when not
pre-cached).
- Loosens the CI changeset gate to also skip `packages/chat/resources/`
(generated data), matching the existing `*.md` carve-out.

---------

Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
2026-05-29 11:41:23 +10:00
luren 5461ea982b feat(telegram): add native DM draft streaming with segmented stream results (#340)
## Summary

Add native Telegram DM streaming via `sendMessageDraft` while preserving
Chat SDK's existing post+edit fallback for non-DM threads.

This PR:
- adds native private-chat draft streaming to the Telegram adapter
- splits long streamed markdown into Telegram-safe persisted segments
- retries without `parse_mode` when Telegram rejects markdown entity
parsing
- exposes segmented native stream results in the chat core
- updates docs and feature matrices to reflect Telegram DM draft
streaming

---------

Co-authored-by: dancer <josh@afterima.ge>
2026-05-28 15:17:10 -07:00
github-actions[bot] 6581d31507 chore(release): version packages (#469)
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.29.0

### Minor Changes

- 2ffed48: Adapter internals are now `protected` rather than `private`,
so consumers can subclass an adapter to override or extend its behavior
(e.g. handling additional Telegram update types by overriding
`processUpdate`).

### Patch Changes

-   e60bc8c: chore: set supported Node versions in engines
- b9b17cd: handle slash commands and button interactions in Discord
gateway-only mode
-   Updated dependencies [ac8a207]
-   Updated dependencies [e60bc8c]
-   Updated dependencies [add2730]
-   Updated dependencies [b75eedb]
    -   chat@4.29.0
    -   @chat-adapter/shared@4.29.0

## @chat-adapter/gchat@4.29.0

### Minor Changes

- 2ffed48: Adapter internals are now `protected` rather than `private`,
so consumers can subclass an adapter to override or extend its behavior
(e.g. handling additional Telegram update types by overriding
`processUpdate`).

### Patch Changes

-   e60bc8c: chore: set supported Node versions in engines

- 06fb8e5: Align package shapes with the new `konsistent` conventions.
All changes are
backwards-compatible — previous type names are kept as deprecated
aliases.

- `@chat-adapter/gchat`, `@chat-adapter/slack`: moved `*AdapterConfig`
(and
related sub-types) into a `./types` module; the public re-exports from
        `index.ts` are unchanged.
- `@chat-adapter/slack`: `createSlackAdapter` now accepts
`SlackAdapterConfig`
directly instead of `Partial<SlackAdapterConfig>`. Every field on the
config
        was already optional, so no call sites need to change.
- `@chat-adapter/messenger`: `MessengerAdapterConfig` fields are now
optional
(the factory still falls back to `FACEBOOK_*` env vars), and `logger` /
`userName` live on `MessengerAdapterConfig` directly. The factory
signature
is now `createMessengerAdapter(config?: MessengerAdapterConfig)`.
- `@chat-adapter/web`: renamed `WebAdapterOptions` to
`WebAdapterConfig`; the
        old name is exported as a deprecated alias.
- `@chat-adapter/whatsapp`: every field on `WhatsAppAdapterConfig` is
optional
(the factory still falls back to `WHATSAPP_*` env vars).
`createWhatsAppAdapter`
is now typed `(config?: WhatsAppAdapterConfig) => WhatsAppAdapter`.
- `@chat-adapter/state-memory`: added an empty
`MemoryStateAdapterOptions`
type so the package matches every other state adapter;
`createMemoryState`
        now accepts an optional argument of that type.
    -   `@chat-adapter/state-ioredis`, `@chat-adapter/state-redis`,
`@chat-adapter/state-pg`: the URL- and client-based option shapes were
split
        into named interfaces (`*StateAdapterUrlOptions` /
`*StateAdapterClientOptions`) and unified under `*StateAdapterOptions`.
The
factories now take the union type directly. Old names —
`RedisStateClientOptions`,
        `CreateRedisStateOptions`, `PostgresStateClientOptions`,
`CreatePostgresStateOptions`, `IoRedisStateClientOptions` — are kept as
        deprecated aliases.

-   Updated dependencies [ac8a207]

-   Updated dependencies [e60bc8c]

-   Updated dependencies [add2730]

-   Updated dependencies [b75eedb]
    -   chat@4.29.0
    -   @chat-adapter/shared@4.29.0

## @chat-adapter/github@4.29.0

### Minor Changes

- 2f108bd: Rename the typed native client getter on the Slack, GitHub,
and Linear adapters to match the underlying SDK class.

- `bot.getAdapter("slack").client` is now
`bot.getAdapter("slack").webClient` (returns `WebClient` from
`@slack/web-api`).
- `bot.getAdapter("github").client` is now
`bot.getAdapter("github").octokit` (returns `Octokit`).
- `bot.getAdapter("linear").client` is now
`bot.getAdapter("linear").linearClient` (returns `LinearClient`).

The previous `.client` getter is kept as a deprecated alias on all three
adapters, so existing code continues to work without changes.

- 2ffed48: Adapter internals are now `protected` rather than `private`,
so consumers can subclass an adapter to override or extend its behavior
(e.g. handling additional Telegram update types by overriding
`processUpdate`).

### Patch Changes

-   e60bc8c: chore: set supported Node versions in engines
-   Updated dependencies [ac8a207]
-   Updated dependencies [e60bc8c]
-   Updated dependencies [add2730]
-   Updated dependencies [b75eedb]
    -   chat@4.29.0
    -   @chat-adapter/shared@4.29.0

## @chat-adapter/linear@4.29.0

### Minor Changes

- 2f108bd: Rename the typed native client getter on the Slack, GitHub,
and Linear adapters to match the underlying SDK class.

- `bot.getAdapter("slack").client` is now
`bot.getAdapter("slack").webClient` (returns `WebClient` from
`@slack/web-api`).
- `bot.getAdapter("github").client` is now
`bot.getAdapter("github").octokit` (returns `Octokit`).
- `bot.getAdapter("linear").client` is now
`bot.getAdapter("linear").linearClient` (returns `LinearClient`).

The previous `.client` getter is kept as a deprecated alias on all three
adapters, so existing code continues to work without changes.

- 2ffed48: Adapter internals are now `protected` rather than `private`,
so consumers can subclass an adapter to override or extend its behavior
(e.g. handling additional Telegram update types by overriding
`processUpdate`).

### Patch Changes

-   e60bc8c: chore: set supported Node versions in engines
-   Updated dependencies [ac8a207]
-   Updated dependencies [e60bc8c]
-   Updated dependencies [add2730]
-   Updated dependencies [b75eedb]
    -   chat@4.29.0
    -   @chat-adapter/shared@4.29.0

## @chat-adapter/messenger@4.29.0

### Minor Changes

- 2ffed48: Adapter internals are now `protected` rather than `private`,
so consumers can subclass an adapter to override or extend its behavior
(e.g. handling additional Telegram update types by overriding
`processUpdate`).

### Patch Changes

-   e60bc8c: chore: set supported Node versions in engines

- 06fb8e5: Align package shapes with the new `konsistent` conventions.
All changes are
backwards-compatible — previous type names are kept as deprecated
aliases.

- `@chat-adapter/gchat`, `@chat-adapter/slack`: moved `*AdapterConfig`
(and
related sub-types) into a `./types` module; the public re-exports from
        `index.ts` are unchanged.
- `@chat-adapter/slack`: `createSlackAdapter` now accepts
`SlackAdapterConfig`
directly instead of `Partial<SlackAdapterConfig>`. Every field on the
config
        was already optional, so no call sites need to change.
- `@chat-adapter/messenger`: `MessengerAdapterConfig` fields are now
optional
(the factory still falls back to `FACEBOOK_*` env vars), and `logger` /
`userName` live on `MessengerAdapterConfig` directly. The factory
signature
is now `createMessengerAdapter(config?: MessengerAdapterConfig)`.
- `@chat-adapter/web`: renamed `WebAdapterOptions` to
`WebAdapterConfig`; the
        old name is exported as a deprecated alias.
- `@chat-adapter/whatsapp`: every field on `WhatsAppAdapterConfig` is
optional
(the factory still falls back to `WHATSAPP_*` env vars).
`createWhatsAppAdapter`
is now typed `(config?: WhatsAppAdapterConfig) => WhatsAppAdapter`.
- `@chat-adapter/state-memory`: added an empty
`MemoryStateAdapterOptions`
type so the package matches every other state adapter;
`createMemoryState`
        now accepts an optional argument of that type.
    -   `@chat-adapter/state-ioredis`, `@chat-adapter/state-redis`,
`@chat-adapter/state-pg`: the URL- and client-based option shapes were
split
        into named interfaces (`*StateAdapterUrlOptions` /
`*StateAdapterClientOptions`) and unified under `*StateAdapterOptions`.
The
factories now take the union type directly. Old names —
`RedisStateClientOptions`,
        `CreateRedisStateOptions`, `PostgresStateClientOptions`,
`CreatePostgresStateOptions`, `IoRedisStateClientOptions` — are kept as
        deprecated aliases.

-   Updated dependencies [ac8a207]

-   Updated dependencies [e60bc8c]

-   Updated dependencies [add2730]

-   Updated dependencies [b75eedb]
    -   chat@4.29.0
    -   @chat-adapter/shared@4.29.0

## @chat-adapter/shared@4.29.0

### Minor Changes

-   add2730: support typed Telegram attachment uploads

### Patch Changes

-   e60bc8c: chore: set supported Node versions in engines
-   Updated dependencies [ac8a207]
-   Updated dependencies [e60bc8c]
-   Updated dependencies [b75eedb]
    -   chat@4.29.0

## @chat-adapter/slack@4.29.0

### Minor Changes

- 2f108bd: Rename the typed native client getter on the Slack, GitHub,
and Linear adapters to match the underlying SDK class.

- `bot.getAdapter("slack").client` is now
`bot.getAdapter("slack").webClient` (returns `WebClient` from
`@slack/web-api`).
- `bot.getAdapter("github").client` is now
`bot.getAdapter("github").octokit` (returns `Octokit`).
- `bot.getAdapter("linear").client` is now
`bot.getAdapter("linear").linearClient` (returns `LinearClient`).

The previous `.client` getter is kept as a deprecated alias on all three
adapters, so existing code continues to work without changes.

- c46fdb6: Add support for external `installationProvider` and
Enterprise Grid org-wide installs.

- New optional `installationProvider` config: `{
getInstallation(installationId, isEnterpriseInstall) =>
Promise<SlackInstallation | null> }`. When set, the adapter resolves bot
tokens for incoming events, slash commands, and interactive payloads
through the provider instead of the internal `StateAdapter` — useful for
hosted token-management systems (e.g. Vercel Connect). The provider is
read-only; OAuth callback writes (`setInstallation`,
`handleOAuthCallback`) and the `getInstallation`/`deleteInstallation`
public methods continue to use internal state, so callers using a
provider should manage their own writes.
- Enterprise Grid org-wide installs (`is_enterprise_install: true`) are
now keyed on `enterprise_id` instead of `team_id` across event_callback,
slash command, and interactive payload paths. Multi-workspace
deployments using the internal `StateAdapter` for org-wide installs must
repopulate installations under the `enterprise_id` key — previously,
org-wide events would fall through to a `team_id` lookup that did not
match what the OAuth flow had stored.

- fdebde7: feat(slack): expose direct `WebClient` access via
`adapter.client`

`bot.getAdapter("slack").client` now returns a typed `WebClient` from
`@slack/web-api`, matching the existing pattern on the Linear and GitHub
adapters. The returned client is bound to the bot token for the current
    request context (multi-workspace) or the configured default token
(single-workspace). Use it for any Web API call not covered by the SDK's
    high-level methods, e.g. `adapter.client.pins.add(...)` or
    `adapter.client.usergroups.list(...)`.

    Resolution order:

    1.  The token from the current `requestContext` — set during webhook
        handling, or by `adapter.withBotToken(token, fn)`.
    2.  The default `botToken`, when configured as a static string or a
        synchronous resolver function.

Throws `AuthenticationError` outside of any context in multi-workspace
mode, or when `botToken` is configured as an async resolver function.
    For async tokens, await the token first and bind it explicitly with
    `adapter.withBotToken(token, () => adapter.client...)`.

    Also fixes `createSlackAdapter()` silently dropping the `apiUrl`
    config field.

- 2ffed48: Adapter internals are now `protected` rather than `private`,
so consumers can subclass an adapter to override or extend its behavior
(e.g. handling additional Telegram update types by overriding
`processUpdate`).

### Patch Changes

-   e60bc8c: chore: set supported Node versions in engines

- 06fb8e5: Align package shapes with the new `konsistent` conventions.
All changes are
backwards-compatible — previous type names are kept as deprecated
aliases.

- `@chat-adapter/gchat`, `@chat-adapter/slack`: moved `*AdapterConfig`
(and
related sub-types) into a `./types` module; the public re-exports from
        `index.ts` are unchanged.
- `@chat-adapter/slack`: `createSlackAdapter` now accepts
`SlackAdapterConfig`
directly instead of `Partial<SlackAdapterConfig>`. Every field on the
config
        was already optional, so no call sites need to change.
- `@chat-adapter/messenger`: `MessengerAdapterConfig` fields are now
optional
(the factory still falls back to `FACEBOOK_*` env vars), and `logger` /
`userName` live on `MessengerAdapterConfig` directly. The factory
signature
is now `createMessengerAdapter(config?: MessengerAdapterConfig)`.
- `@chat-adapter/web`: renamed `WebAdapterOptions` to
`WebAdapterConfig`; the
        old name is exported as a deprecated alias.
- `@chat-adapter/whatsapp`: every field on `WhatsAppAdapterConfig` is
optional
(the factory still falls back to `WHATSAPP_*` env vars).
`createWhatsAppAdapter`
is now typed `(config?: WhatsAppAdapterConfig) => WhatsAppAdapter`.
- `@chat-adapter/state-memory`: added an empty
`MemoryStateAdapterOptions`
type so the package matches every other state adapter;
`createMemoryState`
        now accepts an optional argument of that type.
    -   `@chat-adapter/state-ioredis`, `@chat-adapter/state-redis`,
`@chat-adapter/state-pg`: the URL- and client-based option shapes were
split
        into named interfaces (`*StateAdapterUrlOptions` /
`*StateAdapterClientOptions`) and unified under `*StateAdapterOptions`.
The
factories now take the union type directly. Old names —
`RedisStateClientOptions`,
        `CreateRedisStateOptions`, `PostgresStateClientOptions`,
`CreatePostgresStateOptions`, `IoRedisStateClientOptions` — are kept as
        deprecated aliases.

- 0f0c203: fix(slack): prefer `webhookVerifier` over `signingSecret` and
`SLACK_SIGNING_SECRET`

When a `webhookVerifier` is configured, it now takes precedence over
both the
`signingSecret` config field and the `SLACK_SIGNING_SECRET` env var.
Previously,
    a configured `signingSecret` (or env var) would shadow the verifier.

-   Updated dependencies [ac8a207]

-   Updated dependencies [e60bc8c]

-   Updated dependencies [add2730]

-   Updated dependencies [b75eedb]
    -   chat@4.29.0
    -   @chat-adapter/shared@4.29.0

## @chat-adapter/teams@4.29.0

### Minor Changes

- 2ffed48: Adapter internals are now `protected` rather than `private`,
so consumers can subclass an adapter to override or extend its behavior
(e.g. handling additional Telegram update types by overriding
`processUpdate`).

### Patch Changes

-   e60bc8c: chore: set supported Node versions in engines
-   Updated dependencies [ac8a207]
-   Updated dependencies [e60bc8c]
-   Updated dependencies [add2730]
-   Updated dependencies [b75eedb]
    -   chat@4.29.0
    -   @chat-adapter/shared@4.29.0

## @chat-adapter/telegram@4.29.0

### Minor Changes

-   add2730: support typed Telegram attachment uploads
- 2ffed48: Adapter internals are now `protected` rather than `private`,
so consumers can subclass an adapter to override or extend its behavior
(e.g. handling additional Telegram update types by overriding
`processUpdate`).

### Patch Changes

-   e60bc8c: chore: set supported Node versions in engines
- 711babe: Handle `video_note` (round video messages) in
`extractAttachments`. Previously these messages were silently dropped;
now they are returned as `video` attachments with `width`/`height` set
to the clip's `length`.
-   Updated dependencies [ac8a207]
-   Updated dependencies [e60bc8c]
-   Updated dependencies [add2730]
-   Updated dependencies [b75eedb]
    -   chat@4.29.0
    -   @chat-adapter/shared@4.29.0

## @chat-adapter/web@4.29.0

### Minor Changes

- 2ffed48: Adapter internals are now `protected` rather than `private`,
so consumers can subclass an adapter to override or extend its behavior
(e.g. handling additional Telegram update types by overriding
`processUpdate`).
- 716e934: Add first-class Vue and Svelte support via new subpath
exports `@chat-adapter/web/vue` and `@chat-adapter/web/svelte`. Each
exports a `useChat()` factory preconfigured with `DefaultChatTransport`,
returning a framework-reactive `Chat` instance from `@ai-sdk/vue` /
`@ai-sdk/svelte` respectively. Note: unlike the React subpath which
wraps `@ai-sdk/react`'s `useChat` hook and returns destructurable
helpers, the Vue and Svelte wrappers return a `Chat` class instance —
access `chat.messages`, `chat.sendMessage()`, `chat.status`, and
`chat.stop()` directly on the object.

### Patch Changes

-   e60bc8c: chore: set supported Node versions in engines

- 06fb8e5: Align package shapes with the new `konsistent` conventions.
All changes are
backwards-compatible — previous type names are kept as deprecated
aliases.

- `@chat-adapter/gchat`, `@chat-adapter/slack`: moved `*AdapterConfig`
(and
related sub-types) into a `./types` module; the public re-exports from
        `index.ts` are unchanged.
- `@chat-adapter/slack`: `createSlackAdapter` now accepts
`SlackAdapterConfig`
directly instead of `Partial<SlackAdapterConfig>`. Every field on the
config
        was already optional, so no call sites need to change.
- `@chat-adapter/messenger`: `MessengerAdapterConfig` fields are now
optional
(the factory still falls back to `FACEBOOK_*` env vars), and `logger` /
`userName` live on `MessengerAdapterConfig` directly. The factory
signature
is now `createMessengerAdapter(config?: MessengerAdapterConfig)`.
- `@chat-adapter/web`: renamed `WebAdapterOptions` to
`WebAdapterConfig`; the
        old name is exported as a deprecated alias.
- `@chat-adapter/whatsapp`: every field on `WhatsAppAdapterConfig` is
optional
(the factory still falls back to `WHATSAPP_*` env vars).
`createWhatsAppAdapter`
is now typed `(config?: WhatsAppAdapterConfig) => WhatsAppAdapter`.
- `@chat-adapter/state-memory`: added an empty
`MemoryStateAdapterOptions`
type so the package matches every other state adapter;
`createMemoryState`
        now accepts an optional argument of that type.
    -   `@chat-adapter/state-ioredis`, `@chat-adapter/state-redis`,
`@chat-adapter/state-pg`: the URL- and client-based option shapes were
split
        into named interfaces (`*StateAdapterUrlOptions` /
`*StateAdapterClientOptions`) and unified under `*StateAdapterOptions`.
The
factories now take the union type directly. Old names —
`RedisStateClientOptions`,
        `CreateRedisStateOptions`, `PostgresStateClientOptions`,
`CreatePostgresStateOptions`, `IoRedisStateClientOptions` — are kept as
        deprecated aliases.

-   Updated dependencies [ac8a207]

-   Updated dependencies [e60bc8c]

-   Updated dependencies [add2730]

-   Updated dependencies [b75eedb]
    -   chat@4.29.0
    -   @chat-adapter/shared@4.29.0

## @chat-adapter/whatsapp@4.29.0

### Minor Changes

- 2ffed48: Adapter internals are now `protected` rather than `private`,
so consumers can subclass an adapter to override or extend its behavior
(e.g. handling additional Telegram update types by overriding
`processUpdate`).

### Patch Changes

-   e60bc8c: chore: set supported Node versions in engines

- 06fb8e5: Align package shapes with the new `konsistent` conventions.
All changes are
backwards-compatible — previous type names are kept as deprecated
aliases.

- `@chat-adapter/gchat`, `@chat-adapter/slack`: moved `*AdapterConfig`
(and
related sub-types) into a `./types` module; the public re-exports from
        `index.ts` are unchanged.
- `@chat-adapter/slack`: `createSlackAdapter` now accepts
`SlackAdapterConfig`
directly instead of `Partial<SlackAdapterConfig>`. Every field on the
config
        was already optional, so no call sites need to change.
- `@chat-adapter/messenger`: `MessengerAdapterConfig` fields are now
optional
(the factory still falls back to `FACEBOOK_*` env vars), and `logger` /
`userName` live on `MessengerAdapterConfig` directly. The factory
signature
is now `createMessengerAdapter(config?: MessengerAdapterConfig)`.
- `@chat-adapter/web`: renamed `WebAdapterOptions` to
`WebAdapterConfig`; the
        old name is exported as a deprecated alias.
- `@chat-adapter/whatsapp`: every field on `WhatsAppAdapterConfig` is
optional
(the factory still falls back to `WHATSAPP_*` env vars).
`createWhatsAppAdapter`
is now typed `(config?: WhatsAppAdapterConfig) => WhatsAppAdapter`.
- `@chat-adapter/state-memory`: added an empty
`MemoryStateAdapterOptions`
type so the package matches every other state adapter;
`createMemoryState`
        now accepts an optional argument of that type.
    -   `@chat-adapter/state-ioredis`, `@chat-adapter/state-redis`,
`@chat-adapter/state-pg`: the URL- and client-based option shapes were
split
        into named interfaces (`*StateAdapterUrlOptions` /
`*StateAdapterClientOptions`) and unified under `*StateAdapterOptions`.
The
factories now take the union type directly. Old names —
`RedisStateClientOptions`,
        `CreateRedisStateOptions`, `PostgresStateClientOptions`,
`CreatePostgresStateOptions`, `IoRedisStateClientOptions` — are kept as
        deprecated aliases.

-   Updated dependencies [ac8a207]

-   Updated dependencies [e60bc8c]

-   Updated dependencies [add2730]

-   Updated dependencies [b75eedb]
    -   chat@4.29.0
    -   @chat-adapter/shared@4.29.0

## chat@4.29.0

### Minor Changes

- ac8a207: Add `chat/ai` subpath as the home for AI utilities, including
`createChatTools` for the Vercel AI SDK and `toAiMessages` for
converting chat history into AI SDK prompts.

`createChatTools` exposes Chat SDK operations as ready-to-use AI SDK
tools so an agent can read messages, post replies, send DMs, react,
edit, delete, and manage thread subscriptions across every adapter the
supplied `Chat` instance has registered. Write operations require user
approval by default and can be toggled globally or per-tool via
`requireApproval`. Three presets (`reader`, `messenger`, `moderator`)
scope the toolset, and tools can also be cherry-picked from the same
subpath.

`toAiMessages` (and the `AiMessage` / `AiMessagePart` /
`ToAiMessagesOptions` types) now ship from `chat/ai` alongside the tools
— keeping the optional `ai` and `zod` peer dependencies out of bundles
that don't use them. The previous `chat` re-exports continue to work,
but are marked `@deprecated` so editors surface a hint pointing at
`chat/ai`; existing code keeps compiling, and migrating is a single
import-path change.

-   b75eedb: add burst concurrency strategy

### Patch Changes

-   e60bc8c: chore: set supported Node versions in engines

## @chat-adapter/state-ioredis@4.29.0

### Patch Changes

-   e60bc8c: chore: set supported Node versions in engines

- 06fb8e5: Align package shapes with the new `konsistent` conventions.
All changes are
backwards-compatible — previous type names are kept as deprecated
aliases.

- `@chat-adapter/gchat`, `@chat-adapter/slack`: moved `*AdapterConfig`
(and
related sub-types) into a `./types` module; the public re-exports from
        `index.ts` are unchanged.
- `@chat-adapter/slack`: `createSlackAdapter` now accepts
`SlackAdapterConfig`
directly instead of `Partial<SlackAdapterConfig>`. Every field on the
config
        was already optional, so no call sites need to change.
- `@chat-adapter/messenger`: `MessengerAdapterConfig` fields are now
optional
(the factory still falls back to `FACEBOOK_*` env vars), and `logger` /
`userName` live on `MessengerAdapterConfig` directly. The factory
signature
is now `createMessengerAdapter(config?: MessengerAdapterConfig)`.
- `@chat-adapter/web`: renamed `WebAdapterOptions` to
`WebAdapterConfig`; the
        old name is exported as a deprecated alias.
- `@chat-adapter/whatsapp`: every field on `WhatsAppAdapterConfig` is
optional
(the factory still falls back to `WHATSAPP_*` env vars).
`createWhatsAppAdapter`
is now typed `(config?: WhatsAppAdapterConfig) => WhatsAppAdapter`.
- `@chat-adapter/state-memory`: added an empty
`MemoryStateAdapterOptions`
type so the package matches every other state adapter;
`createMemoryState`
        now accepts an optional argument of that type.
    -   `@chat-adapter/state-ioredis`, `@chat-adapter/state-redis`,
`@chat-adapter/state-pg`: the URL- and client-based option shapes were
split
        into named interfaces (`*StateAdapterUrlOptions` /
`*StateAdapterClientOptions`) and unified under `*StateAdapterOptions`.
The
factories now take the union type directly. Old names —
`RedisStateClientOptions`,
        `CreateRedisStateOptions`, `PostgresStateClientOptions`,
`CreatePostgresStateOptions`, `IoRedisStateClientOptions` — are kept as
        deprecated aliases.

-   Updated dependencies [ac8a207]

-   Updated dependencies [e60bc8c]

-   Updated dependencies [b75eedb]
    -   chat@4.29.0

## @chat-adapter/state-memory@4.29.0

### Patch Changes

-   e60bc8c: chore: set supported Node versions in engines

- 06fb8e5: Align package shapes with the new `konsistent` conventions.
All changes are
backwards-compatible — previous type names are kept as deprecated
aliases.

- `@chat-adapter/gchat`, `@chat-adapter/slack`: moved `*AdapterConfig`
(and
related sub-types) into a `./types` module; the public re-exports from
        `index.ts` are unchanged.
- `@chat-adapter/slack`: `createSlackAdapter` now accepts
`SlackAdapterConfig`
directly instead of `Partial<SlackAdapterConfig>`. Every field on the
config
        was already optional, so no call sites need to change.
- `@chat-adapter/messenger`: `MessengerAdapterConfig` fields are now
optional
(the factory still falls back to `FACEBOOK_*` env vars), and `logger` /
`userName` live on `MessengerAdapterConfig` directly. The factory
signature
is now `createMessengerAdapter(config?: MessengerAdapterConfig)`.
- `@chat-adapter/web`: renamed `WebAdapterOptions` to
`WebAdapterConfig`; the
        old name is exported as a deprecated alias.
- `@chat-adapter/whatsapp`: every field on `WhatsAppAdapterConfig` is
optional
(the factory still falls back to `WHATSAPP_*` env vars).
`createWhatsAppAdapter`
is now typed `(config?: WhatsAppAdapterConfig) => WhatsAppAdapter`.
- `@chat-adapter/state-memory`: added an empty
`MemoryStateAdapterOptions`
type so the package matches every other state adapter;
`createMemoryState`
        now accepts an optional argument of that type.
    -   `@chat-adapter/state-ioredis`, `@chat-adapter/state-redis`,
`@chat-adapter/state-pg`: the URL- and client-based option shapes were
split
        into named interfaces (`*StateAdapterUrlOptions` /
`*StateAdapterClientOptions`) and unified under `*StateAdapterOptions`.
The
factories now take the union type directly. Old names —
`RedisStateClientOptions`,
        `CreateRedisStateOptions`, `PostgresStateClientOptions`,
`CreatePostgresStateOptions`, `IoRedisStateClientOptions` — are kept as
        deprecated aliases.

-   Updated dependencies [ac8a207]

-   Updated dependencies [e60bc8c]

-   Updated dependencies [b75eedb]
    -   chat@4.29.0

## @chat-adapter/state-pg@4.29.0

### Patch Changes

-   e60bc8c: chore: set supported Node versions in engines

- 06fb8e5: Align package shapes with the new `konsistent` conventions.
All changes are
backwards-compatible — previous type names are kept as deprecated
aliases.

- `@chat-adapter/gchat`, `@chat-adapter/slack`: moved `*AdapterConfig`
(and
related sub-types) into a `./types` module; the public re-exports from
        `index.ts` are unchanged.
- `@chat-adapter/slack`: `createSlackAdapter` now accepts
`SlackAdapterConfig`
directly instead of `Partial<SlackAdapterConfig>`. Every field on the
config
        was already optional, so no call sites need to change.
- `@chat-adapter/messenger`: `MessengerAdapterConfig` fields are now
optional
(the factory still falls back to `FACEBOOK_*` env vars), and `logger` /
`userName` live on `MessengerAdapterConfig` directly. The factory
signature
is now `createMessengerAdapter(config?: MessengerAdapterConfig)`.
- `@chat-adapter/web`: renamed `WebAdapterOptions` to
`WebAdapterConfig`; the
        old name is exported as a deprecated alias.
- `@chat-adapter/whatsapp`: every field on `WhatsAppAdapterConfig` is
optional
(the factory still falls back to `WHATSAPP_*` env vars).
`createWhatsAppAdapter`
is now typed `(config?: WhatsAppAdapterConfig) => WhatsAppAdapter`.
- `@chat-adapter/state-memory`: added an empty
`MemoryStateAdapterOptions`
type so the package matches every other state adapter;
`createMemoryState`
        now accepts an optional argument of that type.
    -   `@chat-adapter/state-ioredis`, `@chat-adapter/state-redis`,
`@chat-adapter/state-pg`: the URL- and client-based option shapes were
split
        into named interfaces (`*StateAdapterUrlOptions` /
`*StateAdapterClientOptions`) and unified under `*StateAdapterOptions`.
The
factories now take the union type directly. Old names —
`RedisStateClientOptions`,
        `CreateRedisStateOptions`, `PostgresStateClientOptions`,
`CreatePostgresStateOptions`, `IoRedisStateClientOptions` — are kept as
        deprecated aliases.

-   Updated dependencies [ac8a207]

-   Updated dependencies [e60bc8c]

-   Updated dependencies [b75eedb]
    -   chat@4.29.0

## @chat-adapter/state-redis@4.29.0

### Patch Changes

-   e60bc8c: chore: set supported Node versions in engines

- 06fb8e5: Align package shapes with the new `konsistent` conventions.
All changes are
backwards-compatible — previous type names are kept as deprecated
aliases.

- `@chat-adapter/gchat`, `@chat-adapter/slack`: moved `*AdapterConfig`
(and
related sub-types) into a `./types` module; the public re-exports from
        `index.ts` are unchanged.
- `@chat-adapter/slack`: `createSlackAdapter` now accepts
`SlackAdapterConfig`
directly instead of `Partial<SlackAdapterConfig>`. Every field on the
config
        was already optional, so no call sites need to change.
- `@chat-adapter/messenger`: `MessengerAdapterConfig` fields are now
optional
(the factory still falls back to `FACEBOOK_*` env vars), and `logger` /
`userName` live on `MessengerAdapterConfig` directly. The factory
signature
is now `createMessengerAdapter(config?: MessengerAdapterConfig)`.
- `@chat-adapter/web`: renamed `WebAdapterOptions` to
`WebAdapterConfig`; the
        old name is exported as a deprecated alias.
- `@chat-adapter/whatsapp`: every field on `WhatsAppAdapterConfig` is
optional
(the factory still falls back to `WHATSAPP_*` env vars).
`createWhatsAppAdapter`
is now typed `(config?: WhatsAppAdapterConfig) => WhatsAppAdapter`.
- `@chat-adapter/state-memory`: added an empty
`MemoryStateAdapterOptions`
type so the package matches every other state adapter;
`createMemoryState`
        now accepts an optional argument of that type.
    -   `@chat-adapter/state-ioredis`, `@chat-adapter/state-redis`,
`@chat-adapter/state-pg`: the URL- and client-based option shapes were
split
        into named interfaces (`*StateAdapterUrlOptions` /
`*StateAdapterClientOptions`) and unified under `*StateAdapterOptions`.
The
factories now take the union type directly. Old names —
`RedisStateClientOptions`,
        `CreateRedisStateOptions`, `PostgresStateClientOptions`,
`CreatePostgresStateOptions`, `IoRedisStateClientOptions` — are kept as
        deprecated aliases.

-   Updated dependencies [ac8a207]

-   Updated dependencies [e60bc8c]

-   Updated dependencies [b75eedb]
    -   chat@4.29.0

## @chat-adapter/tests@4.29.0

### Patch Changes

- 0adf3ad: Add `@chat-adapter/tests` — Vitest factories, matchers, and
setup utilities for Chat SDK adapter and bot authors.

- **Factories**: `createMockAdapter`, `createMockChatInstance`,
`createMockState` (with working in-memory
subscriptions/locks/KV/queues), `createTestMessage`,
`mockLogger`/`createMockLogger`.
- **Matchers**: `toHavePosted(threadId, textPattern?)`,
`toHaveDispatched(handler)`, `toBeSubscribedTo(threadId)`.
- **Setup file**: `@chat-adapter/tests/setup` registers all matchers via
`expect.extend` — drop into `vitest.config.ts` `setupFiles`.

`chat` and `vitest` are peer dependencies. Adapter-specific helpers
(e.g. signed Slack webhook builders) belong in each adapter's own
`/testing` subpath, not in this kit.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-05-18 07:16:55 -07:00
Ben Sabic ac8a20779c feat(chat): add chat/ai subpath for AI SDK utilities (#492)
## Summary

Introduces a dedicated `chat/ai` subpath as the home for every Vercel AI
SDK helper that ships with Chat SDK. Importing from this subpath keeps
the optional `ai` and `zod` peer dependencies out of bundles that don't
use them.

### What's new

- **`createChatTools`** — exposes Chat SDK operations as ready-to-use AI
SDK tools so an agent can read, post, react, edit, delete, and manage
thread subscriptions across every adapter the supplied `Chat` instance
has registered.
- Write operations require user approval by default (`requireApproval:
true`); toggle globally or per-tool.
- Three presets — `reader`, `messenger`, `moderator` — scope the
toolset.
- Individual tools can also be cherry-picked (`import { postMessage,
addReaction } from "chat/ai"`).
- **`toAiMessages`** (and the `Ai*` / `ToAiMessagesOptions` types) now
live alongside the tools at `chat/ai`. The previous `chat` re-exports
continue to work, but are flagged `@deprecated` with an editor hint
pointing to the new home — migration is a one-line import change.
- **Docs** — new `/docs/ai` section between Usage and Adapters in the
sidebar:
  - `/docs/ai` — Overview
  - `/docs/ai/ai-sdk-tools` — `createChatTools` guide
  - `/docs/ai/to-ai-messages` — `toAiMessages` reference
  - `/docs/ai/types` — Reference for every type exported from `chat/ai`
- **Example app** — `examples/nextjs-chat` now demos the new surface via
a "Run Agent Demo" button on the welcome card and a free-form `/agent
<prompt>` slash command (streaming, with a placeholder so users get
immediate feedback in channel contexts where Slack's typing-status API
is a no-op).

### Future plans

`createChatTools` currently exposes the cross-adapter Chat SDK surface
only. A natural follow-up is to also support **platform-specific tools**
— e.g. expose Slack-only `pin`/`unpin`, Discord-only thread archiving,
GitHub-only issue commenting, etc., so users can further extend what
their agent can do without dropping back to raw adapter calls. The shape
would likely be additional opt-in factories under `chat/ai` (or
per-adapter subpaths like `@chat-adapter/slack/ai`) that return tools
layered on top of the platform-specific adapter clients, while keeping
the cross-platform `createChatTools` API as the lowest common
denominator.

### Coverage

- `createChatTools` orchestrator: 100% statements / 94.7% branches.
- Every tool factory's `execute()` is exercised end-to-end (29 tests in
`index.test.ts`).
- `toAiMessages` keeps its existing 35-test suite covering role mapping,
attachment handling, links, transforms, and unsupported-attachment
fallbacks.
- Tools folder overall: 99.0% statements / 86.1% branches / 97.4%
functions / 98.9% lines.

---------

Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
Co-authored-by: dancer <josh@afterima.ge>
2026-05-14 20:13:42 -07:00
josh b75eedbb5f feat(chat): add queue-debounce concurrency strategy (#495)
## summary

adds an opt-in `burst` concurrency strategy for #414

when a thread is idle, the first message waits for `debounceMs`,
messages that arrive during that window are queued, and the handler runs
once with the latest message plus earlier burst messages in
`context.skipped`

after the handler finishes, messages that arrived while it was running
are drained like `queue`, so the latest queued message is processed with
earlier queued messages in `context.skipped`

keeps existing `drop`, `queue`, `debounce`, and `concurrent` behavior
unchanged

updates docs to cover `burst`, explain when to choose it over
`debounce`, and document the related `MessageContext` behavior
2026-05-14 19:18:40 -07:00
josh 67c1794a54 docs(chat): clarify direct message routing precedence (#491)
## summary

clarifies that registered `onDirectMessage` handlers take precedence for
incoming DM messages before subscribed-message, mention, and pattern
routing

updates the direct messages, event handling, thread subscription, and
API docs so they match the current runtime behavior

adds `onDirectMessage` to the Chat API docs

fixes #432
2026-05-12 15:14:57 +10:00
Felix Arntz e60bc8c408 chore: add .nvmrc file, formally specify Node version range support, and cover more versions in CI (#465)
* add .nvmrc file

* follow up

* make support of Node >= 20 explicit

* update default Node version for contributing to the repo to 24

* run build-and-test CI job for both Node 20 and 24

* add changeset for package.json change
2026-05-11 19:28:34 +10:00
github-actions[bot] 5edcbbf7ef chore(release): version packages (#464)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-05-08 04:09:48 -07:00
github-actions[bot] b3fc64d34e chore(release): version packages (#442)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-05-08 04:01:03 -07:00
josh 0cc3d06fd4 docs: fix stale API examples, adapter matrix, and broken links (#463)
* 1

* 2

* cs

* 3
2026-05-08 03:58:08 -07:00
josh c1cd9b5da1 feat(chat): add callbackUrl to buttons and modals (#454)
* 1

* wfw

* 4224

* dfe

* wip

* f

* 22

* tsts

* more

* ch

* dc

* t

* tm

* docs

* ex

* k

* cs

* lock

* test(chat): expand callbackUrl coverage

* docs: document callbackUrl handling for adapter authors

* docs: expand changeset for callbackUrl feature

* docs(skill): mention callbackUrl on Button and Modal

* feat(example): add modal callbackUrl workflow demo

* test(integration): add replay tests for callbackUrl flows

---------

Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
2026-05-08 17:26:18 +10:00