@mastra/core
Version:
31 lines • 1.4 kB
TypeScript
import type { Adapter } from 'chat';
/**
* Slack-specific workaround for tool-approval clicks at the top level of a
* conversation (DM root or channel root, not inside a thread).
*
* The slack adapter's `handleBlockActions` falls back to `messageTs` when the
* clicked card has no `thread_ts`, which makes the action's `chatThread.id`
* point at a "thread keyed by the card itself" rather than the top-level
* conversation the user was actually in. That breaks the `pendingToolApprovals`
* metadata lookup because the metadata was persisted against the top-level
* thread.
*
* This helper detects that case (decoded `threadTs === messageId`) and rewrites
* the external thread id to the top-level (empty `threadTs`) form so the
* approval lookup hits the right mastra thread.
*
* Returns `null` when the workaround does not apply (non-slack platform,
* adapter without the thread-id codec, missing `messageId`, or the click was
* inside an actual thread). Callers should fall back to the original
* `chatThread.id` in that case.
*
* Remove this compat layer when the slack adapter is fixed to surface the
* top-level thread id directly on `event.thread`.
*/
export declare function resolveSlackTopLevelThreadId(params: {
platform: string;
adapter: Adapter<any, any>;
chatThreadId: string;
messageId?: string;
}): string | null;
//# sourceMappingURL=slack.d.ts.map