@mastra/slack 1.2.1 → 1.3.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @mastra/slack
2
2
 
3
+ ## 1.3.0-alpha.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Improved Slack channel UX: ([#16937](https://github.com/mastra-ai/mastra/pull/16937))
8
+ - **Flat adapter config** — `SlackProvider` now accepts per-adapter options (`formatError`, `streaming`, `typingStatus`, `toolDisplay`) directly at the top level instead of nesting under `adapterConfig`. The `adapterConfig` field still works as a deprecated fallback.
9
+ - **Breaking change** — the `cards: boolean` and `formatToolCall` fields have been removed from `SlackProviderConfig`/`SlackAdapterChannelConfig`. Migrate `cards: false` → `toolDisplay: 'text'`, and `formatToolCall: (info) => msg` → `toolDisplay: (event) => event.kind === 'result' ? { kind: 'post', message: msg } : undefined`.
10
+ - **Opinionated defaults** — `SlackProvider` now defaults `streaming: true` and `toolDisplay: 'grouped'` since the grouped "Thinking Steps" widget renders well in Slack's AI Assistant UI. When `streaming: false` is explicitly set, `toolDisplay` falls back to `'cards'` since `'grouped'` requires streaming. Override either per-config to restore other modes.
11
+ - **AI Assistant manifest** — `assistant:write` is now part of `DEFAULT_BOT_SCOPES` and the generated manifest declares the matching `assistant_view` feature, so newly generated app manifests support the AI Assistant surface and thread context in DMs.
12
+ - **Slack DM tool-approval routing** — clicks on tool-approval cards in Slack DMs now resume the correct Mastra thread.
13
+
14
+ ```ts
15
+ import { SlackProvider } from '@mastra/slack';
16
+
17
+ const slack = new SlackProvider({
18
+ // Top-level options (preferred):
19
+ streaming: true,
20
+ toolDisplay: 'grouped', // or 'cards' | 'text' | 'timeline' | 'hidden' | ToolDisplayFn
21
+ });
22
+ ```
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies [[`0cbece9`](https://github.com/mastra-ai/mastra/commit/0cbece9d832cb134a74cdbf3682d390a058215a4), [`7dfe1bc`](https://github.com/mastra-ai/mastra/commit/7dfe1bcfe71d261a6fd6bbf29b1dec49d78fb98f), [`70cb714`](https://github.com/mastra-ai/mastra/commit/70cb7149c8f16f478e15b58498254a53181750a4), [`7f9da22`](https://github.com/mastra-ai/mastra/commit/7f9da22efd5aa595e138a31de55a5f0f2f28b33d)]:
27
+ - @mastra/core@1.37.0-alpha.6
28
+
3
29
  ## 1.2.1
4
30
 
5
31
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -305,7 +305,9 @@ var DEFAULT_BOT_SCOPES = [
305
305
  "users:read",
306
306
  // Reactions and files
307
307
  "reactions:write",
308
- "files:read"
308
+ "files:read",
309
+ // Assistant mode (enables thread context for DMs and AI Assistant surface)
310
+ "assistant:write"
309
311
  ];
310
312
  var DEFAULT_BOT_EVENTS = [
311
313
  "app_mention",
@@ -338,6 +340,11 @@ function buildManifest(options) {
338
340
  bot_user: {
339
341
  display_name: name,
340
342
  always_online: true
343
+ },
344
+ // Required by Slack when `assistant:write` scope is present.
345
+ // Surfaces the app in the AI Assistant picker.
346
+ assistant_view: {
347
+ assistant_description: shortDescription
341
348
  }
342
349
  },
343
350
  oauth_config: {
@@ -14757,6 +14764,44 @@ var SlackProvider = class {
14757
14764
  const candidate = { handlers, inlineMedia, inlineLinks, state, threadContext, tools, chatOptions };
14758
14765
  return Object.fromEntries(Object.entries(candidate).filter(([, value]) => value !== void 0));
14759
14766
  }
14767
+ /**
14768
+ * Resolve the per-adapter config applied to the Slack entry in
14769
+ * `AgentChannels.adapters`. Top-level fields on `SlackProviderConfig` win;
14770
+ * the deprecated `adapterConfig` is merged in as a fallback for backwards
14771
+ * compatibility. Undefined values are filtered so they don't clobber the
14772
+ * fallback or preserved options.
14773
+ */
14774
+ #resolveSlackAdapterConfig() {
14775
+ const {
14776
+ adapterConfig,
14777
+ cors,
14778
+ gateway,
14779
+ formatError: formatError2,
14780
+ streaming: topLevelStreaming,
14781
+ typingStatus,
14782
+ toolDisplay: topLevelToolDisplay
14783
+ } = this.#channelConfig;
14784
+ const topLevel = {
14785
+ cors,
14786
+ gateway,
14787
+ formatError: formatError2,
14788
+ streaming: topLevelStreaming,
14789
+ typingStatus,
14790
+ toolDisplay: topLevelToolDisplay
14791
+ };
14792
+ const filteredTopLevel = Object.fromEntries(Object.entries(topLevel).filter(([, value]) => value !== void 0));
14793
+ const filteredAdapterConfig = Object.fromEntries(
14794
+ Object.entries(adapterConfig ?? {}).filter(([, value]) => value !== void 0)
14795
+ );
14796
+ const merged = { ...filteredAdapterConfig, ...filteredTopLevel };
14797
+ const streaming = merged.streaming ?? true;
14798
+ const toolDisplay = merged.toolDisplay ?? (streaming ? "grouped" : "cards");
14799
+ return {
14800
+ ...merged,
14801
+ streaming,
14802
+ toolDisplay
14803
+ };
14804
+ }
14760
14805
  /**
14761
14806
  * Create AgentChannels for an agent with the Slack adapter.
14762
14807
  * SlackProvider owns the AgentChannels lifecycle for platform-managed agents.
@@ -14768,8 +14813,8 @@ var SlackProvider = class {
14768
14813
  * previous instance are torn down before we replace it.
14769
14814
  */
14770
14815
  #createAgentChannels(agent, adapter) {
14771
- const { adapterConfig } = this.#channelConfig;
14772
- const slackEntry = adapterConfig ? { adapter, ...adapterConfig } : adapter;
14816
+ const adapterConfig = this.#resolveSlackAdapterConfig();
14817
+ const slackEntry = Object.keys(adapterConfig).length > 0 ? { adapter, ...adapterConfig } : adapter;
14773
14818
  const existing = agent.getChannels();
14774
14819
  const existingConfig = existing?.channelConfig;
14775
14820
  existing?.close();