/** * Slack text utilities shared by the Socket Mode client and the one-shot * `pitag send` path. */ /** * chat.postMessage truncates `text` at 40,000 but chat.update rejects at * 4,000, and markdown_text caps at 12,000 — take the strictest so every * outbound path is safe. */ export declare const SLACK_MAX_MESSAGE_LENGTH = 4000; /** Split a message at newline boundaries, hard-splitting only when forced. */ export declare function splitMessage(text: string, max?: number): string[]; /** * Undo Slack's inbound message encoding so pi sees what the human typed. * * Slack escapes `&`, `<`, `>` as HTML entities and wraps links/refs in * angle-bracket syntax (https://docs.slack.dev/messaging/formatting-message-text). * User mentions (`<@U…>`) are intentionally left intact — the bot's own * mention is handled on the raw text by resolveInboundContent, and other * mentions pass through verbatim like the Discord gateway did. */ export declare function normalizeSlackText(text: string): string; /** * Build the agent-facing content from RAW inbound Slack text. * * Bot-mention handling must run on the raw text, BEFORE entity decoding: a * real mention arrives as `<@U…>` while the same characters typed literally * (e.g. quoting a payload or writing `<@U…>` in backticks) arrive escaped as * `<@U…>`. Matching first guarantees decoded literal text can never * false-trigger the bot. A real mention is stripped and translated to the * `@` prefix (unless one is already present) so downstream * trigger checks treat mention and prefix identically. */ export declare function resolveInboundContent(rawText: string, opts: { botUserId: string; triggerName: string; }): string; export interface ExtractedFileUris { /** Decoded local filesystem paths referenced via file:// URIs */ paths: string[]; /** The text with those references replaced by plain file names */ text: string; } /** * Detect `file://` references in an agent response. * * A file:// link is meaningless to Slack recipients (it points at the * gateway's own disk), so any such reference is treated as "the agent wants * to share this file": the caller uploads the paths as real attachments and * posts the cleaned text instead. */ export declare function extractFileUris(text: string): ExtractedFileUris; /** * Pattern matching the trigger name at the start of a message. The trigger is * "calling the bot by name", so both `@Coly …` and the bare `Coly …` work * (mid-sentence occurrences never trigger). */ export declare function buildTriggerPattern(triggerName: string): RegExp; /** Whether the RAW (pre-decode) event text explicitly mentions the bot. */ export declare function containsBotMention(rawText: string, botUserId: string): boolean; export declare function escapeRegExp(text: string): string;