@chat-adapter/slack 4.11.0 → 4.13.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/dist/index.d.ts +83 -1
- package/dist/index.js +495 -21
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CardElement, BaseFormatConverter, AdapterPostableMessage, Root, Logger, Adapter, ChatInstance, WebhookOptions, RawMessage, EphemeralMessage, ModalElement, EmojiValue, StreamOptions, FetchOptions, FetchResult, ThreadInfo, Message, FormattedContent } from 'chat';
|
|
1
|
+
import { CardElement, BaseFormatConverter, AdapterPostableMessage, Root, Logger, Adapter, ChatInstance, WebhookOptions, RawMessage, EphemeralMessage, ModalElement, EmojiValue, StreamOptions, FetchOptions, FetchResult, ThreadInfo, Message, ListThreadsOptions, ListThreadsResult, ChannelInfo, FormattedContent } from 'chat';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Slack Block Kit converter for cross-platform cards.
|
|
@@ -121,6 +121,10 @@ interface SlackEvent {
|
|
|
121
121
|
}>;
|
|
122
122
|
team?: string;
|
|
123
123
|
team_id?: string;
|
|
124
|
+
/** Number of replies in the thread (present on thread parent messages) */
|
|
125
|
+
reply_count?: number;
|
|
126
|
+
/** Timestamp of the latest reply (present on thread parent messages) */
|
|
127
|
+
latest_reply?: string;
|
|
124
128
|
}
|
|
125
129
|
/** Slack reaction event payload */
|
|
126
130
|
interface SlackReactionEvent {
|
|
@@ -214,6 +218,11 @@ declare class SlackAdapter implements Adapter<SlackThreadId, unknown> {
|
|
|
214
218
|
* These are sent as form-urlencoded with a `payload` JSON field.
|
|
215
219
|
*/
|
|
216
220
|
private handleInteractivePayload;
|
|
221
|
+
/**
|
|
222
|
+
* Handle Slack slash command payloads.
|
|
223
|
+
* Slash commands are sent as form-urlencoded with command, text, user_id, channel_id, etc.
|
|
224
|
+
*/
|
|
225
|
+
private handleSlashCommand;
|
|
217
226
|
/**
|
|
218
227
|
* Handle block_actions payload (button clicks in Block Kit).
|
|
219
228
|
*/
|
|
@@ -232,6 +241,55 @@ declare class SlackAdapter implements Adapter<SlackThreadId, unknown> {
|
|
|
232
241
|
* Handle reaction events from Slack (reaction_added, reaction_removed).
|
|
233
242
|
*/
|
|
234
243
|
private handleReactionEvent;
|
|
244
|
+
/**
|
|
245
|
+
* Handle assistant_thread_started events from Slack's Assistants API.
|
|
246
|
+
* Fires when a user opens a new assistant thread (DM with the bot).
|
|
247
|
+
*/
|
|
248
|
+
private handleAssistantThreadStarted;
|
|
249
|
+
/**
|
|
250
|
+
* Handle assistant_thread_context_changed events from Slack's Assistants API.
|
|
251
|
+
* Fires when a user navigates to a different channel with the assistant panel open.
|
|
252
|
+
*/
|
|
253
|
+
private handleAssistantContextChanged;
|
|
254
|
+
/**
|
|
255
|
+
* Handle app_home_opened events from Slack.
|
|
256
|
+
* Fires when a user opens the bot's Home tab.
|
|
257
|
+
*/
|
|
258
|
+
private handleAppHomeOpened;
|
|
259
|
+
/**
|
|
260
|
+
* Publish a Home tab view for a user.
|
|
261
|
+
* Slack API: views.publish
|
|
262
|
+
*/
|
|
263
|
+
publishHomeView(userId: string, view: Record<string, unknown>): Promise<void>;
|
|
264
|
+
/**
|
|
265
|
+
* Set suggested prompts for an assistant thread.
|
|
266
|
+
* Slack Assistants API: assistant.threads.setSuggestedPrompts
|
|
267
|
+
*/
|
|
268
|
+
setSuggestedPrompts(channelId: string, threadTs: string, prompts: Array<{
|
|
269
|
+
title: string;
|
|
270
|
+
message: string;
|
|
271
|
+
}>, title?: string): Promise<void>;
|
|
272
|
+
/**
|
|
273
|
+
* Set status/thinking indicator for an assistant thread.
|
|
274
|
+
* Slack Assistants API: assistant.threads.setStatus
|
|
275
|
+
*/
|
|
276
|
+
setAssistantStatus(channelId: string, threadTs: string, status: string, loadingMessages?: string[]): Promise<void>;
|
|
277
|
+
/**
|
|
278
|
+
* Set title for an assistant thread (shown in History tab).
|
|
279
|
+
* Slack Assistants API: assistant.threads.setTitle
|
|
280
|
+
*/
|
|
281
|
+
setAssistantTitle(channelId: string, threadTs: string, title: string): Promise<void>;
|
|
282
|
+
/**
|
|
283
|
+
* Resolve inline user mentions in Slack mrkdwn text.
|
|
284
|
+
* Converts <@U123> to <@U123|displayName> so that toAst/extractPlainText
|
|
285
|
+
* renders them as @displayName instead of @U123.
|
|
286
|
+
*
|
|
287
|
+
* @param skipSelfMention - When true, skips the bot's own user ID so that
|
|
288
|
+
* mention detection (which looks for @botUserId in the text) continues to
|
|
289
|
+
* work. Set to false when parsing historical/channel messages where mention
|
|
290
|
+
* detection doesn't apply.
|
|
291
|
+
*/
|
|
292
|
+
private resolveInlineMentions;
|
|
235
293
|
private parseSlackMessage;
|
|
236
294
|
/**
|
|
237
295
|
* Create an Attachment object from a Slack file.
|
|
@@ -304,6 +362,30 @@ declare class SlackAdapter implements Adapter<SlackThreadId, unknown> {
|
|
|
304
362
|
* Used for parseMessage interface - falls back to user ID for username.
|
|
305
363
|
*/
|
|
306
364
|
private parseSlackMessageSync;
|
|
365
|
+
/**
|
|
366
|
+
* Derive channel ID from a Slack thread ID.
|
|
367
|
+
* Slack thread IDs are "slack:CHANNEL:THREAD_TS", channel ID is "slack:CHANNEL".
|
|
368
|
+
*/
|
|
369
|
+
channelIdFromThreadId(threadId: string): string;
|
|
370
|
+
/**
|
|
371
|
+
* Fetch channel-level messages (conversations.history, not thread replies).
|
|
372
|
+
*/
|
|
373
|
+
fetchChannelMessages(channelId: string, options?: FetchOptions): Promise<FetchResult<unknown>>;
|
|
374
|
+
private fetchChannelMessagesForward;
|
|
375
|
+
private fetchChannelMessagesBackward;
|
|
376
|
+
/**
|
|
377
|
+
* List threads in a Slack channel.
|
|
378
|
+
* Fetches channel history and filters for messages with replies.
|
|
379
|
+
*/
|
|
380
|
+
listThreads(channelId: string, options?: ListThreadsOptions): Promise<ListThreadsResult<unknown>>;
|
|
381
|
+
/**
|
|
382
|
+
* Fetch Slack channel info/metadata.
|
|
383
|
+
*/
|
|
384
|
+
fetchChannelInfo(channelId: string): Promise<ChannelInfo>;
|
|
385
|
+
/**
|
|
386
|
+
* Post a top-level message to a channel (not in a thread).
|
|
387
|
+
*/
|
|
388
|
+
postChannelMessage(channelId: string, message: AdapterPostableMessage): Promise<RawMessage<unknown>>;
|
|
307
389
|
renderFormatted(content: FormattedContent): string;
|
|
308
390
|
/**
|
|
309
391
|
* Check if a Slack event is from this bot.
|