executeWithTrackedPromptExecutor

open suspend override fun <T> executeWithTrackedPromptExecutor(name: String, retryPolicy: RetryPolicy?, execute: suspend (CapturingPromptExecutor) -> T): Result<T>

Runs execute against a fresh consumption-capturing executor and records exactly one leaf entry under the current stage — PromptExecutionRecord.Completed on success, or PromptExecutionRecord.Failed on any failure. Shared by executePrompt and executePromptStructured.

Transient-failure retries are applied automatically per the session's retry policy (overridable via retryPolicy); per-attempt detail lives in the resulting record's previousAttempts.

Abort handling. Mirrors runAgent: ExecutionAbortException thrown by execute is caught by retryWith's onAbort hook (records a PromptExecutionRecord.Failed with the abort's resolvedId + every preceding retry attempt), then rethrown.