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 { ContextEngine } from "../../../context-engine/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; export type EmbeddedRunAttemptParams = EmbeddedRunAttemptBase & { /** Pluggable context engine for ingest/assemble/compact lifecycle. */ contextEngine?: ContextEngine; /** Resolved model context window in tokens for assemble/compact budgeting. */ contextTokenBudget?: number; /** Auth profile resolved for this attempt's provider/model call. */ authProfileId?: string; /** Source for the resolved auth profile (user-locked or automatic). */ authProfileIdSource?: "auto" | "user"; provider: string; modelId: string; model: Model; authStorage: AuthStorage; modelRegistry: ModelRegistry; thinkLevel: ThinkLevel; legacyBeforeAgentStartResult?: PluginHookBeforeAgentStartResult; }; export type EmbeddedRunAttemptResult = { aborted: boolean; timedOut: boolean; /** True if the timeout occurred while compaction was in progress or pending. */ timedOutDuringCompaction: boolean; promptError: unknown; sessionIdUsed: string; bootstrapPromptWarningSignaturesSeen?: string[]; bootstrapPromptWarningSignature?: 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; didSendDeterministicApprovalPrompt?: boolean; messagingToolSentTexts: string[]; messagingToolSentMediaUrls: string[]; messagingToolSentTargets: MessagingToolSend[]; successfulCronAdds?: number; cloudCodeAssistFormatError: boolean; attemptUsage?: NormalizedUsage; compactionCount?: number; promptChars?: number; promptImageCount?: number; /** Client tool call detected (OpenResponses hosted tools). */ clientToolCall?: { name: string; params: Record; }; }; export {};