import type { AgentToolResult } from "@earendil-works/pi-agent-core"; import type { SourceReplyDeliveryMode } from "../../auto-reply/get-reply-options.types.js"; import type { InboundEventKind } from "../../channels/inbound-event/kind.js"; import type { ChannelId, ChannelMessageActionName, ChannelThreadingToolContext } from "../../channels/plugins/types.public.js"; import type { KlawConfig } from "../../config/types.klaw.js"; import { type GatewayClientMode, type GatewayClientName } from "../../utils/message-channel.js"; import type { OutboundSendDeps } from "./deliver.js"; import type { MessagePollResult, MessageSendResult } from "./message.js"; export type MessageActionRunnerGateway = { url?: string; token?: string; timeoutMs?: number; clientName: GatewayClientName; clientDisplayName?: string; mode: GatewayClientMode; }; export type RunMessageActionParams = { cfg: KlawConfig; action: ChannelMessageActionName; params: Record; defaultAccountId?: string; requesterAccountId?: string | null; requesterSenderId?: string | null; requesterSenderName?: string | null; requesterSenderUsername?: string | null; requesterSenderE164?: string | null; senderIsOwner?: boolean; sessionId?: string; toolContext?: ChannelThreadingToolContext; gateway?: MessageActionRunnerGateway; deps?: OutboundSendDeps; sessionKey?: string; agentId?: string; sandboxRoot?: string; dryRun?: boolean; sourceReplyDeliveryMode?: SourceReplyDeliveryMode; inboundEventKind?: InboundEventKind; abortSignal?: AbortSignal; }; export type MessageActionRunResult = { kind: "send"; channel: ChannelId; action: "send"; to: string; handledBy: "plugin" | "core" | "internal-source"; payload: unknown; toolResult?: AgentToolResult; 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?: AgentToolResult; pollResult?: MessagePollResult; dryRun: boolean; } | { kind: "action"; channel: ChannelId; action: Exclude; handledBy: "plugin" | "dry-run"; payload: unknown; toolResult?: AgentToolResult; dryRun: boolean; }; export declare function getToolResult(result: MessageActionRunResult): AgentToolResult | undefined; export declare function runMessageAction(input: RunMessageActionParams): Promise;