/**
 * Message action runner — executes channel-level tool calls (send, poll, react, pin, etc.).
 *
 * When the koi invokes the `message` tool, the gateway routes the action here.
 * This module resolves parameters, validates targets, delegates to the appropriate
 * channel plugin, and returns structured results back to the koi.
 *
 * Supports 30+ action types across all channel plugins (Discord, Telegram, Slack,
 * WhatsApp, Signal, iMessage, etc.) including sends, reactions, threads, polls,
 * channel management, and search.
 *
 * @module
 */
import type { AgentToolResult as KoiToolResult } from "@mariozechner/pi-agent-core";
import type { ChannelId, ChannelMessageActionName, ChannelThreadingToolContext } from "../../channels/plugins/types.js";
import type { SKYKOIConfig } from "../../config/config.js";
import type { OutboundSendDeps } from "./deliver.js";
import type { MessagePollResult, MessageSendResult } from "./message.js";
import { type GatewayClientMode, type GatewayClientName } from "../../utils/message-channel.js";
export type MessageActionRunnerGateway = {
    url?: string;
    token?: string;
    timeoutMs?: number;
    clientName: GatewayClientName;
    clientDisplayName?: string;
    mode: GatewayClientMode;
};
export type RunMessageActionParams = {
    cfg: SKYKOIConfig;
    action: ChannelMessageActionName;
    params: Record<string, unknown>;
    defaultAccountId?: string;
    toolContext?: ChannelThreadingToolContext;
    gateway?: MessageActionRunnerGateway;
    deps?: OutboundSendDeps;
    sessionKey?: string;
    koiId?: string;
    sandboxRoot?: string;
    dryRun?: boolean;
    abortSignal?: AbortSignal;
};
export type MessageActionRunResult = {
    kind: "send";
    channel: ChannelId;
    action: "send";
    to: string;
    handledBy: "plugin" | "core";
    payload: unknown;
    toolResult?: KoiToolResult<unknown>;
    sendResult?: MessageSendResult;
    dryRun: boolean;
} | {
    kind: "broadcast";
    channel: ChannelId;
    action: "broadcast";
    handledBy: "core" | "dry-run";
    payload: {
        results: Array<{
            channel: ChannelId;
            to: string;
            ok: boolean;
            error?: string;
            result?: MessageSendResult;
        }>;
    };
    dryRun: boolean;
} | {
    kind: "poll";
    channel: ChannelId;
    action: "poll";
    to: string;
    handledBy: "plugin" | "core";
    payload: unknown;
    toolResult?: KoiToolResult<unknown>;
    pollResult?: MessagePollResult;
    dryRun: boolean;
} | {
    kind: "action";
    channel: ChannelId;
    action: Exclude<ChannelMessageActionName, "send" | "poll">;
    handledBy: "plugin" | "dry-run";
    payload: unknown;
    toolResult?: KoiToolResult<unknown>;
    dryRun: boolean;
};
export declare function getToolResult(result: MessageActionRunResult): KoiToolResult<unknown> | undefined;
export declare function runMessageAction(input: RunMessageActionParams): Promise<MessageActionRunResult>;
