/** * Stable Slack thread keys — `:`. * * An agent that is handed messages from two Slack threads of one DM has to * be able to say which thread each answer belongs to. Before this key the * reply path could only guess, and it guessed "the thread the owner wrote in * last": an answer owed in thread A was posted in thread B together with the * answer for B (2026-09-28, Ella: EFT form + HSA screenshots). The key is * shown to the agent as `[SLACK-THREAD:]` on every delivered Slack * message, and every reply tool accepts it back. * * @module services/slack/slack-thread-key */ /** One Slack thread: conversation + root ts. */ export interface SlackThreadKeyParts { /** Slack conversation id (`C…`, `D…`, `G…`) */ slackChannelId: string; /** Thread root ts (a top-level message's own ts) */ threadTs: string; } /** * Build the key for a Slack thread. * * @param slackChannelId - Slack conversation id * @param threadTs - Thread root ts (the message's own ts when top-level) * @returns `:` * * @example * formatSlackThreadKey('D0C31U6JWBF', '1790392986.498639') // 'D0C31U6JWBF:1790392986.498639' */ export declare function formatSlackThreadKey(slackChannelId: string, threadTs: string): string; /** * Parse a key. Tolerates the whole tag being passed (`[SLACK-THREAD:…]`) — * an agent copying from its prompt may take the brackets along. * * @param raw - Key, tag, or anything else * @returns The parts, or null when `raw` is not a Slack thread key */ export declare function parseSlackThreadKey(raw: unknown): SlackThreadKeyParts | null; /** * The tag an agent sees on a delivered Slack message. * * @param slackChannelId - Slack conversation id * @param threadTs - Thread root ts * @returns `[SLACK-THREAD::]` */ export declare function slackThreadTag(slackChannelId: string, threadTs: string): string; /** * Every distinct valid thread key tagged in a text, in order of appearance. * * @param text - Any text (a delivered prompt, a reply) * @returns Parsed keys, de-duplicated */ export declare function extractSlackThreadKeys(text: string): SlackThreadKeyParts[]; /** * The thread a chat-v2 message's metadata names, when it names exactly one. * * Reads the agent-reply field ({@link SLACK_THREAD_KEY_CONSTANTS.METADATA_KEY}) * first, then the inbound Slack correlation fields (`slackChannelId` + * `slackThreadTs`) every bridged Slack turn carries. * * @param metadata - chat-v2 message metadata * @returns The thread, or null */ export declare function slackThreadOfMetadata(metadata: Record | undefined | null): SlackThreadKeyParts | null; /** * Read any reference to a Slack place an agent might hold: a thread key * (`C…:ts`), a `slack-` chat channel id (`slack-C…:ts`, `slack-C…-ts` or * `slack-C…-sec-micro`), or a bare Slack conversation id (`C…`). * * @param raw - Reference * @returns Channel (+ thread ts when the reference names one), or null for anything else */ export declare function parseSlackChannelRef(raw: unknown): { slackChannelId: string; threadTs?: string; } | null; //# sourceMappingURL=slack-thread-key.d.ts.map