* fix(slack): enrich link previews with unfurl metadata from attachments
* fix(slack): add trailing slash normalization for unfurl URL matching
* fix(slack): store unfurl metadata from message_changed and enrich subsequent messages
* fix(slack): poll for unfurls so link metadata survives the message_changed race
* [chat] fix Slack streaming team ID for interactive payloads
* chore: downgrade changeset to patch
---------
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
* feat(adapter-teams): use native Teams SDK streaming for DMs
Use ctx.stream.emit() from the Teams SDK for DM streaming instead of
manual post+edit. This sends proper typing activities with streamType
channelData, giving the native streaming UI in Teams.
- Capture IStreamer from activity context in handleMessageActivity
- Block handler with deferred promise so stream stays alive during processing
- streamViaEmit() for DMs: uses stream.emit() with incremental text deltas
- Group chats: accumulate full response and post as single message (no flicker)
- Handle StreamCancelledError and stream.canceled for graceful cancellation
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(tests): update Teams streaming assertions for accumulate-and-post
Group chats now accumulate streamed chunks and post as a single message
instead of post+edit, so assertions should check sentActivities not
updatedActivities.
* style: format replay-streaming test
* chore: add changeset for teams native streaming
---------
* docs(adapter-teams): simplify bot setup using Teams CLI
Replace manual 6-step Azure portal walkthrough with Teams CLI commands.
`teams app create` handles AAD registration, secret generation, bot
registration, and channel setup in a single command. Also updates RSC
permission and troubleshooting sections to reference CLI equivalents.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs(adapter-teams): remove bot migration section
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs(adapter-teams): clarify message history permissions by context
RSC permissions cover channels and group chats (no admin consent).
Azure AD Chat.Read.All is only needed for DM history. Add permission
table and az CLI commands for DM setup.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs(adapter-teams): simplify bot setup using Teams CLI
Replace manual 6-step Azure portal walkthrough with Teams CLI commands.
Correct message history permissions: RSC for channels/group chats,
Azure AD only for DM history. Add local dev tunnel tip.
* docs(adapter-teams): add teams status step after login
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: add chat.getUser() for cross-platform user lookups
Add UserInfo type and optional getUser() method to the Adapter interface.
Implement on Slack (extends existing lookupUser with email/avatar),
Discord, Google Chat, GitHub, Linear, and Telegram adapters.
Add "Who Am I" button to the example app demonstrating the feature.
Update docs with getUser API reference and usage examples.
* fix(chat): improve getUser across slack and gchat adapters
- slack: return null from lookupUser on failure instead of fallback
object, removing the isBot === undefined sentinel in getUser
- slack: use image_192 instead of image_72 for better avatar quality
- gchat: cache avatarUrl from webhook sender payload
- gchat: return avatarUrl in getUser response
- gchat: fix tests to use current cache format with isBot field
- docs: document null return, fix example to use message.author
* chore: fix lint
* docs(chat): include Microsoft Teams in getUser supported adapters list
* feat(adapter-teams): add getUser() support (#404)
* feat(adapter-teams): add getUser() via Microsoft Graph API
- Cache aadObjectId from activity.from during webhook handling
- Implement getUser() using Graph GET /users/{user-id} endpoint
- Requires User.Read.All application permission
- Returns null gracefully when user hasn't interacted or Graph call fails
* docs: add getUser() section to Teams adapter README
* chore: apply ultracite formatting to adapter-teams getUser
* fix(chat): cover all 7 adapters in getUser inference and document per-platform constraints
---------
Co-authored-by: dancer <josh@afterima.ge>
* feat(chat): add initialOption and option_groups to ExternalSelect
* docs(modals): document ExternalSelect initialOption and option_groups, truncate group label to 75 chars
* docs(state-pg): disclose chat_state_lists and chat_state_queues tables
The Data model section in the @chat-adapter/state-pg README listed only
three tables, but ensureSchema() also creates chat_state_lists and
chat_state_queues. Add them so the docs accurately describe what the
adapter writes to the database.
Closes#428
* docs(state-pg): document expired row cleanup for lists and queues
Extend the "Expired row cleanup" section to cover chat_state_lists and
chat_state_queues — both have expires_at columns. Note that queue
entries are purged opportunistically per-thread on enqueue/dequeue, and
list entries are filtered on read but never deleted, then add both
tables to the suggested periodic cleanup SQL.
---------
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
* ci(release): pin changesets/action and enable npm provenance
Pin changesets/action to the v1.7.0 commit SHA, switch to GitHub-API
commit mode (signed commits via the API), set the version PR commit
and title to a conventional "chore(release): version packages", and
enable npm provenance attestations on publish via NPM_CONFIG_PROVENANCE.
* chore: add CODEOWNERS
Default ownership goes to @vercel/chat-sdk; release-plumbing paths
(release workflow, changeset config, CODEOWNERS itself) stay locked
to @cramforce since the publish workflow is bound to npm Trusted
Publisher by filename.
* docs: add SUPPORT.md and tidy issue contact links
Add a SUPPORT.md pointing users to docs, the issue chooser, and the
security advisory flow. Also update .github/config.yml: point the
Documentation contact link at chat-sdk.dev/docs (was a github.com
README anchor) and remove the GitHub Discussions entry, which 404s
because Discussions isn't enabled on the repo.
* chore: add docs issue and adapter request templates
Two new issue templates so reports come in pre-shaped:
- Documentation Issue — page/section, type (typo, outdated, missing,
broken link, etc.), description, suggested fix.
- Adapter Request — platform name, adapter type (platform/state), API
docs link, use case, existing community work, willingness to help
maintain.
* docs(contributing): point contributors at issue templates and SUPPORT.md
Add a "Reporting issues" section at the top of CONTRIBUTING.md that
links to the issue chooser (now covering bugs, features, docs issues,
and adapter requests) and to SUPPORT.md for general questions, with
the SECURITY.md private-disclosure path called out separately.
* chore: add pre-merge checklist to PR template
Adds four self-attestation boxes contributors can tick before
requesting review, surfacing requirements that already live in
CONTRIBUTING.md so they're not forgotten:
- Signed and verified commits (CONTRIBUTING explicitly bounces PRs
with unsigned commits).
- `pnpm validate` passes (lint, typecheck, tests, build in one go).
- Changeset added when a package's behavior changes.
- Docs updated for user-facing changes.
The "or N/A" wording on the last two avoids forcing a yes for
internal-only or docs-only PRs.
* chore: add Telegram and WhatsApp to bug report platform dropdown
The bug report platform dropdown was missing Telegram and WhatsApp,
which both have official adapters (@chat-adapter/telegram and
@chat-adapter/whatsapp). Reporters had to fall back to "Other" for
bugs in those adapters, losing the platform signal.
* docs(readme): fix CONTRIBUTING link path and add Support section
The Contributing section linked to ./CONTRIBUTING.md, but the file
actually lives at .github/CONTRIBUTING.md, so the link 404'd on
github.com. Repoint it.
Also add a Support section linking SUPPORT.md (general help) and
SECURITY.md (private vulnerability reporting) so those community
health files are reachable from the repo entry point instead of
only via GitHub's auto-surfacing.
* docs(contributing): add adapter authoring, commit conventions, and docs sections
Three additions to CONTRIBUTING.md to round out the file alongside
the recently added issue templates and PR checklist:
- "Building your own adapter" — points contributors who hit the
Adapter Request template at the existing community-adapter guide
on chat-sdk.dev rather than leaving them to discover it.
- "Commit messages" — codifies the Conventional Commits style the
repo already uses; the release workflow now relies on the
"chore(release): version packages" convention for its auto-PR,
so consistency in new commits keeps changelogs predictable.
- "Updating documentation" — names the apps/docs/content/docs/
source path, links the live site, and shows the local preview
command so the PR-template "Documentation updated" checkbox is
actionable.
* docs: trim agent docs, rename CLAUDE.md to AGENTS.md, add CLAUDE.md pointer
Move the agent guidance to AGENTS.md (the cross-tool convention) and
leave CLAUDE.md as a one-line "@AGENTS.md" pointer so Claude Code
keeps auto-loading the same content.
While renaming, trim and update the file:
- "packages/chat-sdk" was wrong — directory is "packages/chat", npm
name is "chat".
- Updated the package list to include adapter-{discord,telegram,
github,linear,zoom,shared}, state-{ioredis,pg}, integration-tests,
and the apps/docs and examples/nextjs-chat trees.
- Replaced the verbose recording-and-replay jq walkthrough with a
one-line pointer to the integration-tests README.
- Dropped the duplicated Changesets walkthrough — full guidance now
lives in CONTRIBUTING.md.
- Condensed ~120 lines of generic Ultracite/Biome rules to a short
list of non-obvious gotchas (Biome enforces the rest automatically).
- Added Conventional Commits (load-bearing for the release workflow's
auto-PR), the apps/docs/content/docs/ docs path with the "pnpm
--filter docs dev" preview command, a pointer to the community
health files, and POSTGRES_URL/DATABASE_URL for the new state-pg
adapter.
Net: 344 → ~125 lines.
* docs(nav): rename "Source" link to "GitHub"
---------
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
- Add scripts/sync-resources.ts (run via pnpm sync-resources) that reads apps/docs/resources-edge-config.json, fetches each guide's .md version over https with a timeout and size cap, writes templates.json, and regenerates the Available resources block in skills/chat/SKILL.md
- Migrate the Slack Next.js, Discord Nuxt, and Hono code-review guides from on-site MDX to Vercel KB and register them in the resources edge-config JSON alongside the existing external guides
- Remove /docs/guides MDX content, sidebar entries, top-level Guides nav entry, getting-started cards, and the dead /guides/ branch in the sitemap route now that all guides live externally and are surfaced on /resources
- Replace the homepage Guides/Templates section and the standalone Adapters pill section with a single two-column Resources + Adapters section (icons, headings, descriptions, outline buttons, divider), and drop the URL footer from ResourceCard on the Resources page
- Update skills/chat/SKILL.md to point at resources/guides and resources/templates.json and list the available guides and templates between marker comments that sync-resources rewrites
- Add tsx to knip's ignoreBinaries so npx tsx in the new script does not fail lint
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
Co-authored-by: dancer <josh@afterima.ge>
* feat(slack): dynamic botToken resolver and custom webhookVerifier
Allow `botToken` to be a function returning `string | Promise<string>`
so apps can rotate or lazily fetch tokens; the resolver is invoked per
API call. Add `webhookVerifier: (request) => string | Promise<string>`
as an alternative to `signingSecret` for custom request verification —
returns the verified body text or throws to produce a 401.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* change verifier signature to make it compatible with function
* make scheduleMessage cancel() rotation-safe and honor verifier body
- scheduleMessage cancel(): re-resolve token in single-workspace mode so
rotation works. Slack rotated tokens have a 12h TTL and scheduled messages
can outlive their schedule-time token, leaving cancel() with stale auth.
Multi-workspace still snapshots ctx.token since cancel() runs outside
the AsyncLocalStorage frame.
- webhookVerifier: when it returns a string, use it as the verified body
for downstream parsing. JSDoc previously implied this contract; the code
only checked truthiness.
- webhookVerifier JSDoc: explicit SECURITY note that timestamp/replay
protection is the implementer's responsibility when bypassing signingSecret.
- Tests: cover Attachment.fetchData snapshot semantics — multi-workspace
uses the ctx token captured at attachment creation; single-workspace
re-resolves the default provider per fetch (rotation-safe).
* docs(slack): document botToken resolver and webhookVerifier in README
* opt out of SLACK_SIGNING_SECRET env fallback when webhookVerifier is set
A webhookVerifier passed in config was being silently shadowed by
SLACK_SIGNING_SECRET in the env (read by both createSlackAdapter and the
SlackAdapter constructor). An explicit verifier now opts out of that
fallback in both code paths. Added a regression test that stubs the env
var via vi.stubEnv.
* register handleReactionEvent's outer promise via waitUntil
handleReactionEvent does async work (conversations.replies, users.info)
before delegating to chat.processReaction, which is the only point that
registers a waitUntil task. The outer prep work was untracked, so callers
that drained waitUntil tasks could complete before the reaction handler
finished — flaky in CI under tight microtask scheduling. Track the outer
promise too so the full handler is awaited.
* fix(integration-tests): drain waitUntil cascade in test tracker
---------
Co-authored-by: dancer <josh@afterima.ge>
Restructures the docs homepage around the AI SDK section flow: hero
with command prompt + interactive demo, OSS stats grid, supported
platforms with feature pillars, Chat SDK Core code showcase, "Scale
with confidence" Vercel ecosystem integrations, and a closing
get-started section with three guides.
- New: oss-stats-section, supported-platforms, code-section,
integrations-section, get-started-section.
- Removed unused layout helpers: adapters-section, centered-section,
cta, one-two-section, text-grid-section, templates (folded into
get-started-section).
- Hero loses the badge and embeds the existing Demo as the
hero-interactive piece.
- Three guide cards link to the Slack agent guide, Knowledge Agent
template, and GitHub code review bot guide.
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
- Detect when files under packages/** have changed and skip the check otherwise
- Exclude markdown-only changes from triggering the check
- Run pnpm changeset status against the PR base branch to fail when a changeset is missing
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
Closes#417.
- handleConcurrent now acquires a per-thread semaphore slot when
maxConcurrent is finite; fast path preserved for the default Infinity.
- Constructor throws on maxConcurrent < 1 (would deadlock) and warns
when maxConcurrent is paired with a non-concurrent strategy (was
previously ignored silently).
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
* Bump Teams SDK to 2.0.8 and switch to User-Agent header
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(teams): remove unused ts-expect-error after SDK 2.0.8 upgrade
---------
Co-authored-by: dancer <josh@afterima.ge>
* fix(telegram): switch parse_mode from legacy Markdown to MarkdownV2
The Telegram adapter hardcoded `parse_mode: "Markdown"` (legacy) but
rendered messages via the SDK's generic `stringifyMarkdown()`, which
emits standard markdown. Two incompatible dialects glued together:
- Standard markdown uses `**bold**`, Telegram legacy uses `*bold*`
- Legacy Markdown has no escape rules — any message with `.`, `!`,
`(`, `)`, `-`, `_` in unexpected positions was rejected with
`can't parse entities`, which is virtually every LLM-generated
response
- Legacy Markdown is deprecated by Telegram and lacks support for
underline, strikethrough, spoiler, and blockquote
This commit:
- Switches TELEGRAM_MARKDOWN_PARSE_MODE to "MarkdownV2"
- Replaces fromAst() with a proper AST → MarkdownV2 renderer:
- Single `*bold*`, `_italic_`, `~strike~` markers
- Context-aware escaping: 20-char matrix for normal text, only
`` ` `` and `\` inside code blocks, only `)` and `\` inside link
URLs
- Headings rendered as bold (MarkdownV2 has no heading syntax)
- Ordered/unordered lists with escaped dashes and periods
- Blockquotes with per-line `>` prefix
- Tables pre-empted and rendered as ASCII code blocks
- Explicit handlers for reference-style links, images, HTML, and
definitions so nothing is silently dropped
- Routes card fallback text through `fromMarkdown` (not raw escape)
with `boldFormat: "**"` — @chat-adapter/shared's cardToFallbackText
defaults `boldFormat` to "*" (Slack mrkdwn), which would render as
italic on Telegram. Explicit "**" keeps the card title rendered as
real MarkdownV2 bold.
- Fixes resolveParseMode so every message routed through the format
converter (`{markdown}`, `{ast}`, cards, JSX) gets
`parse_mode: "MarkdownV2"`. Previously only `{markdown}` and cards
were covered, so `{ast}` messages shipped without parse_mode and
rendered asterisks literally.
- Documents inbound vs outbound dialects on applyTelegramEntities /
escapeMarkdownInEntity (inbound entities → standard markdown)
versus the new outbound MarkdownV2 renderer, so future
contributors don't confuse the two.
Tests: full 20-char MarkdownV2 escape matrix, context-escape tests
for code blocks and link URLs, nested-formatting tests, edge cases
(empty, whitespace-only, raw HTML), and an end-to-end LLM-output
corpus test that asserts MarkdownV2 validity (no unescaped special
chars outside entities or code blocks). Regression guards added in
index.test.ts for the AST / plain-string / raw parse_mode paths and
for card-title MarkdownV2 bold rendering.
Fixes#226
* feat(examples): add telegram-chat reference bot
Polling-mode Telegram bot that exercises the adapter end-to-end:
MarkdownV2 rendering, interactive cards with inline keyboards,
reactions, file uploads, and streaming edits. Runs with a single
`pnpm --filter example-telegram-chat start`; no webhook, no public
URL, no external API keys.
Menu structure — three categorized sub-menus reached from any DM text:
- Text & Markdown: plain, inline emphasis, code block, links, list+table,
20-char torture string, LLM-style corpus, streaming editMessage loop
- Cards & Actions: interactive approval card (edits in-place on press),
callback_data size probe demonstrating the 64-byte limit, LinkButton
- Media & Reactions: on-demand reaction one-shot (briefly subscribes),
generated 1×1 PNG upload, generated minimal PDF upload
Zero new runtime deps. PNG/PDF are hand-rolled in memory
(lib/png.ts, lib/pdf.ts) rather than pulled from a binary-processing
library. Failure handling is consistent: every demo runner is
try/catch-wrapped and posts an inline ❌ line with the error message.
Excluded from npm release via .changeset/config.json.
* fix(telegram): produce valid MarkdownV2 when truncating long messages
The MarkdownV2 migration widened a latent truncation bug into a reliable
400. The previous truncator sliced at 4096/1024 chars and appended
literal "..." — but in MarkdownV2 `.` is a reserved character, the slice
can leave an orphan trailing `\`, and it can cut through a paired
entity (`*bold*`, `` `code` ``) leaving it unclosed.
Unify the two truncate methods into one `truncateForTelegram(text,
limit, parseMode)` that appends `\.\.\.` for MarkdownV2 and walks back
past unbalanced entity delimiters or orphan backslashes. Plain text
keeps literal `...`. Adds 8 length-limit tests.
Related cleanup:
- Move MarkdownV2 string utilities and Bot API limits to markdown.ts.
- Type renderMarkdownV2 exhaustively on mdast's `Nodes` union with a
`never` assertion so new node kinds fail the build. Replaces the
hand-rolled `AstNode` interface. Adds explicit cases for table /
tableRow / tableCell (throw — preprocessed by fromAst),
footnoteDefinition, footnoteReference, yaml.
- Introduce `TelegramParseMode = "MarkdownV2" | "plain"` replacing
`string | undefined`. `toBotApiParseMode` handles the wire mapping.
- Re-export `Nodes` from the chat package; re-export
`TelegramReactionType` from the adapter entry.
* feat(examples): add length-limit demos to telegram-chat reference bot
Three new menu entries exercise the MarkdownV2 truncation path that the
prior commit fixed:
- Long (5000 plain) — basic truncation, verifies escaped `\.\.\.` ellipsis
- Long (bold crosses 4096) — entity-balancing heuristic for unclosed `*`
- Long (code crosses 4096) — entity-balancing heuristic for unclosed `` ` ``
Each button posts a message whose rendered length exceeds Telegram's
4096-char limit and would have produced `can't parse entities` 400s
against the previous truncator. Serves as an interactive smoke test
alongside the unit tests in packages/adapter-telegram.
* test(telegram): add unit tests for truncation helpers and MarkdownV2 boundary trimming
* docs(telegram): update README to reflect MarkdownV2 parse mode
* chore: unexport trimToMarkdownV2SafeBoundary to fix knip
---------
Co-authored-by: dancer <josh@afterima.ge>
* fix(adapter-teams): resolve DM conversation IDs for Graph API fetchMessages
DM conversation IDs from Bot Framework are opaque and don't work with
Graph's /chats/{chat-id}/messages endpoint. Cache the user's AAD object
ID from incoming activities and construct the correct Graph chat ID
(19:{aadId}_{botId}@unq.gbl.spaces) via a new TeamsGraphContext union.
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(adapter-teams): simplify graph context branching
Remove redundant type checks — DMs never have threadMessageId so the
channel guard doesn't need an explicit DM exclusion.
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
* Add slack/socket mode dependency
* Update config types and SlackAdapter class
* Add socket mode methods, extract interactive dispatch
* Update createSlackAdapter factory function
* Write tests for socket mode
* Create slack-socket-mode.md
* Run fix
* Fix polynomial regex issues
* Fix: Floating promises in `routeSocketEvent` for slash commands and interactive payloads can cause unhandled promise rejections that crash the Node.js process.
This commit fixes the issue reported at packages/adapter-slack/src/index.ts:1152
**Bug Analysis:**
In `routeSocketEvent` (line 1150), which is a synchronous `void` method, two async operations produce floating promises:
1. `this.handleSlashCommand(params)` (line 1165) - `handleSlashCommand` is `async` and always returns a `Promise<Response>`. It calls `await this.lookupUser(userId)` which internally calls `await this.chat.getState().get()` (before the try/catch around the API call), and `this.chat.processSlashCommand()`. Any of these could throw.
2. `this.dispatchInteractivePayload(payload)` (line 1172) - Returns `Response | Promise<Response>`. When the payload type is `view_submission`, it delegates to `async handleViewSubmission()`, which calls `await this.chat.processModalSubmit()` and accesses `payload.view.state.values` (which could throw on malformed payloads).
Since `routeSocketEvent` is synchronous (`void` return type) and called from a sync context within the socket mode event handler (after `await ack()` has already completed), these returned promises are fire-and-forget. If any reject, it triggers an unhandled promise rejection, which in Node.js 15+ terminates the process by default.
In contrast, in the webhook code path (`handleWebhook`), these same methods are always `return`-ed from async functions, so their promises are properly chained to the caller.
**Fix:**
Added `.catch()` handlers to both floating promises:
1. For `handleSlashCommand`: Added `.catch()` that logs the error via `this.logger.error`.
2. For `dispatchInteractivePayload`: Since it returns `Response | Promise<Response>` (only a Promise for `view_submission`), used `instanceof Promise` to conditionally attach a `.catch()` handler only when the result is a Promise.
This approach was chosen over making `routeSocketEvent` async because: (a) it doesn't change the method signature, (b) the caller doesn't need to await it (the ack has already been sent), and (c) errors are logged rather than silently swallowed.
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: haydenbleasel <hello@haydenbleasel.com>
* Add socket mode forwarding support to Slack adapter
- Export SlackForwardedSocketEvent type
- Add x-slack-socket-token check at top of handleWebhook() for forwarded events
- Update routeSocketEvent() to accept WebhookOptions and use waitUntil
- Add startSocketModeListener(), runSocketModeListener(), forwardSocketEvent()
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add tests for socket mode forwarding
- Forwarded event accepted/rejected based on appToken
- Bypasses signature verification for forwarded events
- Options passthrough to handlers
- startSocketModeListener returns 200/500 appropriately
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add socket mode cron route and vercel config
- New /api/slack/socket-mode route using createPersistentListener
- Mirrors Discord gateway pattern (CRON_SECRET auth, Redis coordination)
- Cron runs every 9 min, listener duration 10 min
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix signingSecret defaulting to empty string in socket mode
Make signingSecret optional (string | undefined) instead of falling
back to "". verifySignature now returns false when no secret is
configured, preventing HMAC with an empty key from silently passing.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Wrap event_callback in try-catch in routeSocketEvent
Sync errors from processEventPayload were silently dropped in
socket mode. Wrap with try-catch for parity with slash_commands
and interactive cases.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Use dedicated socketForwardingSecret for forwarding auth
Stop using the Slack app-level token (xapp-...) as the bearer token
for HTTP forwarding. Adds socketForwardingSecret config option
(auto-detected from SLACK_SOCKET_FORWARDING_SECRET) with fallback
to appToken for backwards compatibility.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Replace double cast with type guard for socket event body
Validate body.event exists and construct a properly typed
SlackWebhookPayload instead of using `as unknown as`.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Internalize SlackForwardedSocketEvent type
Remove export — only used internally by the forwarding mechanism.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix formatting in socketForwardingSecret check
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add socket mode documentation to Slack adapter README
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(slack): use SDK envelope type for socket mode event routing
* fix(slack): pass interactive response through ack in socket mode
* feat(chat): add clear modal response action to close entire view stack
* chore: update changeset for clear modal action
---------
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: dancer <josh@afterima.ge>
* docs: sync geistdocs template 1.2.0–1.2.3 + polish
- Ran @vercel/geistdocs@1.2.2 update --sync against origin/main
(already contains merged 1.2.3) for:
- components/geistdocs/*
- components/geistcn-fallbacks/**/* (new)
- components/ui/command-prompt.tsx, navigation-menu.tsx
- app/styles/geistdocs.css
- Manual overlays (paths skipped by sync due to chat customizations):
- app/[lang]/layout.tsx: drop scroll-smooth (1.2.2)
- app/[lang]/docs/[[...slug]]/page.tsx: MobileDocsBar + disable
default TOC popover (1.2.0)
- app/[lang]/docs/layout.tsx: wrap in bg-background-200 (1.2.3)
- components/ui/badge.tsx: secondary variant → bg-gray-300/text-gray-1000 (1.2.3)
- Home hero: replace Get Started + Installer with CommandPrompt
humans/agents switcher ("npm install chat" / "npx skills add vercel/chat")
- (home) layout: swap bg-sidebar dark:bg-background for bg-background-200
so /, /adapters, /resources share the navbar surface
- DesktopMenu: active-state detection with longest-prefix match
(so /docs/api highlights "API", not also "Docs")
- navbar-logo dropdown: drop Chat SDK self-entry
- New geist-fill icons (check-circle-fill, cross-circle-fill,
warning-fill) ported from @vercel/geistcn-assets; new
components/custom/status-icons.tsx registers Check/Cross/Warn MDX
components
- content/docs/adapters.mdx: replace ✅/❌/⚠️ emojis with the new
icons (emoji.mdx intentionally left alone)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs: use LogoChatSdk from geistcn-fallbacks as the app Logo
Replace the inline Chat SDK wordmark SVG in geistdocs.tsx with
<LogoChatSdk /> so the navbar and other Logo consumers share the
same source of truth.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs: default hero CommandPrompt to humans tab
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Resolves#246
* Add card test coverage for postMessage/editMessage and changeset
* fix(discord): clear content on edit to prevent text persisting alongside card
* test(discord): add card content edge case tests
---------
Co-authored-by: dancer <josh@afterima.ge>
* fix(slack): guard Slack API calls against empty threadTs to fix invalid_thread_ts
Preserve the intentional empty threadTs for top-level DMs (added in #39
for openDM() subscription matching) while preventing Slack API errors.
Instead of changing the threadTs logic, normalize empty threadTs to
undefined at the entry of each method that calls Slack APIs (postMessage,
postEphemeral, scheduleMessage, stream). This way:
- openDM() subscription matching continues to work (empty threadTs)
- Slack API calls receive undefined instead of "" (no invalid_thread_ts)
The stream method throws ValidationError on empty threadTs (matching
startTyping's early-return pattern) so TypeScript narrows correctly
without any `as string` casts.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Add tests for empty threadTs normalization in stream, scheduleMessage, and postEphemeral
---------
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
The mention rewrite regex only excluded `<` before `@`, so
`user@example.com` was converted to `user<@example>.com`, breaking
plain emails and `<mailto:…>` links. Extend the lookbehind to also
exclude word characters so emails pass through unchanged.
Fixes#392
* feat(chat): add streaming options to thread.post()
* test(chat): add comprehensive tests for PostStreamOptions
* feat(chat): add StreamMessage PostableObject for streaming with options
* refactor(chat): remove PostStreamOptions second param, keep only StreamMessage PostableObject
* refactor(chat): rename StreamMessage to StreamingPlan, fix post() return type
Rename per Malte's feedback - StreamingPlan better describes what the
options control (task grouping, stop blocks for streamed plans).
Fix type safety issue where post<T extends PostableObject>() returned
SentMessage at runtime instead of T. Now awaits handleStream() for
side effects and returns the original StreamingPlan instance.
* test(chat): cover updateIntervalMs-only and fallback paths for StreamingPlan
Remove a duplicated test block, drop a duplicate JSDoc line on Thread.post,
and add tests for posting a StreamingPlan with only updateIntervalMs and
for routing StreamingPlan through the fallback post+edit path when the
adapter has no native streaming.
---------
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
* feat(docs): add Resources page powered by Edge Config
Add a /resources page that displays guides and templates in a
3-column card grid. Data is fetched from Vercel Edge Config in
production and from a local JSON file in development. Includes
CollectionPage JSON-LD markup and revalidates daily.
* fix(docs): handle Edge Config unavailability on resources page
* feat(docs): add keywords metadata to resources page
* feat(docs): add twitter card metadata to resources page
---------
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
* feat(chat): add thread.getParticipants() method
Returns unique human participants in a thread by scanning message
history. Excludes the bot itself. Useful for subscribing only to
1:1 conversations and unsubscribing when others join.
* fix: filter all bots in getParticipants(), not just self
Third-party bots (e.g. Jira, GitHub) were included as participants
because only isMe was checked. Now filters on isBot as well.
* docs: add getParticipants() to Thread API reference and guides
---------
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
* docs: add agent readability improvements
- Add AGENTS.md skill file served at /AGENTS.md
- Add /.well-known/agent-skills/ discovery index and SKILL.md
- Add JSON-LD structured data to homepage
- Exclude AGENTS.md and .well-known from i18n middleware
* fix: suppress biome lint for JSON-LD dangerouslySetInnerHTML
---------
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
- Added a `details` field to the `task_update` type for providing additional context in task updates.
- Updated relevant documentation and test cases to reflect the new field, improving clarity on task progress reporting.
* feat(chat): add chat.thread() method for creating thread handles
Allows constructing a Thread handle from a thread ID outside of webhook
contexts, enabling proactive messaging to existing threads.
Closes#148
* docs: add chat.thread() to API reference
---------
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
* Support passing scopes as a config to the linear adapter
* Changeset
* Add multi-tenant support for Linear
* Lint
* Cleanup
* Fix tests
* Make organizationId mandatory
* Fix
* Fix fetch of comments
* Start agent sessions support
* Continue cleanup
* Cleanup more
* Simplify more
* Fix
* Fix fetchMessages for agent sessions
* Improve streaming to linear
* Fix agent raw messages
* Fix tests
* Lint
* Simplify
* Work
* Remove debug logs and adapt tests
* Fix organizationId
* Cleanup types
* Cleanup and comment
* Fix webhook handling
* Expose prompt context
* First review pass
* Rework the changeset
* Improve getInstallation and expose refreshInstallation
* Fix error on agent sessions coming from issue delegation
---------
Co-authored-by: <dancer@users.noreply.github.com>
* fix(gchat): clear cards when editing a message to text
* add changeset for gchat clear cards fix
---------
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>