import { r as Chat, R as ChannelVisibility } from '../chat-D9UYaaNO.js';
export { g as AiAssistantMessage, h as AiFilePart, i as AiImagePart, j as AiMessage, k as AiMessagePart, l as AiTextPart, m as AiUserMessage, n as ToAiMessagesOptions, t as toAiMessages } from '../chat-D9UYaaNO.js';
import * as ai from 'ai';
import { Tool } from 'ai';
import '@workflow/serde';
import 'mdast';
import '../jsx-runtime-CFq1K_Ve.js';

/**
 * The Chat instance used by all tools to dispatch operations.
 * Always typed as `Chat<any, any>` so callers can pass strongly-typed
 * `Chat` instances without having to repeat their adapter/state generics.
 */
type ChatBinding = Chat<any, any>;
/**
 * Common options for write tools that may require approval before executing.
 */
interface ToolOptions {
    needsApproval?: boolean;
}
/**
 * Per-tool overrides for customizing tool behavior without changing the
 * underlying implementation. `execute`, `inputSchema`, and `outputSchema`
 * are intentionally excluded so tool semantics stay stable.
 */
type ToolOverrides = Partial<Pick<Tool, "description" | "inputExamples" | "metadata" | "needsApproval" | "onInputAvailable" | "onInputDelta" | "onInputStart" | "providerOptions" | "strict" | "title" | "toModelOutput">>;

declare const getChannelInfo: (chat: ChatBinding) => ai.Tool<{
    channelId: string;
}, {
    id: string;
    name: string | undefined;
    isDM: boolean;
    memberCount: number | undefined;
    channelVisibility: ChannelVisibility | undefined;
}>;

declare const postMessage: (chat: ChatBinding, { needsApproval }?: ToolOptions) => ai.Tool<{
    threadId: string;
    message: string | {
        markdown: string;
    } | {
        raw: string;
    };
}, {
    messageId: string;
    threadId: string;
}>;
declare const postChannelMessage: (chat: ChatBinding, { needsApproval }?: ToolOptions) => ai.Tool<{
    channelId: string;
    message: string | {
        markdown: string;
    } | {
        raw: string;
    };
}, {
    messageId: string;
    threadId: string;
}>;
declare const sendDirectMessage: (chat: ChatBinding, { needsApproval }?: ToolOptions) => ai.Tool<{
    userId: string;
    message: string | {
        markdown: string;
    } | {
        raw: string;
    };
}, {
    messageId: string;
    threadId: string;
}>;
declare const editMessage: (chat: ChatBinding, { needsApproval }?: ToolOptions) => ai.Tool<{
    threadId: string;
    messageId: string;
    message: string | {
        markdown: string;
    } | {
        raw: string;
    };
}, {
    messageId: string;
    threadId: string;
}>;
declare const deleteMessage: (chat: ChatBinding, { needsApproval }?: ToolOptions) => ai.Tool<{
    threadId: string;
    messageId: string;
}, {
    deleted: boolean;
    messageId: string;
    threadId: string;
}>;

declare const addReaction: (chat: ChatBinding, { needsApproval }?: ToolOptions) => ai.Tool<{
    threadId: string;
    messageId: string;
    emoji: string;
}, {
    added: boolean;
    emoji: string;
    messageId: string;
    threadId: string;
}>;
declare const removeReaction: (chat: ChatBinding, { needsApproval }?: ToolOptions) => ai.Tool<{
    threadId: string;
    messageId: string;
    emoji: string;
}, {
    removed: boolean;
    emoji: string;
    messageId: string;
    threadId: string;
}>;

declare const fetchMessages: (chat: ChatBinding) => ai.Tool<{
    threadId: string;
    limit: number;
    direction: "forward" | "backward";
    cursor?: string | undefined;
}, {
    messages: {
        id: string;
        threadId: string;
        text: string;
        author: {
            userId: string;
            userName: string;
            fullName: string;
            isBot: boolean | "unknown";
            isMe: boolean;
        };
        dateSent: string;
        edited: boolean;
        isMention: boolean | undefined;
        attachments: {
            type: "file" | "image" | "video" | "audio";
            name: string | undefined;
            mimeType: string | undefined;
            url: string | undefined;
        }[];
    }[];
    nextCursor: string | undefined;
}>;
declare const fetchChannelMessages: (chat: ChatBinding) => ai.Tool<{
    channelId: string;
    limit: number;
    direction: "forward" | "backward";
    cursor?: string | undefined;
}, {
    messages: any;
    nextCursor: any;
}>;
declare const fetchThread: (chat: ChatBinding) => ai.Tool<{
    threadId: string;
}, {
    id: string;
    channelId: string;
    channelName: string | undefined;
    channelVisibility: ChannelVisibility | undefined;
    isDM: boolean;
}>;
declare const listThreads: (chat: ChatBinding) => ai.Tool<{
    channelId: string;
    limit: number;
    cursor?: string | undefined;
}, {
    threads: any;
    nextCursor: any;
}>;
declare const getThreadParticipants: (chat: ChatBinding) => ai.Tool<{
    threadId: string;
}, {
    participants: {
        userId: string;
        userName: string;
        fullName: string;
        isBot: boolean | "unknown";
    }[];
}>;
declare const subscribeThread: (chat: ChatBinding, { needsApproval }?: ToolOptions) => ai.Tool<{
    threadId: string;
}, {
    subscribed: boolean;
    threadId: string;
}>;
declare const unsubscribeThread: (chat: ChatBinding, { needsApproval }?: ToolOptions) => ai.Tool<{
    threadId: string;
}, {
    subscribed: boolean;
    threadId: string;
}>;
declare const startTyping: (chat: ChatBinding) => ai.Tool<{
    threadId: string;
    status?: string | undefined;
}, {
    typing: boolean;
    threadId: string;
}>;

declare const getUser: (chat: ChatBinding) => ai.Tool<{
    userId: string;
}, {
    userId: string;
    userName: string;
    fullName: string;
    email: string | undefined;
    isBot: boolean;
    avatarUrl: string | undefined;
} | null>;

type ChatToolName = "fetchMessages" | "fetchChannelMessages" | "fetchThread" | "listThreads" | "getThreadParticipants" | "getChannelInfo" | "getUser" | "startTyping" | "postMessage" | "postChannelMessage" | "sendDirectMessage" | "editMessage" | "deleteMessage" | "addReaction" | "removeReaction" | "subscribeThread" | "unsubscribeThread";
/**
 * Names of every tool that mutates platform state.
 * These default to `needsApproval: true` and can be toggled via
 * `requireApproval` on {@link createChatTools}.
 */
type ChatWriteToolName = "postMessage" | "postChannelMessage" | "sendDirectMessage" | "editMessage" | "deleteMessage" | "addReaction" | "removeReaction" | "subscribeThread" | "unsubscribeThread";
/**
 * Whether write operations require user approval.
 *
 * - `true`  — every write tool needs approval (default)
 * - `false` — no write tool needs approval
 * - object  — per-tool override; unspecified write tools default to `true`
 *
 * @example
 * ```ts
 * requireApproval: {
 *   deleteMessage: true,
 *   postMessage: false,
 *   sendDirectMessage: false,
 *   addReaction: false,
 * }
 * ```
 */
type ApprovalConfig = boolean | Partial<Record<ChatWriteToolName, boolean>>;
/**
 * Predefined tool presets for common chat-agent use cases.
 *
 * - `'reader'`    — read-only: fetch threads, messages, channel info, users
 * - `'messenger'` — basic posting: post in thread/channel, DM, react, typing
 * - `'moderator'` — full management: read + write + edit/delete + subscriptions
 */
type ChatToolPreset = "reader" | "messenger" | "moderator";
interface ChatToolsOptions {
    /** The Chat instance the tools dispatch operations against. */
    chat: ChatBinding;
    /**
     * Per-tool overrides for customizing tool behavior (description, title,
     * needsApproval, etc.) without changing the underlying implementation.
     * Core tool fields cannot be overridden.
     *
     * @example
     * ```ts
     * createChatTools({
     *   chat,
     *   overrides: {
     *     deleteMessage: { needsApproval: false },
     *     postMessage: { description: 'Reply in the active support thread.' },
     *   },
     * })
     * ```
     */
    overrides?: Partial<Record<ChatToolName, ToolOverrides>>;
    /**
     * Restrict the returned tools to a predefined preset.
     * Omit to get all tools (same as `'moderator'`).
     *
     * @example
     * ```ts
     * createChatTools({ chat, preset: 'reader' })
     * createChatTools({ chat, preset: ['reader', 'messenger'] })
     * ```
     */
    preset?: ChatToolPreset | ChatToolPreset[];
    /**
     * Whether write operations require user approval before executing.
     * Defaults to `true` for all write tools.
     *
     * @see {@link ApprovalConfig}
     */
    requireApproval?: ApprovalConfig;
}
/**
 * Create a set of Chat SDK tools for the Vercel AI SDK.
 *
 * Lets an AI agent operate inside a workspace: read messages, post replies,
 * send DMs, react, edit, delete, and manage thread subscriptions across
 * every adapter the supplied {@link ChatBinding} has registered.
 *
 * Write operations require user approval by default. Control this globally
 * or per-tool via `requireApproval`. Use `preset` to scope the toolset.
 *
 * @example
 * ```ts
 * import { Chat } from 'chat'
 * import { createChatTools } from 'chat/ai'
 * import { generateText } from 'ai'
 *
 * const chat = new Chat({ ... })
 *
 * const result = await generateText({
 *   model: yourModel,
 *   tools: createChatTools({ chat, preset: 'messenger' }),
 *   prompt: 'Reply in thread slack:C123:1234.5678 with the daily summary.',
 * })
 * ```
 *
 * @example Granular approval
 * ```ts
 * createChatTools({
 *   chat,
 *   preset: 'moderator',
 *   requireApproval: {
 *     deleteMessage: true,
 *     editMessage: true,
 *     postMessage: false,
 *     addReaction: false,
 *   },
 * })
 * ```
 */
declare function createChatTools({ chat, requireApproval, preset, overrides, }: ChatToolsOptions): Partial<{
    fetchMessages: ai.Tool<{
        threadId: string;
        limit: number;
        direction: "forward" | "backward";
        cursor?: string | undefined;
    }, {
        messages: {
            id: string;
            threadId: string;
            text: string;
            author: {
                userId: string;
                userName: string;
                fullName: string;
                isBot: boolean | "unknown";
                isMe: boolean;
            };
            dateSent: string;
            edited: boolean;
            isMention: boolean | undefined;
            attachments: {
                type: "file" | "image" | "video" | "audio";
                name: string | undefined;
                mimeType: string | undefined;
                url: string | undefined;
            }[];
        }[];
        nextCursor: string | undefined;
    }>;
    fetchChannelMessages: ai.Tool<{
        channelId: string;
        limit: number;
        direction: "forward" | "backward";
        cursor?: string | undefined;
    }, {
        messages: any;
        nextCursor: any;
    }>;
    fetchThread: ai.Tool<{
        threadId: string;
    }, {
        id: string;
        channelId: string;
        channelName: string | undefined;
        channelVisibility: ChannelVisibility | undefined;
        isDM: boolean;
    }>;
    listThreads: ai.Tool<{
        channelId: string;
        limit: number;
        cursor?: string | undefined;
    }, {
        threads: any;
        nextCursor: any;
    }>;
    getThreadParticipants: ai.Tool<{
        threadId: string;
    }, {
        participants: {
            userId: string;
            userName: string;
            fullName: string;
            isBot: boolean | "unknown";
        }[];
    }>;
    getChannelInfo: ai.Tool<{
        channelId: string;
    }, {
        id: string;
        name: string | undefined;
        isDM: boolean;
        memberCount: number | undefined;
        channelVisibility: ChannelVisibility | undefined;
    }>;
    getUser: ai.Tool<{
        userId: string;
    }, {
        userId: string;
        userName: string;
        fullName: string;
        email: string | undefined;
        isBot: boolean;
        avatarUrl: string | undefined;
    } | null>;
    startTyping: ai.Tool<{
        threadId: string;
        status?: string | undefined;
    }, {
        typing: boolean;
        threadId: string;
    }>;
    postMessage: ai.Tool<{
        threadId: string;
        message: string | {
            markdown: string;
        } | {
            raw: string;
        };
    }, {
        messageId: string;
        threadId: string;
    }>;
    postChannelMessage: ai.Tool<{
        channelId: string;
        message: string | {
            markdown: string;
        } | {
            raw: string;
        };
    }, {
        messageId: string;
        threadId: string;
    }>;
    sendDirectMessage: ai.Tool<{
        userId: string;
        message: string | {
            markdown: string;
        } | {
            raw: string;
        };
    }, {
        messageId: string;
        threadId: string;
    }>;
    editMessage: ai.Tool<{
        threadId: string;
        messageId: string;
        message: string | {
            markdown: string;
        } | {
            raw: string;
        };
    }, {
        messageId: string;
        threadId: string;
    }>;
    deleteMessage: ai.Tool<{
        threadId: string;
        messageId: string;
    }, {
        deleted: boolean;
        messageId: string;
        threadId: string;
    }>;
    addReaction: ai.Tool<{
        threadId: string;
        messageId: string;
        emoji: string;
    }, {
        added: boolean;
        emoji: string;
        messageId: string;
        threadId: string;
    }>;
    removeReaction: ai.Tool<{
        threadId: string;
        messageId: string;
        emoji: string;
    }, {
        removed: boolean;
        emoji: string;
        messageId: string;
        threadId: string;
    }>;
    subscribeThread: ai.Tool<{
        threadId: string;
    }, {
        subscribed: boolean;
        threadId: string;
    }>;
    unsubscribeThread: ai.Tool<{
        threadId: string;
    }, {
        subscribed: boolean;
        threadId: string;
    }>;
}>;
/** The shape of the object returned by {@link createChatTools}. */
type ChatTools = ReturnType<typeof createChatTools>;

export { type ApprovalConfig, type ChatBinding, type ChatToolName, type ChatToolPreset, type ChatTools, type ChatToolsOptions, type ChatWriteToolName, type ToolOptions, type ToolOverrides, addReaction, createChatTools, deleteMessage, editMessage, fetchChannelMessages, fetchMessages, fetchThread, getChannelInfo, getThreadParticipants, getUser, listThreads, postChannelMessage, postMessage, removeReaction, sendDirectMessage, startTyping, subscribeThread, unsubscribeThread };
