@mastra/slack 1.1.1-alpha.0 → 1.2.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 +42 -0
- package/dist/index.cjs +24 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +44 -4
- package/dist/index.d.ts +44 -4
- package/dist/index.js +24 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
# @mastra/slack
|
|
2
2
|
|
|
3
|
+
## 1.2.0-alpha.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- `SlackProvider` now accepts the channel-level options you'd pass to `AgentChannels` when wiring it up manually — for example overriding event `handlers`, per-adapter rendering via `adapterConfig` (`cards`, `formatToolCall`, `formatError`), and `inlineMedia` / `inlineLinks` / `chatOptions`. Also forwards a `logger` to the underlying `SlackAdapter`. ([#16496](https://github.com/mastra-ai/mastra/pull/16496))
|
|
8
|
+
|
|
9
|
+
Wrapping `defaultHandler` lets you gate the agent on per-user ACLs, rate limits, or audit logging without reimplementing dispatch:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
new SlackProvider({
|
|
13
|
+
refreshToken: process.env.SLACK_APP_CONFIG_REFRESH_TOKEN,
|
|
14
|
+
inlineMedia: ['image/*', 'video/*'],
|
|
15
|
+
adapterConfig: {
|
|
16
|
+
cards: false,
|
|
17
|
+
formatToolCall: ({ toolName, result }) => ({ text: `\`${toolName}\` → ${JSON.stringify(result)}` }),
|
|
18
|
+
},
|
|
19
|
+
handlers: {
|
|
20
|
+
onDirectMessage: async (thread, message, defaultHandler) => {
|
|
21
|
+
if (!authorizedUserIds.includes(message.author.userId)) {
|
|
22
|
+
console.log('Received a DM from an unauthorized user:', { userId: message.author.userId });
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
return defaultHandler(thread, message);
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [[`cc189cc`](https://github.com/mastra-ai/mastra/commit/cc189cc0128eb7af233476b5e421ec6888bffde7)]:
|
|
34
|
+
- @mastra/core@1.33.0-alpha.16
|
|
35
|
+
|
|
36
|
+
## 1.1.1
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- Fixed Slack app creation failing when agent description exceeds 139 characters. The manifest description is now automatically truncated to prevent the Slack API from rejecting the request. ([#16093](https://github.com/mastra-ai/mastra/pull/16093))
|
|
41
|
+
|
|
42
|
+
- Updated dependencies [[`6dcd65f`](https://github.com/mastra-ai/mastra/commit/6dcd65f2a34069e6dc43ba35f1d11119b9b40bef), [`86c0298`](https://github.com/mastra-ai/mastra/commit/86c0298e647306423c842f9d5ac827bd616bd13d), [`c05c9a1`](https://github.com/mastra-ai/mastra/commit/c05c9a13230988cef6d438a62f37760f31927bc7), [`ca28c23`](https://github.com/mastra-ai/mastra/commit/ca28c232a2f18801a6cf20fe053479237b4d4fb0), [`e24aacb`](https://github.com/mastra-ai/mastra/commit/e24aacba07bd66f5d95b636dc24016fca26b52cf), [`7679a63`](https://github.com/mastra-ai/mastra/commit/7679a634eae8e8ca459fd87538fdf72b4389b07f), [`7fce309`](https://github.com/mastra-ai/mastra/commit/7fce30912b14170bfc41f0ac736cca0f39fe0cd4), [`1d64a76`](https://github.com/mastra-ai/mastra/commit/1d64a765861a0772ea187bab76e5ed37bf82d042), [`1c2dda8`](https://github.com/mastra-ai/mastra/commit/1c2dda805fbfccc0abf55d4cb20cc34402dc3f0c), [`c721164`](https://github.com/mastra-ai/mastra/commit/c7211643f7ac861f83b19a3757cc921487fc9d75), [`1b55954`](https://github.com/mastra-ai/mastra/commit/1b559541c1e08a10e49d01ffc51a634dfc37a286), [`7997c2e`](https://github.com/mastra-ai/mastra/commit/7997c2e55ddd121562a4098cd8d2b89c68433bf1), [`5adc55e`](https://github.com/mastra-ai/mastra/commit/5adc55e63407be8ee977914957d68bcc2a075ceb), [`7679a63`](https://github.com/mastra-ai/mastra/commit/7679a634eae8e8ca459fd87538fdf72b4389b07f), [`a0d9b6d`](https://github.com/mastra-ai/mastra/commit/a0d9b6d6b810aeaa9e177a0dcc99a4402e609634), [`e97ccb9`](https://github.com/mastra-ai/mastra/commit/e97ccb900f8b7a390ce82c9f8eb8d6eb2c5e3777), [`c5daf48`](https://github.com/mastra-ai/mastra/commit/c5daf48556e98c46ae06caf00f92c249912007e9), [`70017d7`](https://github.com/mastra-ai/mastra/commit/70017d72ab741b5d7040e2a15c251a317782e39e), [`cd96779`](https://github.com/mastra-ai/mastra/commit/cd9677937f113b2856dc8b9f3d4bdabcee58bb2e), [`b0c7022`](https://github.com/mastra-ai/mastra/commit/b0c70224f80dad7c0cdbfb22cbff22e0f75c064f), [`e4942bc`](https://github.com/mastra-ai/mastra/commit/e4942bc7fdc903572f7d84f26d5e15f9d39c763d)]:
|
|
43
|
+
- @mastra/core@1.32.0
|
|
44
|
+
|
|
3
45
|
## 1.1.1-alpha.0
|
|
4
46
|
|
|
5
47
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -4946,6 +4946,7 @@ var SlackProvider = class {
|
|
|
4946
4946
|
const agent = this.#mastra?.getAgentById(installation.agentId);
|
|
4947
4947
|
const displayName = installation.name || agent?.name || installation.agentId;
|
|
4948
4948
|
const adapter = (0, import_slack.createSlackAdapter)({
|
|
4949
|
+
...this.#forwardedAdapterOptions(),
|
|
4949
4950
|
botToken: installation.botToken,
|
|
4950
4951
|
botUserId: installation.botUserId,
|
|
4951
4952
|
signingSecret: installation.signingSecret,
|
|
@@ -5009,13 +5010,33 @@ var SlackProvider = class {
|
|
|
5009
5010
|
}
|
|
5010
5011
|
}
|
|
5011
5012
|
}
|
|
5013
|
+
/**
|
|
5014
|
+
* Extract the SlackAdapter fields the provider forwards to every
|
|
5015
|
+
* `createSlackAdapter()` call. Installation-managed credentials/identity are
|
|
5016
|
+
* applied separately.
|
|
5017
|
+
*/
|
|
5018
|
+
#forwardedAdapterOptions() {
|
|
5019
|
+
const { logger } = this.#channelConfig;
|
|
5020
|
+
return { logger };
|
|
5021
|
+
}
|
|
5022
|
+
/**
|
|
5023
|
+
* Extract the AgentChannels fields the provider forwards. `adapters` and
|
|
5024
|
+
* `userName` are applied separately by `#createAgentChannels`.
|
|
5025
|
+
*/
|
|
5026
|
+
#forwardedChannelOptions() {
|
|
5027
|
+
const { handlers, inlineMedia, inlineLinks, state, threadContext, tools, chatOptions } = this.#channelConfig;
|
|
5028
|
+
return { handlers, inlineMedia, inlineLinks, state, threadContext, tools, chatOptions };
|
|
5029
|
+
}
|
|
5012
5030
|
/**
|
|
5013
5031
|
* Create AgentChannels for an agent with the Slack adapter.
|
|
5014
5032
|
* SlackProvider owns the AgentChannels lifecycle for platform-managed agents.
|
|
5015
5033
|
*/
|
|
5016
5034
|
#createAgentChannels(agent, adapter) {
|
|
5035
|
+
const { adapterConfig } = this.#channelConfig;
|
|
5036
|
+
const slackEntry = adapterConfig ? { adapter, ...adapterConfig } : adapter;
|
|
5017
5037
|
const agentChannels = new import_channels.AgentChannels({
|
|
5018
|
-
|
|
5038
|
+
...this.#forwardedChannelOptions(),
|
|
5039
|
+
adapters: { slack: slackEntry },
|
|
5019
5040
|
userName: agent.name
|
|
5020
5041
|
});
|
|
5021
5042
|
agent.setChannels(agentChannels);
|
|
@@ -5403,6 +5424,7 @@ var SlackProvider = class {
|
|
|
5403
5424
|
const agent = this.#mastra?.getAgentById(pending.agentId);
|
|
5404
5425
|
const displayName = installation.name || agent?.name || pending.agentId;
|
|
5405
5426
|
const adapter = (0, import_slack.createSlackAdapter)({
|
|
5427
|
+
...this.#forwardedAdapterOptions(),
|
|
5406
5428
|
botToken: installation.botToken,
|
|
5407
5429
|
botUserId: installation.botUserId,
|
|
5408
5430
|
signingSecret: installation.signingSecret,
|
|
@@ -5479,6 +5501,7 @@ var SlackProvider = class {
|
|
|
5479
5501
|
}
|
|
5480
5502
|
const displayName = installation.name || agent.name || installation.agentId;
|
|
5481
5503
|
const currentAdapter = this.#adapters.get(installation.id) ?? (0, import_slack.createSlackAdapter)({
|
|
5504
|
+
...this.#forwardedAdapterOptions(),
|
|
5482
5505
|
botToken: installation.botToken,
|
|
5483
5506
|
botUserId: installation.botUserId,
|
|
5484
5507
|
signingSecret: installation.signingSecret,
|