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 publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). 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.
⚠️⚠️⚠️⚠️⚠️⚠️
`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.
⚠️⚠️⚠️⚠️⚠️⚠️
# Releases
> The changelog information of each package has been omitted from this
message, as the content exceeds the size limit.
## @mastra/slack@1.9.0-alpha.0
## @mastra/factory@0.28.0-alpha.3
## @mastra/code-sdk@1.19.0-alpha.3
## mastracode@0.50.0-alpha.3
## @mastra/observability@1.24.0-alpha.2
## @mastra/core@1.83.0-alpha.3
## @mastra/mcp-apps-components@0.1.0-alpha.3
## @mastra/playground-ui@69.0.0-alpha.4
## @mastra/server@1.83.0-alpha.3
## @mastra/server-adapters-test-suite@0.3.0-alpha.1
## @mastra/platform-workspace@1.13.0-alpha.0
## @mastra/auth-better-auth@1.1.11-alpha.1
## @mastra/client-js@1.60.0-alpha.3
## @mastra/react@1.15.0-alpha.3
## @mastra/deployer-cloud@1.83.0-alpha.3
## @mastra/longmemeval@1.1.42-alpha.3
## @mastra/opencode@0.1.42-alpha.3
## create-factory@0.4.3-alpha.3
## @mastra/arize@1.3.30-alpha.2
## @mastra/arthur@0.4.30-alpha.2
## @mastra/braintrust@1.3.27-alpha.2
## @mastra/datadog@1.4.22-alpha.2
## @mastra/deepeval@0.1.24-alpha.2
## @mastra/laminar@1.3.32-alpha.2
## @mastra/langfuse@1.6.6-alpha.2
## @mastra/langsmith@1.4.3-alpha.2
## @mastra/otel-bridge@1.5.22-alpha.2
## @mastra/otel-exporter@1.5.2-alpha.2
## @mastra/posthog@1.4.7-alpha.2
## @mastra/sentry@1.2.32-alpha.2
## @mastra/agent-builder@1.2.1-alpha.1
## mastra@1.39.0-alpha.3
## @mastra/connect@1.3.2-alpha.2
## @mastra/deployer@1.83.0-alpha.3
## @mastra/editor@0.17.1-alpha.2
## @mastra/fastembed@1.3.7-alpha.0
## @mastra/mcp-docs-server@1.3.13-alpha.6
## @mastra/memory@1.41.1-alpha.1
## @mastra/elysia@0.1.23-alpha.3
## @mastra/express@1.5.27-alpha.3
## @mastra/fastify@1.5.27-alpha.3
## @mastra/hono@1.7.25-alpha.3
## @mastra/koa@1.7.27-alpha.3
## @mastra/nestjs@0.3.0-alpha.3
## @mastra/next@0.2.41-alpha.3
## @mastra/tanstack-start@0.2.41-alpha.3
## @mastra/convex@1.8.1-alpha.0
## @mastra/pg@1.36.0-alpha.2
## @mastra/inngest@1.11.2-alpha.2
## @mastra/temporal@0.6.0-alpha.3
## create-mastra@1.39.0-alpha.3
## @internal/playground@1.39.0-alpha.3
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
> Opened by @DSchau
## What
Adds an experimental, opt-in `generativeUI` option for the **Slack**
channel adapter. When set, agent runs on Slack get a `render_card` tool:
the agent passes a [json-render](https://json-render.dev) spec and the
card is posted to the thread as Block Kit (header, fields, `data_table`,
charts, images, link buttons). Slack is the only platform this has been
tested on, so the option is ignored on every other adapter.
```ts
channels: {
adapters: {
slack: { adapter: createSlackAdapter(), generativeUI: true },
},
}
```
Off by default. `createSlackAdapter` comes from upstream
`@chat-adapter/slack`, so the flag lives on Mastra's per-adapter config
rather than the adapter factory.
## How
- New `ChatChannelGenerativeUIProcessor`
(`packages/core/src/channels/generative-ui.ts`), auto-added by
`AgentChannels.getInputProcessors()` when the Slack adapter opts in. It
adds `render_card` per step only for Slack runs with `generativeUI` on,
so users don't wire tools by hand. Independent of
`threadContext.addSystemMessage`.
- `render_card` validates via `@json-render/chat`'s `toCard` with Slack
limits (1 table, 100 rows, 20 columns, 10 fields, 2 charts, 20 chart
points, 20-char chart labels, 50-char chart titles, 12 series). Invalid
specs return `{ ok: false, issues }` without posting so the model can
fix and retry; success returns `{ ok: true, messageId }`.
- Slack fallbacks `toCard` limits don't cover (duplicate chart
categories or series names, axis labels over 50 chars, tables over
10,000 cell chars) are also returned as issues. Without this the Slack
adapter quietly downgrades the chart or table to a text block while the
tool reports `ok: true`.
- Tool description is a short component list plus the few Slack rules
that cause rejected or degraded cards (no empty strings, mrkdwn,
table/field/chart caps, public image URLs, unique link URLs). The stock
`catalog.prompt()` is ~13k chars and targets JSONL-patch streaming,
which doesn't fit a tool call.
- `Button` is left out of the catalog: generic button clicks have no
handler yet (only approval buttons are wired). `LinkButton` is kept.
- `render_card` is added to `channelToolNames` so drivers don't also
render a tool card for it.
- `@json-render/chat` is an **optional peer** of `@mastra/core`,
lazy-loaded with a literal dynamic import (same pattern as
`chat-lazy.ts`), with a clear error if missing. It needs zod 4.
**Reviewers: flag if a new optional peer on core is not OK.**
- `@mastra/slack`'s `SlackAdapterChannelConfig` gets the same field, so
Factory's `SlackIntegration({ adapterOptions: { generativeUI: true } })`
works with no further changes.
## Not in this PR
- Streaming a card in as it's generated (`streamCard`)
- Interactive `Button`s with `onAction` routing
## Test plan
- [x] `generative-ui.test.ts` uses the real json-render converters: tool
injection, opt-out, non-channel runs, memory-thread fallback (cached),
valid post, invalid spec / excluded `Button`, Slack table limit, post
failure
- [x] Agent-loop test in `integration.test.ts`: the model sees
`render_card`, calls it, and the card is posted
- [x] `getInputProcessors` tests: added when Slack opts in (even with
`addSystemMessage: false`), absent by default, ignored on non-Slack
adapters
- [x] All 638 channel tests pass, `tsc --noEmit` clean for core and
`@mastra/slack`
- [ ] Beta Slack: snapshot this branch, set `adapterOptions: {
generativeUI: true }` + add `@json-render/chat` in shipyard-beta, and
ask for a status card
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## ELI5
This adds an optional way for a Slack agent to create and post
structured cards, such as tables and charts. If a card is invalid or too
large, the agent receives feedback so it can correct the card.
## Changes
- Added the experimental `generativeUI` option for Slack. It is off by
default and does not enable the feature on other adapters.
- Added the `render_card` tool and input processor. When enabled, the
tool converts a json-render spec to a Slack Block Kit card and posts it
to the thread.
- Added card validation. Invalid specs and cards that exceed supported
limits return issues without posting; posting failures return an error.
- Added optional `@json-render/chat` dependency support and
documentation for setup and supported components.
- Added unit and integration tests for opt-in behavior, card posting,
validation, and failures.
**Diff:** 14 files changed; 674 lines added and 7 removed.
**Test and build results:** Not available.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: mastra-platform[bot] <mastra-platform[bot]@users.noreply.github.com>
Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com>
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 publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). 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.
⚠️⚠️⚠️⚠️⚠️⚠️
`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.
⚠️⚠️⚠️⚠️⚠️⚠️
# Releases
> The changelog information of each package has been omitted from this
message, as the content exceeds the size limit.
## @mastra/factory@0.27.0-alpha.3
## @mastra/agent-builder@1.2.0-alpha.3
## @mastra/core@1.82.0-alpha.3
## @mastra/mcp@2.8.0-alpha.2
## @mastra/memory@1.41.0-alpha.3
## @mastra/playground-ui@68.0.0-alpha.3
## @mastra/ring-signals@0.1.0-alpha.0
## @mastra/libsql@1.29.0-alpha.2
## @mastra/mongodb@1.26.0-alpha.2
## @mastra/mysql@0.16.0-alpha.3
## @mastra/pg@1.35.0-alpha.3
## @mastra/discord@1.3.3-alpha.0
## @mastra/slack@1.8.1-alpha.0
## @mastra/teams@0.1.4-alpha.0
## @mastra/telegram@0.2.5-alpha.0
## @mastra/client-js@1.59.0-alpha.3
## @mastra/react@1.14.1-alpha.3
## @mastra/deployer-cloud@1.82.0-alpha.3
## @mastra/longmemeval@1.1.41-alpha.3
## @mastra/opencode@0.1.41-alpha.3
## create-factory@0.4.2-alpha.3
## @mastra/code-sdk@1.18.0-alpha.3
## mastracode@0.49.0-alpha.3
## @mastra/arize@1.3.29-alpha.2
## @mastra/arthur@0.4.29-alpha.2
## @mastra/laminar@1.3.31-alpha.2
## @mastra/langfuse@1.6.5-alpha.2
## @mastra/otel-bridge@1.5.21-alpha.2
## @mastra/otel-exporter@1.5.1-alpha.2
## @mastra/sentry@1.2.31-alpha.3
## mastra@1.38.0-alpha.3
## @mastra/connect@1.3.1-alpha.1
## @mastra/deployer@1.82.0-alpha.3
## @mastra/editor@0.17.0-alpha.3
## @mastra/evals@1.10.11-alpha.0
## @mastra/mcp-docs-server@1.3.12-alpha.4
## @mastra/server@1.82.0-alpha.3
## @mastra/elysia@0.1.22-alpha.3
## @mastra/express@1.5.26-alpha.3
## @mastra/fastify@1.5.26-alpha.3
## @mastra/hono@1.7.24-alpha.3
## @mastra/koa@1.7.26-alpha.3
## @mastra/nestjs@0.2.41-alpha.3
## @mastra/next@0.2.40-alpha.3
## @mastra/tanstack-start@0.2.40-alpha.3
## @mastra/turso@0.1.20-alpha.2
## @mastra/inngest@1.11.1-alpha.2
## @mastra/temporal@0.5.0-alpha.3
## create-mastra@1.38.0-alpha.3
## @internal/playground@1.38.0-alpha.3
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
## Description
`@mastra/discord` pinned `@chat-adapter/discord` to `4.40.0` and
`@mastra/teams` used `~4.40.0`, while `@mastra/core` moved `chat` to
`^4.43.0`. Every `@chat-adapter/*` release depends on the exact `chat`
release with the same version, so an app with core plus either package
installs two copies of `chat`:
```sh
pnpm add @mastra/core@1.81.0 @mastra/discord@1.3.2 @mastra/teams zod@4
ls node_modules/.pnpm | grep '^chat@'
# chat@4.40.0_zod@4.6.7
# chat@4.44.0_zod@4.6.7
```
The discord pin was correct when it landed in #25002 (it matched core's
`chat` at the time). It went stale when #28417 bumped core, slack and
telegram but not discord or teams. Renovate didn't catch it because the
"Chat adapter" group only matched `chat` and `@chat-adapter/slack`.
This PR:
- moves `chat` and all four `@chat-adapter/*` packages into the pnpm
catalog at `^4.44.0`, and points core, `@mastra/factory` and the channel
packages at `catalog:`
- widens the Renovate "Chat adapter" group to `@chat-adapter/*`
- drops the "pinned to 4.40.0" wording from the discord README
Installing the packed core, discord and teams tarballs into a fresh app
now gives a single `chat@4.44.0`, and the repo lockfile has one `chat`
entry.
Tested locally: typecheck and tests for `@mastra/discord`,
`@mastra/slack`, `@mastra/teams`, `@mastra/telegram`, core
`src/channels`, the factory Slack integration, and core/factory
typecheck.
The two smaller requests in the issue (passing an adapter instance to
`DiscordProvider`, back-off in core's `startGatewayLoop`) are out of
scope here.
## Related issue(s)
Fixes#29283
## Type of change
- [x] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation update
- [ ] Code refactoring
- [ ] Performance improvement
- [ ] Test update
## Checklist
- [x] I have linked the related issue(s) in the description above
- [x] I have made corresponding changes to the documentation (if
applicable)
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have addressed all Coderabbit comments on this PR
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## ELI5
Mastra and its channel packages now use matching versions of the chat
software. This helps prevent apps from installing separate copies that
may not work together.
## Changes
- Added `chat` and the Discord, Slack, Teams, and Telegram adapters to
the pnpm catalog at `^4.44.0`.
- Updated core, factory, and all four channel packages to use catalog
versions.
- Expanded Renovate’s “Chat adapter” group to match every
`@chat-adapter/*` package and `chat`.
- Updated the Discord README to remove the adapter pin wording and
clarify the reaction retry behavior.
- Added changesets for patch releases of the affected packages.
## Validation
The author reports that packed core, Discord, and Teams packages install
one `chat@4.44.0` in a fresh app, and that the repository lockfile has
one `chat` entry. The author also reports passing typechecks and tests
for Discord, Slack, Teams, Telegram, core channels, and the factory
Slack integration.
Accepting an adapter instance in `DiscordProvider` and adding back-off
to core’s `startGatewayLoop` are out of scope.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
## What this changes
**Hide reply text in a channel.** A new `textDisplay` adapter option.
With `textDisplay: 'hidden'`, the agent's reply text is never posted to
the channel; the agent speaks there only through tools the app gives it,
such as a reply tool. Tool display, approval prompts, error messages and
typing status work as before, and the text still reaches the agent's
stream and memory.
```ts
channels: {
adapters: {
slack: {
adapter: createSlackAdapter(),
textDisplay: 'hidden',
},
},
},
```
Why: agents in busy threads narrate each step ("Running the tests now",
"Comparing against main"). Letting an app route replies through a tool
means the agent posts when it has something to say, and models that
can't produce an empty reply can stay quiet by not calling the tool.
There was no way to do this before: handlers only decide whether a run
starts, and both drivers post every text chunk.
**Only mention `add_reaction` when it's mounted.** The channel system
instructions always told the model to "use the `add_reaction` tool" to
acknowledge without speaking. That tool only exists when the app passes
`channels.getTools()` to the agent, so agents without it called a tool
that wasn't there. The sentence is now added only when the step's tools
include `add_reaction`.
## How
- `ChannelAdapterBaseConfig.textDisplay?: 'show' | 'hidden'` (default
`'show'`), carried on the render context.
- `ChatChannelOutputProcessor` doesn't queue
`text-start`/`text-delta`/`text-end` for the drivers when hidden. It
still returns every chunk unchanged, so the caller's stream is
untouched.
- `ChatChannelProcessor` reads `tools` from `processInputStep` and only
adds the reaction sentence when `add_reaction` is present.
## Tests
- Output processor: hidden text posts nothing with the static and
streaming drivers; tool cards and errors still post; the chunk is passed
through to the stream unchanged.
- A real `Agent` streaming through channels with a mock model: the
system prompt the model receives mentions `add_reaction` only when
`channels.getTools()` is mounted.
- Red checks: removing the text filter fails 3 tests; always adding the
reaction sentence fails the processor test and the agent test.
- `src/channels`: 545 passed. Core `tsc --noEmit` clean, oxlint clean.
Docs: `docs/channels.mdx` (new "Reply only through a tool" section), and
`textDisplay` in the channels and Slack provider reference.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## ELI5
This PR lets channel applications hide normal agent replies while still
showing tool results, errors, approvals, and status updates. It also
prevents agents from being told to use `add_reaction` when that tool is
unavailable.
## Changes
- Added `textDisplay: 'show' | 'hidden'` to channel adapter and Slack
provider configuration.
- Passed `textDisplay` through the channel render context.
- Filtered hidden reply text from static and streaming channel output.
- Preserved tool displays, approval prompts, errors, typing status,
agent streams, and memory behavior.
- Added `add_reaction` guidance only when the tool is available.
- Updated channel and Slack documentation.
- Added tests for hidden text, streaming behavior, Slack configuration
propagation, and conditional reaction guidance.
## Validation
Reported validation includes 545 passing channel tests, a clean core
TypeScript check, and a clean Oxlint run.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: CalebBarnes <CalebBarnes@users.noreply.github.com>
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
## Summary
Deployed Mastra servers bind an address like `0.0.0.0:3000` that is
never publicly reachable, but the Slack/Telegram/Teams channel providers
derive OAuth callback and webhook URLs from the server bind config when
no explicit public URL is configured. In practice that broke every
channel on a deployed server:
- **Slack** minted app manifests with
`http://0.0.0.0:3000/slack/oauth/callback` as the OAuth redirect,
stranding users on an unreachable URL after authorizing.
- **Telegram** `setWebhook` failed with `Bad Request: bad webhook: An
HTTPS URL must be provided for webhook`.
- **Teams** registered unreachable Bot Framework messaging endpoints.
The only workaround was passing `server: { studioHost, studioProtocol,
studioPort }` to the `Mastra` instance by hand.
## Change
All three providers now consult the **`MASTRA_SERVER_URL`** environment
variable — the server's public URL, which deployment platforms can
inject on every deploy — in their base-URL derivation.
Precedence (most to least specific):
1. Explicit `baseUrl` provider config
2. `server.studioHost` / `studioProtocol` / `studioPort` overrides on
the Mastra instance
3. `MASTRA_SERVER_URL` env var
4. Bind host/port derivation (unchanged)
Existing setups are unaffected: the env var only applies when neither an
explicit `baseUrl` nor a `server.studio*` override is present.
Note: on Mastra platform deploys the server and studio have distinct
public URLs — webhooks and OAuth callbacks must target the **server**
URL (the studio URL sits behind platform auth, which would reject vendor
callbacks). A companion platform change injects `MASTRA_SERVER_URL` with
the server-domain URL.
## Test plan
- `@mastra/slack` 94/94 (new: manifest minted against
`MASTRA_SERVER_URL`; `server.studio*` beats the env var)
- `@mastra/telegram` 73/73 (new: `setWebhook` registered against
`MASTRA_SERVER_URL`; `server.studio*` beats the env var)
- `@mastra/teams` 47/47 (new: messaging endpoint registered against
`MASTRA_SERVER_URL`)
- `tsc --noEmit` clean on all three packages
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## ELI5
When a channel needs a public URL, it can now use `MASTRA_SERVER_URL`
instead of guessing from the server’s local address. This helps Slack,
Telegram, and Teams reach deployed endpoints.
## Summary
- Slack, Telegram, and Teams use the trimmed `MASTRA_SERVER_URL` when no
provider `baseUrl` or `server.studio*` override is configured.
- Explicit provider `baseUrl` and `server.studio*` settings keep
precedence. If the environment URL is not used, providers retain their
existing server-derived URL behavior.
- Added tests for environment URL use and precedence, and a changeset
for patch releases of all three packages.
Test results and current review finding counts were not provided.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
## Summary
Adds `smoke-test:channels`, an e2e smoke suite for the `channels()`
resolver — the channel-provider path (Slack, Discord, Telegram) that the
tools smoke suite (#25815) doesn't touch. Stacked on
`connect/e2e-smoke-tests`.
```bash
pnpm --filter @mastra/connect smoke-test:channels [--channel <id>] [--project-id <id>]
```
It verifies five layers against a live Platform project:
- **Resolver contract** — construction guards (missing project id,
invalid `ttlMs`), route mounting before any connection exists, TTL cache
+ `invalidate()`/`refresh()`, `disabled` overrides, and bogus
`connectionId` pins (warn-and-skip).
- **Server mount** — the resolver is handed to a real `Mastra` instance;
the suite asserts the channel routes land in the merged
`server.apiRoutes` with correct `requiresAuth` flags, mounts them
exactly the way the production server adapter does (`handler` /
`createHandler({ mastra })` onto Hono), and drives every platform's
webhook endpoint with real HTTP requests (unknown webhook ids answer
404).
- **Credential flow** — per connected channel: presence in the resolved
map (proves credential late-binding, e.g. Discord's `sync()` →
`configure()`), provider `id`/routes/`getInfo()`, a platform credential
fetch, and a vendor whoami call (Discord `GET /users/@me` +
`/applications/@me`, Slack `auth.test`, Telegram `getMe`). These
deliberately bypass the proxy — channel providers call vendor APIs
directly with the resolved token, so that direct path is what gets
smoked.
- **Discord full webhook flow** — the whole loop, end to end: the suite
overrides the provider's Ed25519 public key with a locally generated
pair (`providerOptions.publicKey`), `connect()`s an agent to a guild the
bot is already in (`commands: []`, so the guild is not mutated), POSTs a
**signed PING interaction** to the mounted route (200 PONG), POSTs a
forged signature (401), then `disconnect()`s and verifies the
installation is gone. Installations live in in-process channel storage,
so nothing persists after the run.
- **Slack manifest lifecycle** — `connect()` attempts a real
`apps.manifest.create` mint with the token the platform serves
(expecting a pending OAuth install + authorization URL), then
`disconnect()` deletes the minted app via `apps.manifest.delete`. Today
the `slack` integration serves a workspace bot token that Slack's
manifest API rejects (`not_allowed_token_type`), so the mint records a
**documented skip** — it still proves the manifest path is wired up to
Slack's token gate. Once the channel is rekeyed to the `slack-channels`
App Configuration integration (#25332), this exact flow runs the full
mint + delete lifecycle (a `TODO(#25332)` marks the integration-id list
for the rename).
### Companion fix: `@mastra/slack` `disconnect()` pending-app leak
`connect()` mints a real Slack app before the OAuth install completes,
but `disconnect()` only called `apps.manifest.delete` for **active**
installations — disconnecting during the pending window removed the
local record and orphaned the app in the Slack workspace. `disconnect()`
now deletes the minted app for pending installations too (unit-tested,
changeset included). This is also what keeps the smoke flow leak-free:
every app the suite mints is deleted in the same run.
Telegram's full flow needs `setWebhook` against the live bot plus a
public callback URL, and Slack event delivery needs a completed OAuth
install (pending installations are invisible to the events route by
design) — both out of scope; those webhook routes are still exercised
through the mounted server. The suite sends no messages and registers
nothing with any vendor beyond the Slack app it deletes in the same run.
`hono` is added as a devDependency (route mounting only); no
`@mastra/connect` runtime changes.
## Test plan
- Live run against the test project (`discord` + `slack` connected):
- `channels-resolver` 10/10, `server-mount` 5/5, `discord` 11/11 (incl.
full webhook flow), `slack` 6 pass + 1 documented skip (manifest token
gate, pending #25332), `telegram` skipped (no connection) — **0
failures**
- `@mastra/slack`: 92/92 tests (incl. new pending-disconnect deletes-app
test), `tsc --noEmit` clean
- `@mastra/connect`: `tsc --noEmit` clean (scripts included via
tsconfig), `vitest` 268/268, lint 0 warnings/errors
- Tools-suite audits unaffected: coverage 1014/1014, shape audit 0
findings
---------
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
## Summary
Adds **chat channel support to `AgentController`**, so a
controller-backed agent can run inside a messaging thread (Slack,
Discord, Telegram, and other Chat SDK adapters). Each chat thread maps
to one durable controller session, the agent's streamed output renders
back to the platform with native streaming, tool-approval cards, and
typing status, and tool approvals resolve through the session's approval
gate.
### How channels attach to the agent
Controller channels attach to the **backing agent instance** via
`setChannels`, propagated to every backing agent the controller runs
through (the shared `config.agent` plus each per-mode agent, including
lazily-constructed ones) — exactly as `setBrowser` already propagates.
This is the load-bearing design decision: only agents that were
explicitly given channels attach the channel output processor, so
channel rendering is a property of the agent, not a flag riding each
run's request context.
Because of this, child runs that clone the parent's request context
never inadvertently render to the chat platform:
- **Observational-memory observer/reflector** run on their own
freshly-constructed agents with no channels — no output processor
attaches, so nothing renders. No strip needed.
- **Forked subagents** run on the channel-bearing parent agent (so the
processor _is_ attached) and inherit the parent context verbatim,
including the render key. The forked subagent context **clears the
channel render key**, so the fork stays silent while the parent session
still renders.
### Channel provenance on persisted messages
Inbound channel messages routed into a controller session keep their
platform metadata: the message's `providerOptions` (author name, user
ID, message ID under `mastra.channels.<platform>`) are stamped onto the
persisted user message as `content.providerMetadata`, matching the plain
agent channel path — so UIs can show where a message came from.
Also suppresses the bot replying to `aside`-prefixed messages on
already-subscribed threads, so humans can talk among themselves in a
subscribed thread.
## What changed
- **`@mastra/core`** — `AgentControllerChannels` (one durable session
per chat thread), channel webhook registration on `Mastra`, tool
approvals routed through controller sessions, **instance-based channel
attachment** (`setChannels` propagated to every backing agent, no
per-run request-context injection), the forked-subagent render-key
clear, and `providerMetadata` stamping on persisted channel messages.
(Removing channel-tool auto-injection is intentionally **not** part of
this PR — that ships standalone as #20152.)
- **`@mastra/slack`** — installations can be owned by an
`AgentController`, not just a registered `Agent` (`ownerType` on
installation/pending schemas, controller-owned `connect`, stale
pending-app detection, manifest drift handling).
- **mastracode-web** — dogfood wiring: `SlackProvider` +
`AgentControllerChannels` factory (`web/channels/slack/slack.ts`), the
`aside` guard, `?resourceId=` deep-link support in the chat session
provider, and dev-server proxy/tunnel config for Slack webhooks.
- Docs (`docs/agent-controller/channels.mdx` + references) and
changesets (`@mastra/core` minor, `@mastra/slack` minor).
`@mastra/memory` has **no net change**: instance-based attachment makes
the OM leak structurally impossible (the observer/reflector agents never
carry channels, so no processor attaches), so no strip is required.
## Test plan
- `packages/core/src/channels` — 259 tests across 11 files pass,
including: session-per-thread, approvals through sessions, buttonless
auto-approve, instance-based channel resolution (backing agents report
the controller channels; run attaches the output processor), and
`providerMetadata` stamping.
-
`packages/core/src/agent-controller/agent-controller-channels-registration.test.ts`
— webhook registration + mode agents carry controller channels on the
instance.
- `channels/slack` — 80 tests pass (owner-type schemas, controller-owned
connect, manifest client).
- Core typecheck clean.
- Live proof: a controller channel run renders to the platform; a
forked-subagent-on-parent-agent run stays silent (render key cleared).
Live-validated end-to-end via Slack.
🤖 Generated with Mastra Code
---------
Co-authored-by: CalebBarnes <CalebBarnes@users.noreply.github.com>
Co-authored-by: Mastra Code (anthropic/claude-fable-5) <noreply@mastra.ai>
Co-authored-by: Abhi Aiyer <abhiaiyer91@gmail.com>