Spaces:
Running
Running
| import type { ChannelOutboundAdapter } from "../types.js"; | |
| import { sendMessageSlack } from "../../../slack/send.js"; | |
| export const slackOutbound: ChannelOutboundAdapter = { | |
| deliveryMode: "direct", | |
| chunker: null, | |
| textChunkLimit: 4000, | |
| sendText: async ({ to, text, accountId, deps, replyToId, threadId }) => { | |
| const send = deps?.sendSlack ?? sendMessageSlack; | |
| // Use threadId fallback so routed tool notifications stay in the Slack thread. | |
| const threadTs = replyToId ?? (threadId != null ? String(threadId) : undefined); | |
| const result = await send(to, text, { | |
| threadTs, | |
| accountId: accountId ?? undefined, | |
| }); | |
| return { channel: "slack", ...result }; | |
| }, | |
| sendMedia: async ({ to, text, mediaUrl, accountId, deps, replyToId, threadId }) => { | |
| const send = deps?.sendSlack ?? sendMessageSlack; | |
| // Use threadId fallback so routed tool notifications stay in the Slack thread. | |
| const threadTs = replyToId ?? (threadId != null ? String(threadId) : undefined); | |
| const result = await send(to, text, { | |
| mediaUrl, | |
| threadTs, | |
| accountId: accountId ?? undefined, | |
| }); | |
| return { channel: "slack", ...result }; | |
| }, | |
| }; | |