@mastra/slack 1.2.1-alpha.0 → 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 +36 -0
- package/dist/index.cjs +48 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +177 -23
- package/dist/index.d.ts +177 -23
- package/dist/index.js +48 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
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
|
+
|
|
29
|
+
## 1.2.1
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- - `SlackProvider.connect()` now merges with existing channel adapters instead of replacing them, preserving adapters the agent author already configured (e.g. Discord). ([#16517](https://github.com/mastra-ai/mastra/pull/16517))
|
|
34
|
+
- Slack interactive payloads (button clicks, modal submissions) no longer return `400 Malformed JSON body`. The provider only JSON-parses the body for the events callback path and forwards form-urlencoded payloads to the adapter's webhook handler unchanged.
|
|
35
|
+
- Bumped `chat` to `^4.29.0`.
|
|
36
|
+
- Updated dependencies [[`452036a`](https://github.com/mastra-ai/mastra/commit/452036a0d965b4f4c1efd93606e4f03b50b807a5), [`c272d50`](https://github.com/mastra-ai/mastra/commit/c272d50610a54496b6b6d92ccd4d37b333a2613a), [`27fd1b7`](https://github.com/mastra-ai/mastra/commit/27fd1b79ac62eb7694f92587eb7d1be05b59be01), [`5ba7253`](https://github.com/mastra-ai/mastra/commit/5ba7253745c85e8df8012a76d954c640ffa336f7), [`5556cc1`](https://github.com/mastra-ai/mastra/commit/5556cc1befec71518d84f826b3bfe3a079a9daf7), [`f73980d`](https://github.com/mastra-ai/mastra/commit/f73980d651eb5f7f1ab20582de4615a1b6f10fce), [`5499303`](https://github.com/mastra-ai/mastra/commit/54993032c1ebc09642625b78d2014e0cf84a3cae), [`a702009`](https://github.com/mastra-ai/mastra/commit/a702009d3cfaa745120f501e21c783ed4d6a3072), [`9aee493`](https://github.com/mastra-ai/mastra/commit/9aee493ed6089b5133472623dcce49934bf2d509), [`d8692af`](https://github.com/mastra-ai/mastra/commit/d8692afa253028e39cdce2aafa0ac414071a762e), [`1a9cc60`](https://github.com/mastra-ai/mastra/commit/1a9cc6069f9910fc3d59e4953ac8cd95d89ad6f5), [`8cdb86c`](https://github.com/mastra-ai/mastra/commit/8cdb86ceed1137bc2768e147dce85a0692b9fb26), [`8534d79`](https://github.com/mastra-ai/mastra/commit/8534d791fa1cb70fe1c19e2604c4b63cc10dd051), [`eda90c5`](https://github.com/mastra-ai/mastra/commit/eda90c5bfd7de11805ecc9f4552716c895fbaf78), [`a935b0a`](https://github.com/mastra-ai/mastra/commit/a935b0a0977ae3f196b33ec7621f528069c82db0), [`9c88701`](https://github.com/mastra-ai/mastra/commit/9c8870195b41a38dc40b6ba2aa55eda04df8fa69), [`c78f8cd`](https://github.com/mastra-ai/mastra/commit/c78f8cd6222a86e6c60ae5210b6929ad5221b6fb), [`e146aad`](https://github.com/mastra-ai/mastra/commit/e146aadbba66c410ba0e74bac4c50135495cb8dd), [`ac79462`](https://github.com/mastra-ai/mastra/commit/ac79462b98f1062394c45093aa515b0766f27ee2), [`1a0ec78`](https://github.com/mastra-ai/mastra/commit/1a0ec789a26cae443744e9abbd62ed6ee676af39), [`e47bca7`](https://github.com/mastra-ai/mastra/commit/e47bca7b72866d3abd173b9f530ac4318113a8ff), [`afc004f`](https://github.com/mastra-ai/mastra/commit/afc004f5cc7e30697809e7021820b9f5881e6719), [`0031d0f`](https://github.com/mastra-ai/mastra/commit/0031d0f13831d7843ac5d498734a7d92862e2ce3), [`841a222`](https://github.com/mastra-ai/mastra/commit/841a222560d8c19238f8213713f30535cdd82284), [`64c1e0b`](https://github.com/mastra-ai/mastra/commit/64c1e0b35165c96b659818bd0177aa18794ef11f), [`40d83a9`](https://github.com/mastra-ai/mastra/commit/40d83a90d9be31a1b83e04649edb703eb7753e33), [`4e88dc6`](https://github.com/mastra-ai/mastra/commit/4e88dc6b89f154c0eae37221c8126be0c23c569f), [`19018f0`](https://github.com/mastra-ai/mastra/commit/19018f05722af74a5978781a7731a654b26f7f2a), [`19281c7`](https://github.com/mastra-ai/mastra/commit/19281c70424f757219782de16c2699743c5e04d0), [`3498b49`](https://github.com/mastra-ai/mastra/commit/3498b4946be94f4313cd817733589680dcda5278), [`d52b6fe`](https://github.com/mastra-ai/mastra/commit/d52b6fe1c56853eb38864baae0bbfa75cc739ccb), [`408be73`](https://github.com/mastra-ai/mastra/commit/408be73449dfab92b51eab8c6623b6c443debc25), [`359439b`](https://github.com/mastra-ai/mastra/commit/359439bb8c635e048176306828195f8297f50021), [`71a820b`](https://github.com/mastra-ai/mastra/commit/71a820b2353fa1406772c50760a3732058a8b337), [`1698f5e`](https://github.com/mastra-ai/mastra/commit/1698f5ec141d34f22a873efdb145ce3cdf848a5e)]:
|
|
37
|
+
- @mastra/core@1.36.0
|
|
38
|
+
|
|
3
39
|
## 1.2.1-alpha.0
|
|
4
40
|
|
|
5
41
|
### 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
|
|
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();
|