import type { ImageContent } from "@mariozechner/pi-ai"; import type { ReasoningLevel, ThinkLevel, VerboseLevel } from "../../../auto-reply/thinking.js"; import type { ClawdbotConfig } from "../../../config/config.js"; import type { AgentStreamParams } from "../../../commands/agent/types.js"; import type { enqueueCommand } from "../../../process/command-queue.js"; import type { ExecElevatedDefaults, ExecToolDefaults } from "../../bash-tools.js"; import type { BlockReplyChunking, ToolResultFormat } from "../../pi-embedded-subscribe.js"; import type { SkillSnapshot } from "../../skills.js"; // Simplified tool definition for client-provided tools (OpenResponses hosted tools) export type ClientToolDefinition = { type: "function"; function: { name: string; description?: string; parameters?: Record; }; }; export type RunEmbeddedPiAgentParams = { sessionId: string; sessionKey?: string; messageChannel?: string; messageProvider?: string; agentAccountId?: string; /** Delivery target (e.g. telegram:group:123:topic:456) for topic/thread routing. */ messageTo?: string; /** Thread/topic identifier for routing replies to the originating thread. */ messageThreadId?: string | number; /** Current channel ID for auto-threading (Slack). */ currentChannelId?: string; /** Current thread timestamp for auto-threading (Slack). */ currentThreadTs?: string; /** Reply-to mode for Slack auto-threading. */ replyToMode?: "off" | "first" | "all"; /** Mutable ref to track if a reply was sent (for "first" mode). */ hasRepliedRef?: { value: boolean }; sessionFile: string; workspaceDir: string; agentDir?: string; config?: ClawdbotConfig; skillsSnapshot?: SkillSnapshot; prompt: string; images?: ImageContent[]; /** Optional client-provided tools (OpenResponses hosted tools). */ clientTools?: ClientToolDefinition[]; provider?: string; model?: string; authProfileId?: string; authProfileIdSource?: "auto" | "user"; thinkLevel?: ThinkLevel; verboseLevel?: VerboseLevel; reasoningLevel?: ReasoningLevel; toolResultFormat?: ToolResultFormat; execOverrides?: Pick; bashElevated?: ExecElevatedDefaults; timeoutMs: number; runId: string; abortSignal?: AbortSignal; shouldEmitToolResult?: () => boolean; shouldEmitToolOutput?: () => boolean; onPartialReply?: (payload: { text?: string; mediaUrls?: string[] }) => void | Promise; onAssistantMessageStart?: () => void | Promise; onBlockReply?: (payload: { text?: string; mediaUrls?: string[]; audioAsVoice?: boolean; replyToId?: string; replyToTag?: boolean; replyToCurrent?: boolean; }) => void | Promise; onBlockReplyFlush?: () => void | Promise; blockReplyBreak?: "text_end" | "message_end"; blockReplyChunking?: BlockReplyChunking; onReasoningStream?: (payload: { text?: string; mediaUrls?: string[] }) => void | Promise; onToolResult?: (payload: { text?: string; mediaUrls?: string[] }) => void | Promise; onAgentEvent?: (evt: { stream: string; data: Record }) => void; lane?: string; enqueue?: typeof enqueueCommand; extraSystemPrompt?: string; streamParams?: AgentStreamParams; ownerNumbers?: string[]; enforceFinalTag?: boolean; };