import type { AgentMessage } from "@mariozechner/pi-agent-core";
import type { Api, AssistantMessage, Model } from "@mariozechner/pi-ai";
import type { AuthStorage, ModelRegistry } from "@mariozechner/pi-coding-agent";
import type { ThinkLevel } from "../../../auto-reply/thinking.js";
import type { SessionSystemPromptReport } from "../../../config/sessions/types.js";
import type { PluginHookBeforeAgentStartResult } from "../../../plugins/types.js";
import type { MessagingToolSend } from "../../pi-embedded-messaging.js";
import type { NormalizedUsage } from "../../usage.js";
import type { RunEmbeddedPiAgentParams } from "./params.js";
type EmbeddedRunAttemptBase = Omit<RunEmbeddedPiAgentParams, "provider" | "model" | "authProfileId" | "authProfileIdSource" | "thinkLevel" | "lane" | "enqueue">;
export type EmbeddedRunAttemptParams = EmbeddedRunAttemptBase & {
    provider: string;
    modelId: string;
    model: Model<Api>;
    authStorage: AuthStorage;
    modelRegistry: ModelRegistry;
    thinkLevel: ThinkLevel;
    legacyBeforeAgentStartResult?: PluginHookBeforeAgentStartResult;
};
export type EmbeddedRunAttemptResult = {
    aborted: boolean;
    timedOut: boolean;
    /** True when the LLM idle watchdog caused the timeout. */
    idleTimedOut?: boolean;
    /** True if the timeout occurred while compaction was in progress or pending. */
    timedOutDuringCompaction: boolean;
    promptError: unknown;
    sessionIdUsed: string;
    systemPromptReport?: SessionSystemPromptReport;
    messagesSnapshot: AgentMessage[];
    assistantTexts: string[];
    toolMetas: Array<{
        toolName: string;
        meta?: string;
    }>;
    lastAssistant: AssistantMessage | undefined;
    lastToolError?: {
        toolName: string;
        meta?: string;
        error?: string;
        mutatingAction?: boolean;
        actionFingerprint?: string;
    };
    didSendViaMessagingTool: boolean;
    messagingToolSentTexts: string[];
    messagingToolSentMediaUrls: string[];
    messagingToolSentTargets: MessagingToolSend[];
    successfulCronAdds?: number;
    cloudCodeAssistFormatError: boolean;
    attemptUsage?: NormalizedUsage;
    compactionCount?: number;
    compactionTokensAfter?: number;
    /** Client tool call detected (OpenResponses hosted tools). */
    clientToolCall?: {
        name: string;
        params: Record<string, unknown>;
    };
    /** Replay metadata used when retrying an incomplete attempt on another auth profile. */
    replayMetadata?: Record<string, unknown>;
    /** Optional item lifecycle counters from streaming providers. */
    itemLifecycle?: {
        startedCount: number;
        completedCount: number;
        activeCount: number;
    };
};
export {};
