/**
 * Pure derivation function that extracts rich per-task detail from
 * the execution event stream and status snapshot.
 *
 * No React dependencies — independently testable and usable outside
 * the inspector component.
 *
 * @since T05 (Runtime Inspector)
 */
import type { WorkflowExecutionEvent } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/event_pb";
import type { WorkflowTask } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/api_pb";
import { WorkflowTaskKind } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/enum_pb";
import type { JsonObject } from "@bufbuild/protobuf";
import type { DerivedTaskState } from "../../internal/store/workflow-execution-event-store.js";
export interface TaskDetail {
    readonly taskName: string;
    readonly taskKind: WorkflowTaskKind;
    readonly displayName: string;
    readonly status: DerivedTaskState["status"];
    readonly summary: TaskDetailSummary;
    readonly input: TaskDetailIO | null;
    readonly output: TaskDetailIO | null;
    readonly error: TaskDetailError | null;
    readonly retries: TaskDetailRetryHistory | null;
    readonly agentCall: TaskDetailAgentCall | null;
    readonly approval: TaskDetailApproval | null;
    readonly eventLog: readonly WorkflowExecutionEvent[];
}
export interface TaskDetailSummary {
    readonly startedAt: string | null;
    readonly completedAt: string | null;
    readonly durationMs: number;
    readonly costMicros: bigint;
    readonly inputTokens: bigint;
    readonly outputTokens: bigint;
    readonly totalTokens: bigint;
    readonly attemptNumber: number;
}
export interface TaskDetailIO {
    readonly data: JsonObject;
    readonly summary: JsonObject | null;
    readonly artifactIds: readonly string[];
    readonly source: "snapshot" | "event-summary";
}
export interface TaskDetailError {
    readonly message: string;
    readonly attemptNumber: number;
    readonly maxAttempts: number;
    readonly willRetry: boolean;
    readonly durationMs: number;
    readonly category: string | null;
    readonly detail: string | null;
}
export interface TaskDetailRetryHistory {
    readonly attempts: readonly TaskDetailRetryAttempt[];
    readonly currentAttempt: number;
}
export interface TaskDetailRetryAttempt {
    readonly attemptNumber: number;
    readonly status: "completed" | "failed";
    readonly durationMs: number;
    readonly error: string;
    readonly delayBeforeMs: number;
    readonly startedAt: string;
}
export interface TaskDetailAgentCall {
    readonly childExecutionId: string;
    readonly agentSlug: string;
    readonly agentPhase: string;
    readonly messagesCount: number;
    readonly toolCallsCount: number;
    readonly tokensConsumed: bigint;
    readonly costMicros: bigint;
    readonly error: string;
    readonly currentToolName: string;
}
export interface TaskDetailApproval {
    readonly prompt: string;
    readonly approvers: readonly string[];
    readonly outcomes: readonly {
        readonly name: string;
        readonly label: string;
    }[];
    readonly formSchema: JsonObject | null;
    readonly timeoutSeconds: number;
    readonly decision: TaskDetailApprovalDecision | null;
}
/**
 * A resolved human_input decision, sourced from the canonical task-output
 * record (the runner stores the reviewer's full response as the task
 * output) and enriched with timing from the `approval_resolved` event.
 *
 * `outcome` is the empty string during the brief window after a decision
 * is signalled but before the status snapshot reflects the task output —
 * consumers render a "finalizing" affordance in that state.
 */
export interface TaskDetailApprovalDecision {
    /** Chosen outcome identifier (e.g. "approve", "pause_campaigns"). */
    readonly outcome: string;
    /** Reviewer who made the decision. */
    readonly reviewer: string;
    /** ISO-8601 timestamp the decision was recorded, or `null`. */
    readonly respondedAt: string | null;
    /** Free-text comment the reviewer attached, or the empty string. */
    readonly comment: string;
    /** Structured form answers submitted with the decision, or `null`. */
    readonly formData: JsonObject | null;
    /** How long the gate was pending, in milliseconds (from the event). */
    readonly waitDurationMs: number;
    /** `true` when a timeout policy resolved the gate without a human. */
    readonly autoResolved: boolean;
}
/**
 * Derives rich per-task detail by joining the event stream with the
 * status snapshot.
 *
 * Returns `null` when no data is available for the given task name
 * (no events AND no snapshot entry).
 */
export declare function deriveTaskDetail(taskName: string, events: readonly WorkflowExecutionEvent[], taskSnapshot: WorkflowTask | undefined, derivedState: DerivedTaskState | undefined): TaskDetail | null;
//# sourceMappingURL=derive-task-detail.d.ts.map