@mastra/slack 1.2.1 → 1.3.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 +52 -0
- package/dist/index.cjs +1310 -519
- 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 +1310 -519
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Mastra } from '@mastra/core/mastra';
|
|
2
|
-
import { ChannelAdapterConfig,
|
|
2
|
+
import { ChannelAdapterConfig, StreamingConfig, ToolDisplay, StaticToolDisplay, ChannelHandlers, ChannelConfig, ChannelProvider, ChannelConnectResult, ChannelInstallationInfo, ChannelPlatformInfo } from '@mastra/core/channels';
|
|
3
3
|
import { ApiRoute } from '@mastra/core/server';
|
|
4
4
|
import { SlackAdapterConfig, SlackAdapter } from '@chat-adapter/slack';
|
|
5
5
|
export { SlackAdapter, createSlackAdapter } from '@chat-adapter/slack';
|
|
@@ -104,28 +104,102 @@ interface SlackConfigTokens {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
|
-
* Per-adapter overrides
|
|
108
|
-
*
|
|
109
|
-
* `{ adapter, ...adapterConfig }` when wiring up `AgentChannels` manually.
|
|
110
|
-
* The `adapter` instance itself is created by the provider.
|
|
107
|
+
* Per-adapter overrides shared across both streaming and static branches
|
|
108
|
+
* of {@link SlackAdapterChannelConfig}.
|
|
111
109
|
*/
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
|
|
110
|
+
interface SlackAdapterChannelConfigBase {
|
|
111
|
+
/** CORS configuration for the Slack webhook route. */
|
|
112
|
+
cors?: ChannelAdapterConfig['cors'];
|
|
113
|
+
/** Slack gateway listener toggle. Currently a no-op for Slack (HTTP-only). */
|
|
114
|
+
gateway?: ChannelAdapterConfig['gateway'];
|
|
115
|
+
/** Override how errors are rendered in Slack messages. */
|
|
116
|
+
formatError?: ChannelAdapterConfig['formatError'];
|
|
117
|
+
/**
|
|
118
|
+
* Control Slack typing indicators and Assistant-mode status text.
|
|
119
|
+
*
|
|
120
|
+
* - `true` — use built-in defaults: `"is typing…"` while generating text,
|
|
121
|
+
* `"is calling {toolName}…"` while a tool runs, `"is waiting for
|
|
122
|
+
* approval…"` while a tool is suspended. Slack auto-prepends the app
|
|
123
|
+
* name so the user sees `"<App Name> is typing…"`.
|
|
124
|
+
* - `false` — never call `startTyping`. Useful when a live streaming
|
|
125
|
+
* widget (e.g. `toolDisplay: 'grouped'`) already conveys progress.
|
|
126
|
+
* - `(chunk, ctx) => string | false | null | undefined | void` — set
|
|
127
|
+
* custom copy per chunk. Return a string to override the status,
|
|
128
|
+
* or `false`/`null`/`undefined` to leave it unchanged. Compose with
|
|
129
|
+
* `defaultTypingStatus` (exported from `@mastra/core/channels`) to
|
|
130
|
+
* fall back to defaults for chunks you don't handle.
|
|
131
|
+
*
|
|
132
|
+
* @default true
|
|
133
|
+
*/
|
|
134
|
+
typingStatus?: ChannelAdapterConfig['typingStatus'];
|
|
135
|
+
}
|
|
115
136
|
/**
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
* In addition to the provider-specific fields documented below, this accepts
|
|
119
|
-
* options that are forwarded to the underlying `AgentChannels` instances
|
|
120
|
-
* managed by the provider — for example `handlers`, `inlineMedia`, and
|
|
121
|
-
* `adapterConfig`.
|
|
137
|
+
* Slack adapter overrides with `streaming` enabled (the default). Allows any
|
|
138
|
+
* `toolDisplay` mode, including the streaming-only `'timeline'` / `'grouped'`.
|
|
122
139
|
*/
|
|
123
|
-
interface
|
|
140
|
+
interface SlackAdapterStreamingConfig extends SlackAdapterChannelConfigBase {
|
|
124
141
|
/**
|
|
125
|
-
*
|
|
126
|
-
*
|
|
142
|
+
* Stream agent text deltas to Slack as the agent generates them.
|
|
143
|
+
*
|
|
144
|
+
* - `true` (default) — stream with default options.
|
|
145
|
+
* - `{ updateIntervalMs }` — stream with a custom post-and-edit interval.
|
|
146
|
+
*
|
|
147
|
+
* @default true
|
|
127
148
|
*/
|
|
128
|
-
|
|
149
|
+
streaming?: Exclude<StreamingConfig, false>;
|
|
150
|
+
/**
|
|
151
|
+
* How tool calls are rendered in Slack.
|
|
152
|
+
*
|
|
153
|
+
* - `'cards'` — per-tool "Running…" → "Result" Block Kit cards (the streaming
|
|
154
|
+
* session is closed/posted/reopened around each card).
|
|
155
|
+
* - `'text'` — per-tool plain-text messages (no Block Kit).
|
|
156
|
+
* - `'timeline'` — render tools as inline task entries beside the streaming text.
|
|
157
|
+
* - `'grouped'` (default in Slack) — collapse all tools into a single
|
|
158
|
+
* "Thinking Steps" plan widget. Renders well in Slack's AI Assistant UI.
|
|
159
|
+
* - `'hidden'` — execute tools silently; only the typing status indicates work.
|
|
160
|
+
* - Function form ({@link ToolDisplay}): a `ToolDisplayFn` for full control.
|
|
161
|
+
*
|
|
162
|
+
* Approve/deny prompts (`requireApproval`) always render as a separate card.
|
|
163
|
+
*
|
|
164
|
+
* @default 'grouped'
|
|
165
|
+
*/
|
|
166
|
+
toolDisplay?: ToolDisplay;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Slack adapter overrides with `streaming: false`. Restricts `toolDisplay`
|
|
170
|
+
* to modes that post discrete messages (no `StreamingPlan` available).
|
|
171
|
+
*/
|
|
172
|
+
interface SlackAdapterStaticConfig extends SlackAdapterChannelConfigBase {
|
|
173
|
+
/**
|
|
174
|
+
* Disable Slack's native message streaming and buffer text until `step-finish`.
|
|
175
|
+
* `'timeline'` and `'grouped'` modes require streaming, so they're not
|
|
176
|
+
* available on this branch.
|
|
177
|
+
*/
|
|
178
|
+
streaming: false;
|
|
179
|
+
/**
|
|
180
|
+
* How tool calls are rendered in Slack (static modes only).
|
|
181
|
+
*
|
|
182
|
+
* - `'cards'` (default) — per-tool "Running…" → "Result" Block Kit cards.
|
|
183
|
+
* - `'text'` — per-tool plain-text messages (no Block Kit).
|
|
184
|
+
* - `'hidden'` — execute tools silently; only the typing status indicates work.
|
|
185
|
+
* - Function form ({@link ToolDisplay}): a `ToolDisplayFn` for full control.
|
|
186
|
+
*
|
|
187
|
+
* @default 'cards'
|
|
188
|
+
*/
|
|
189
|
+
toolDisplay?: StaticToolDisplay;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Per-adapter overrides applied to the Slack entry inside
|
|
193
|
+
* `AgentChannels.adapters`. `streaming` discriminates which `toolDisplay`
|
|
194
|
+
* modes are available — `'timeline'` / `'grouped'` need streaming on.
|
|
195
|
+
*/
|
|
196
|
+
type SlackAdapterChannelConfig = SlackAdapterStreamingConfig | SlackAdapterStaticConfig;
|
|
197
|
+
/**
|
|
198
|
+
* Slack provider fields that are independent of the `streaming` /
|
|
199
|
+
* `toolDisplay` discrimination — shared by both branches of
|
|
200
|
+
* {@link SlackProviderConfig}.
|
|
201
|
+
*/
|
|
202
|
+
interface SlackProviderConfigBase extends SlackAdapterChannelConfigBase {
|
|
129
203
|
/**
|
|
130
204
|
* Override built-in event handlers (e.g. `onDirectMessage`, `onMention`).
|
|
131
205
|
* Forwarded to `AgentChannels` for every agent connected via this provider.
|
|
@@ -141,12 +215,23 @@ interface SlackProviderConfig extends ForwardedAgentChannelsOptions {
|
|
|
141
215
|
* ```
|
|
142
216
|
*/
|
|
143
217
|
handlers?: ChannelHandlers;
|
|
218
|
+
/** Which media types to send inline to the model. See `ChannelConfig.inlineMedia`. */
|
|
219
|
+
inlineMedia?: ChannelConfig['inlineMedia'];
|
|
220
|
+
/** Promote URLs in message text to file parts. See `ChannelConfig.inlineLinks`. */
|
|
221
|
+
inlineLinks?: ChannelConfig['inlineLinks'];
|
|
222
|
+
/** State adapter for deduplication, locking, and subscriptions. */
|
|
223
|
+
state?: ChannelConfig['state'];
|
|
224
|
+
/** Fetch recent thread messages from Slack when the agent joins mid-conversation. */
|
|
225
|
+
threadContext?: ChannelConfig['threadContext'];
|
|
226
|
+
/** Whether to include channel tools (add_reaction, remove_reaction). */
|
|
227
|
+
tools?: ChannelConfig['tools'];
|
|
228
|
+
/** Additional options passed directly to the Chat SDK. */
|
|
229
|
+
chatOptions?: ChannelConfig['chatOptions'];
|
|
144
230
|
/**
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
* `formatError`.
|
|
231
|
+
* Logger forwarded to the underlying `SlackAdapter` for internal error
|
|
232
|
+
* reporting. Defaults to the adapter's `ConsoleLogger`.
|
|
148
233
|
*/
|
|
149
|
-
|
|
234
|
+
logger?: SlackAdapterConfig['logger'];
|
|
150
235
|
/**
|
|
151
236
|
* Slack App Configuration access token for programmatic app creation.
|
|
152
237
|
* Generate at: https://api.slack.com/apps > "Your App Configuration Tokens"
|
|
@@ -196,7 +281,69 @@ interface SlackProviderConfig extends ForwardedAgentChannelsOptions {
|
|
|
196
281
|
* Use a 32+ character random string. Can be set via MASTRA_ENCRYPTION_KEY env var.
|
|
197
282
|
*/
|
|
198
283
|
encryptionKey?: string;
|
|
284
|
+
/**
|
|
285
|
+
* Per-adapter overrides applied to the Slack adapter entry inside
|
|
286
|
+
* `AgentChannels.adapters` — for example `toolDisplay`, `streaming`,
|
|
287
|
+
* `formatError`.
|
|
288
|
+
*
|
|
289
|
+
* @deprecated Pass these fields at the top level of `SlackProviderConfig`
|
|
290
|
+
* instead. Top-level fields win; values from `adapterConfig` are merged in
|
|
291
|
+
* as a fallback for backwards compatibility.
|
|
292
|
+
*/
|
|
293
|
+
adapterConfig?: SlackAdapterChannelConfig;
|
|
199
294
|
}
|
|
295
|
+
/**
|
|
296
|
+
* Slack provider configuration with `streaming` enabled (the default).
|
|
297
|
+
* Allows any `toolDisplay` mode.
|
|
298
|
+
*/
|
|
299
|
+
interface SlackProviderStreamingConfig extends SlackProviderConfigBase {
|
|
300
|
+
/**
|
|
301
|
+
* Stream agent text deltas to Slack as the agent generates them.
|
|
302
|
+
*
|
|
303
|
+
* - `true` (default) — stream with default options.
|
|
304
|
+
* - `{ updateIntervalMs }` — stream with a custom post-and-edit interval.
|
|
305
|
+
*
|
|
306
|
+
* @default true
|
|
307
|
+
*/
|
|
308
|
+
streaming?: Exclude<StreamingConfig, false>;
|
|
309
|
+
/**
|
|
310
|
+
* How tool calls are rendered in Slack. See {@link SlackAdapterStreamingConfig#toolDisplay}.
|
|
311
|
+
*
|
|
312
|
+
* @default 'grouped'
|
|
313
|
+
*/
|
|
314
|
+
toolDisplay?: ToolDisplay;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Slack provider configuration with `streaming: false`. Restricts
|
|
318
|
+
* `toolDisplay` to modes that post discrete messages.
|
|
319
|
+
*/
|
|
320
|
+
interface SlackProviderStaticConfig extends SlackProviderConfigBase {
|
|
321
|
+
/**
|
|
322
|
+
* Disable Slack's native message streaming and buffer text until `step-finish`.
|
|
323
|
+
* `'timeline'` and `'grouped'` modes require streaming, so they're not
|
|
324
|
+
* available on this branch.
|
|
325
|
+
*/
|
|
326
|
+
streaming: false;
|
|
327
|
+
/**
|
|
328
|
+
* How tool calls are rendered in Slack (static modes only). See
|
|
329
|
+
* {@link SlackAdapterStaticConfig#toolDisplay}.
|
|
330
|
+
*
|
|
331
|
+
* @default 'cards'
|
|
332
|
+
*/
|
|
333
|
+
toolDisplay?: StaticToolDisplay;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Configuration for SlackProvider at the Mastra level.
|
|
337
|
+
*
|
|
338
|
+
* Combines Slack-specific fields (tokens, baseUrl, OAuth callbacks),
|
|
339
|
+
* Slack-adapter overrides (`toolDisplay`, `streaming`, `typingStatus`, …), and a
|
|
340
|
+
* curated subset of `AgentChannels` options forwarded to every connected agent
|
|
341
|
+
* (`handlers`, `inlineMedia`, `inlineLinks`, …).
|
|
342
|
+
*
|
|
343
|
+
* `streaming` discriminates which `toolDisplay` modes are available —
|
|
344
|
+
* `'timeline'` / `'grouped'` need streaming on.
|
|
345
|
+
*/
|
|
346
|
+
type SlackProviderConfig = SlackProviderStreamingConfig | SlackProviderStaticConfig;
|
|
200
347
|
/**
|
|
201
348
|
* Options for connecting an agent to Slack via `slack.connect(agentId, options)`.
|
|
202
349
|
* This is serializable and can be stored in the database for stored agents.
|
|
@@ -346,6 +493,13 @@ interface SlackAppManifest {
|
|
|
346
493
|
url: string;
|
|
347
494
|
usage_hint?: string;
|
|
348
495
|
}>;
|
|
496
|
+
assistant_view?: {
|
|
497
|
+
assistant_description: string;
|
|
498
|
+
suggested_prompts?: Array<{
|
|
499
|
+
title: string;
|
|
500
|
+
message: string;
|
|
501
|
+
}>;
|
|
502
|
+
};
|
|
349
503
|
};
|
|
350
504
|
oauth_config?: {
|
|
351
505
|
redirect_urls?: string[];
|
|
@@ -591,7 +745,7 @@ interface SlashCommand {
|
|
|
591
745
|
/**
|
|
592
746
|
* Default bot scopes required for agent functionality.
|
|
593
747
|
*/
|
|
594
|
-
declare const DEFAULT_BOT_SCOPES: readonly ["chat:write", "chat:write.public", "im:write", "channels:history", "channels:read", "groups:history", "groups:read", "im:history", "im:read", "mpim:history", "mpim:read", "app_mentions:read", "users:read", "reactions:write", "files:read"];
|
|
748
|
+
declare const DEFAULT_BOT_SCOPES: readonly ["chat:write", "chat:write.public", "im:write", "channels:history", "channels:read", "groups:history", "groups:read", "im:history", "im:read", "mpim:history", "mpim:read", "app_mentions:read", "users:read", "reactions:write", "files:read", "assistant:write"];
|
|
595
749
|
/**
|
|
596
750
|
* Default bot events to subscribe to.
|
|
597
751
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Mastra } from '@mastra/core/mastra';
|
|
2
|
-
import { ChannelAdapterConfig,
|
|
2
|
+
import { ChannelAdapterConfig, StreamingConfig, ToolDisplay, StaticToolDisplay, ChannelHandlers, ChannelConfig, ChannelProvider, ChannelConnectResult, ChannelInstallationInfo, ChannelPlatformInfo } from '@mastra/core/channels';
|
|
3
3
|
import { ApiRoute } from '@mastra/core/server';
|
|
4
4
|
import { SlackAdapterConfig, SlackAdapter } from '@chat-adapter/slack';
|
|
5
5
|
export { SlackAdapter, createSlackAdapter } from '@chat-adapter/slack';
|
|
@@ -104,28 +104,102 @@ interface SlackConfigTokens {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
|
-
* Per-adapter overrides
|
|
108
|
-
*
|
|
109
|
-
* `{ adapter, ...adapterConfig }` when wiring up `AgentChannels` manually.
|
|
110
|
-
* The `adapter` instance itself is created by the provider.
|
|
107
|
+
* Per-adapter overrides shared across both streaming and static branches
|
|
108
|
+
* of {@link SlackAdapterChannelConfig}.
|
|
111
109
|
*/
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
|
|
110
|
+
interface SlackAdapterChannelConfigBase {
|
|
111
|
+
/** CORS configuration for the Slack webhook route. */
|
|
112
|
+
cors?: ChannelAdapterConfig['cors'];
|
|
113
|
+
/** Slack gateway listener toggle. Currently a no-op for Slack (HTTP-only). */
|
|
114
|
+
gateway?: ChannelAdapterConfig['gateway'];
|
|
115
|
+
/** Override how errors are rendered in Slack messages. */
|
|
116
|
+
formatError?: ChannelAdapterConfig['formatError'];
|
|
117
|
+
/**
|
|
118
|
+
* Control Slack typing indicators and Assistant-mode status text.
|
|
119
|
+
*
|
|
120
|
+
* - `true` — use built-in defaults: `"is typing…"` while generating text,
|
|
121
|
+
* `"is calling {toolName}…"` while a tool runs, `"is waiting for
|
|
122
|
+
* approval…"` while a tool is suspended. Slack auto-prepends the app
|
|
123
|
+
* name so the user sees `"<App Name> is typing…"`.
|
|
124
|
+
* - `false` — never call `startTyping`. Useful when a live streaming
|
|
125
|
+
* widget (e.g. `toolDisplay: 'grouped'`) already conveys progress.
|
|
126
|
+
* - `(chunk, ctx) => string | false | null | undefined | void` — set
|
|
127
|
+
* custom copy per chunk. Return a string to override the status,
|
|
128
|
+
* or `false`/`null`/`undefined` to leave it unchanged. Compose with
|
|
129
|
+
* `defaultTypingStatus` (exported from `@mastra/core/channels`) to
|
|
130
|
+
* fall back to defaults for chunks you don't handle.
|
|
131
|
+
*
|
|
132
|
+
* @default true
|
|
133
|
+
*/
|
|
134
|
+
typingStatus?: ChannelAdapterConfig['typingStatus'];
|
|
135
|
+
}
|
|
115
136
|
/**
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
* In addition to the provider-specific fields documented below, this accepts
|
|
119
|
-
* options that are forwarded to the underlying `AgentChannels` instances
|
|
120
|
-
* managed by the provider — for example `handlers`, `inlineMedia`, and
|
|
121
|
-
* `adapterConfig`.
|
|
137
|
+
* Slack adapter overrides with `streaming` enabled (the default). Allows any
|
|
138
|
+
* `toolDisplay` mode, including the streaming-only `'timeline'` / `'grouped'`.
|
|
122
139
|
*/
|
|
123
|
-
interface
|
|
140
|
+
interface SlackAdapterStreamingConfig extends SlackAdapterChannelConfigBase {
|
|
124
141
|
/**
|
|
125
|
-
*
|
|
126
|
-
*
|
|
142
|
+
* Stream agent text deltas to Slack as the agent generates them.
|
|
143
|
+
*
|
|
144
|
+
* - `true` (default) — stream with default options.
|
|
145
|
+
* - `{ updateIntervalMs }` — stream with a custom post-and-edit interval.
|
|
146
|
+
*
|
|
147
|
+
* @default true
|
|
127
148
|
*/
|
|
128
|
-
|
|
149
|
+
streaming?: Exclude<StreamingConfig, false>;
|
|
150
|
+
/**
|
|
151
|
+
* How tool calls are rendered in Slack.
|
|
152
|
+
*
|
|
153
|
+
* - `'cards'` — per-tool "Running…" → "Result" Block Kit cards (the streaming
|
|
154
|
+
* session is closed/posted/reopened around each card).
|
|
155
|
+
* - `'text'` — per-tool plain-text messages (no Block Kit).
|
|
156
|
+
* - `'timeline'` — render tools as inline task entries beside the streaming text.
|
|
157
|
+
* - `'grouped'` (default in Slack) — collapse all tools into a single
|
|
158
|
+
* "Thinking Steps" plan widget. Renders well in Slack's AI Assistant UI.
|
|
159
|
+
* - `'hidden'` — execute tools silently; only the typing status indicates work.
|
|
160
|
+
* - Function form ({@link ToolDisplay}): a `ToolDisplayFn` for full control.
|
|
161
|
+
*
|
|
162
|
+
* Approve/deny prompts (`requireApproval`) always render as a separate card.
|
|
163
|
+
*
|
|
164
|
+
* @default 'grouped'
|
|
165
|
+
*/
|
|
166
|
+
toolDisplay?: ToolDisplay;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Slack adapter overrides with `streaming: false`. Restricts `toolDisplay`
|
|
170
|
+
* to modes that post discrete messages (no `StreamingPlan` available).
|
|
171
|
+
*/
|
|
172
|
+
interface SlackAdapterStaticConfig extends SlackAdapterChannelConfigBase {
|
|
173
|
+
/**
|
|
174
|
+
* Disable Slack's native message streaming and buffer text until `step-finish`.
|
|
175
|
+
* `'timeline'` and `'grouped'` modes require streaming, so they're not
|
|
176
|
+
* available on this branch.
|
|
177
|
+
*/
|
|
178
|
+
streaming: false;
|
|
179
|
+
/**
|
|
180
|
+
* How tool calls are rendered in Slack (static modes only).
|
|
181
|
+
*
|
|
182
|
+
* - `'cards'` (default) — per-tool "Running…" → "Result" Block Kit cards.
|
|
183
|
+
* - `'text'` — per-tool plain-text messages (no Block Kit).
|
|
184
|
+
* - `'hidden'` — execute tools silently; only the typing status indicates work.
|
|
185
|
+
* - Function form ({@link ToolDisplay}): a `ToolDisplayFn` for full control.
|
|
186
|
+
*
|
|
187
|
+
* @default 'cards'
|
|
188
|
+
*/
|
|
189
|
+
toolDisplay?: StaticToolDisplay;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Per-adapter overrides applied to the Slack entry inside
|
|
193
|
+
* `AgentChannels.adapters`. `streaming` discriminates which `toolDisplay`
|
|
194
|
+
* modes are available — `'timeline'` / `'grouped'` need streaming on.
|
|
195
|
+
*/
|
|
196
|
+
type SlackAdapterChannelConfig = SlackAdapterStreamingConfig | SlackAdapterStaticConfig;
|
|
197
|
+
/**
|
|
198
|
+
* Slack provider fields that are independent of the `streaming` /
|
|
199
|
+
* `toolDisplay` discrimination — shared by both branches of
|
|
200
|
+
* {@link SlackProviderConfig}.
|
|
201
|
+
*/
|
|
202
|
+
interface SlackProviderConfigBase extends SlackAdapterChannelConfigBase {
|
|
129
203
|
/**
|
|
130
204
|
* Override built-in event handlers (e.g. `onDirectMessage`, `onMention`).
|
|
131
205
|
* Forwarded to `AgentChannels` for every agent connected via this provider.
|
|
@@ -141,12 +215,23 @@ interface SlackProviderConfig extends ForwardedAgentChannelsOptions {
|
|
|
141
215
|
* ```
|
|
142
216
|
*/
|
|
143
217
|
handlers?: ChannelHandlers;
|
|
218
|
+
/** Which media types to send inline to the model. See `ChannelConfig.inlineMedia`. */
|
|
219
|
+
inlineMedia?: ChannelConfig['inlineMedia'];
|
|
220
|
+
/** Promote URLs in message text to file parts. See `ChannelConfig.inlineLinks`. */
|
|
221
|
+
inlineLinks?: ChannelConfig['inlineLinks'];
|
|
222
|
+
/** State adapter for deduplication, locking, and subscriptions. */
|
|
223
|
+
state?: ChannelConfig['state'];
|
|
224
|
+
/** Fetch recent thread messages from Slack when the agent joins mid-conversation. */
|
|
225
|
+
threadContext?: ChannelConfig['threadContext'];
|
|
226
|
+
/** Whether to include channel tools (add_reaction, remove_reaction). */
|
|
227
|
+
tools?: ChannelConfig['tools'];
|
|
228
|
+
/** Additional options passed directly to the Chat SDK. */
|
|
229
|
+
chatOptions?: ChannelConfig['chatOptions'];
|
|
144
230
|
/**
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
* `formatError`.
|
|
231
|
+
* Logger forwarded to the underlying `SlackAdapter` for internal error
|
|
232
|
+
* reporting. Defaults to the adapter's `ConsoleLogger`.
|
|
148
233
|
*/
|
|
149
|
-
|
|
234
|
+
logger?: SlackAdapterConfig['logger'];
|
|
150
235
|
/**
|
|
151
236
|
* Slack App Configuration access token for programmatic app creation.
|
|
152
237
|
* Generate at: https://api.slack.com/apps > "Your App Configuration Tokens"
|
|
@@ -196,7 +281,69 @@ interface SlackProviderConfig extends ForwardedAgentChannelsOptions {
|
|
|
196
281
|
* Use a 32+ character random string. Can be set via MASTRA_ENCRYPTION_KEY env var.
|
|
197
282
|
*/
|
|
198
283
|
encryptionKey?: string;
|
|
284
|
+
/**
|
|
285
|
+
* Per-adapter overrides applied to the Slack adapter entry inside
|
|
286
|
+
* `AgentChannels.adapters` — for example `toolDisplay`, `streaming`,
|
|
287
|
+
* `formatError`.
|
|
288
|
+
*
|
|
289
|
+
* @deprecated Pass these fields at the top level of `SlackProviderConfig`
|
|
290
|
+
* instead. Top-level fields win; values from `adapterConfig` are merged in
|
|
291
|
+
* as a fallback for backwards compatibility.
|
|
292
|
+
*/
|
|
293
|
+
adapterConfig?: SlackAdapterChannelConfig;
|
|
199
294
|
}
|
|
295
|
+
/**
|
|
296
|
+
* Slack provider configuration with `streaming` enabled (the default).
|
|
297
|
+
* Allows any `toolDisplay` mode.
|
|
298
|
+
*/
|
|
299
|
+
interface SlackProviderStreamingConfig extends SlackProviderConfigBase {
|
|
300
|
+
/**
|
|
301
|
+
* Stream agent text deltas to Slack as the agent generates them.
|
|
302
|
+
*
|
|
303
|
+
* - `true` (default) — stream with default options.
|
|
304
|
+
* - `{ updateIntervalMs }` — stream with a custom post-and-edit interval.
|
|
305
|
+
*
|
|
306
|
+
* @default true
|
|
307
|
+
*/
|
|
308
|
+
streaming?: Exclude<StreamingConfig, false>;
|
|
309
|
+
/**
|
|
310
|
+
* How tool calls are rendered in Slack. See {@link SlackAdapterStreamingConfig#toolDisplay}.
|
|
311
|
+
*
|
|
312
|
+
* @default 'grouped'
|
|
313
|
+
*/
|
|
314
|
+
toolDisplay?: ToolDisplay;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Slack provider configuration with `streaming: false`. Restricts
|
|
318
|
+
* `toolDisplay` to modes that post discrete messages.
|
|
319
|
+
*/
|
|
320
|
+
interface SlackProviderStaticConfig extends SlackProviderConfigBase {
|
|
321
|
+
/**
|
|
322
|
+
* Disable Slack's native message streaming and buffer text until `step-finish`.
|
|
323
|
+
* `'timeline'` and `'grouped'` modes require streaming, so they're not
|
|
324
|
+
* available on this branch.
|
|
325
|
+
*/
|
|
326
|
+
streaming: false;
|
|
327
|
+
/**
|
|
328
|
+
* How tool calls are rendered in Slack (static modes only). See
|
|
329
|
+
* {@link SlackAdapterStaticConfig#toolDisplay}.
|
|
330
|
+
*
|
|
331
|
+
* @default 'cards'
|
|
332
|
+
*/
|
|
333
|
+
toolDisplay?: StaticToolDisplay;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Configuration for SlackProvider at the Mastra level.
|
|
337
|
+
*
|
|
338
|
+
* Combines Slack-specific fields (tokens, baseUrl, OAuth callbacks),
|
|
339
|
+
* Slack-adapter overrides (`toolDisplay`, `streaming`, `typingStatus`, …), and a
|
|
340
|
+
* curated subset of `AgentChannels` options forwarded to every connected agent
|
|
341
|
+
* (`handlers`, `inlineMedia`, `inlineLinks`, …).
|
|
342
|
+
*
|
|
343
|
+
* `streaming` discriminates which `toolDisplay` modes are available —
|
|
344
|
+
* `'timeline'` / `'grouped'` need streaming on.
|
|
345
|
+
*/
|
|
346
|
+
type SlackProviderConfig = SlackProviderStreamingConfig | SlackProviderStaticConfig;
|
|
200
347
|
/**
|
|
201
348
|
* Options for connecting an agent to Slack via `slack.connect(agentId, options)`.
|
|
202
349
|
* This is serializable and can be stored in the database for stored agents.
|
|
@@ -346,6 +493,13 @@ interface SlackAppManifest {
|
|
|
346
493
|
url: string;
|
|
347
494
|
usage_hint?: string;
|
|
348
495
|
}>;
|
|
496
|
+
assistant_view?: {
|
|
497
|
+
assistant_description: string;
|
|
498
|
+
suggested_prompts?: Array<{
|
|
499
|
+
title: string;
|
|
500
|
+
message: string;
|
|
501
|
+
}>;
|
|
502
|
+
};
|
|
349
503
|
};
|
|
350
504
|
oauth_config?: {
|
|
351
505
|
redirect_urls?: string[];
|
|
@@ -591,7 +745,7 @@ interface SlashCommand {
|
|
|
591
745
|
/**
|
|
592
746
|
* Default bot scopes required for agent functionality.
|
|
593
747
|
*/
|
|
594
|
-
declare const DEFAULT_BOT_SCOPES: readonly ["chat:write", "chat:write.public", "im:write", "channels:history", "channels:read", "groups:history", "groups:read", "im:history", "im:read", "mpim:history", "mpim:read", "app_mentions:read", "users:read", "reactions:write", "files:read"];
|
|
748
|
+
declare const DEFAULT_BOT_SCOPES: readonly ["chat:write", "chat:write.public", "im:write", "channels:history", "channels:read", "groups:history", "groups:read", "im:history", "im:read", "mpim:history", "mpim:read", "app_mentions:read", "users:read", "reactions:write", "files:read", "assistant:write"];
|
|
595
749
|
/**
|
|
596
750
|
* Default bot events to subscribe to.
|
|
597
751
|
*/
|