import type { AgentExecution } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
import type { AgentMessage, ToolCall } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/message_pb";
import type { SubAgentExecution } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/subagent_pb";
import type { PendingApproval } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/approval_pb";
import { ApprovalAction, ExecutionPhase } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
import type { WorkspaceEntry } from "@stigmer/protos/ai/stigmer/agentic/session/v1/workspace_pb";
import type { ResolvedPathAction } from "./file-path-resolver";
/** Props for {@link MessageThread}. */
export interface MessageThreadProps {
    /** Completed executions in chronological order. */
    readonly executions: readonly AgentExecution[];
    /**
     * The currently streaming execution. Appended after `executions` to
     * form a continuous thread. Pass `null` or `undefined` when no
     * execution is actively streaming.
     */
    readonly activeStreamExecution?: AgentExecution | null;
    /**
     * Optimistic user message shown at the end of the thread before the
     * stream delivers the real message. Rendered as a human message with
     * a sending indicator. Clear this prop once the stream delivers its
     * first snapshot.
     */
    readonly pendingUserMessage?: string | null;
    /** Additional CSS class names for the root container. */
    readonly className?: string;
    /**
     * Custom formatter for tool call summary labels. Passed through to
     * each {@link ToolCallGroup}.
     */
    readonly formatToolCallSummary?: (toolCalls: readonly ToolCall[]) => string;
    /**
     * Callback for approval actions. When provided and the active
     * execution has pending approvals, {@link ApprovalCard}s are
     * rendered as thread items. When omitted, no approval UI is
     * shown (backward compatible).
     */
    readonly onApprovalSubmit?: (toolCallId: string, action: ApprovalAction, comment?: string) => void;
    /**
     * Set of tool call IDs currently being submitted for approval.
     * Drives per-card loading state. Only meaningful when
     * `onApprovalSubmit` is provided.
     */
    readonly submittingApprovalIds?: ReadonlySet<string>;
    /**
     * Workspace entries from the session spec. When provided, file
     * paths in tool call rendering become interactive — git-sourced
     * paths open on GitHub, local paths offer copy-to-clipboard.
     *
     * Passed to {@link FilePathContext} for consumption by
     * {@link FilePathLink} components deep in the tree.
     */
    readonly workspaceEntries?: readonly WorkspaceEntry[];
    /**
     * Optional override for file path click behavior. Platform
     * builders use this to integrate their own file viewer or
     * navigation instead of the default open-URL / copy-to-clipboard.
     */
    readonly onFilePathClick?: (path: string, resolved: ResolvedPathAction) => void;
    /**
     * Absolute sandbox workspace root (e.g. `/home/daytona/workspace`).
     * When provided, shell commands and tool output normalize absolute
     * sandbox paths to workspace-relative display paths.
     *
     * Pass an empty string or omit for local sessions where paths are
     * the user's own filesystem (no normalization needed).
     */
    readonly sandboxWorkspaceRoot?: string;
    /**
     * Enable virtualized rendering for long conversations. Requires
     * `react-virtuoso` to be installed as a peer dependency. When
     * enabled, only visible items are rendered in the DOM, improving
     * performance for threads with 100+ items.
     *
     * @default false
     */
    readonly virtualized?: boolean;
}
/**
 * Flattened representation of one renderable item in the thread.
 *
 * Discriminated union keeps the render loop a simple switch with no
 * type narrowing gymnastics.
 *
 * @internal Exported for internal use by `VirtualizedThread` — not
 * part of the public API.
 */
export type ThreadItem = {
    readonly kind: "message";
    readonly message: AgentMessage;
    readonly key: string;
    readonly isPending?: boolean;
} | {
    readonly kind: "tool-group";
    readonly toolCalls: readonly ToolCall[];
    readonly subAgentExecutions: readonly SubAgentExecution[];
    readonly key: string;
} | {
    readonly kind: "sub-agent";
    readonly subAgentExecution: SubAgentExecution;
    readonly key: string;
} | {
    readonly kind: "phase-badge";
    readonly phase: ExecutionPhase;
    readonly key: string;
} | {
    readonly kind: "approval-request";
    readonly pendingApproval: PendingApproval;
    readonly key: string;
} | {
    readonly kind: "setup-progress";
    readonly workspaceEntries: readonly WorkspaceEntry[];
    readonly serverPhase?: string;
    readonly key: string;
};
/**
 * Builds a flat list of renderable thread items from execution data.
 *
 * Keys use stable execution IDs (not array indices) so React can
 * reconcile items across renders without unnecessary remounts.
 *
 * @internal Exported for testing — not part of the public API.
 */
export declare function buildThreadItems(executions: readonly AgentExecution[], activeStreamExecution: AgentExecution | null | undefined, pendingUserMessage: string | null | undefined, includeApprovals: boolean, workspaceEntries: readonly WorkspaceEntry[] | undefined): ThreadItem[];
/**
 * Renders a continuous conversation thread from one or more
 * {@link AgentExecution} snapshots.
 *
 * Composes {@link MessageEntry}, {@link ToolCallGroup}, and
 * {@link ExecutionPhaseBadge} into a scrollable, auto-scrolling log
 * that follows new content when the user is near the bottom.
 *
 * Renders nothing when no executions are provided.
 *
 * All visual properties flow through `--stgm-*` tokens.
 *
 * @example
 * ```tsx
 * const { executions } = useSessionExecutions(sessionId);
 * const stream = useExecutionStream(activeId);
 *
 * <MessageThread
 *   executions={executions ?? []}
 *   activeStreamExecution={stream.execution}
 * />
 * ```
 */
export declare function MessageThread({ executions, activeStreamExecution, pendingUserMessage, className, formatToolCallSummary, onApprovalSubmit, submittingApprovalIds, workspaceEntries, onFilePathClick, sandboxWorkspaceRoot, virtualized, }: MessageThreadProps): import("react/jsx-runtime").JSX.Element;
/**
 * Props for {@link ThreadItemRenderer}.
 *
 * @internal Exported for internal use by `VirtualizedThread` — not
 * part of the public API.
 */
export interface ThreadItemRendererProps {
    readonly item: ThreadItem;
    readonly formatToolCallSummary?: (toolCalls: readonly ToolCall[]) => string;
    readonly onApprovalSubmit?: (toolCallId: string, action: ApprovalAction, comment?: string) => void;
    readonly submittingApprovalIds?: ReadonlySet<string>;
}
/**
 * Renders a single thread item by discriminated `kind`. Used by both
 * the non-virtualized `items.map()` path and the virtualized
 * `Virtuoso.itemContent` callback.
 *
 * Does not receive a `key` prop — the caller is responsible for
 * keying (either via `items.map` or `computeItemKey`).
 *
 * @internal Exported for internal use by `VirtualizedThread` — not
 * part of the public API.
 */
export declare function ThreadItemRenderer({ item, formatToolCallSummary, onApprovalSubmit, submittingApprovalIds, }: ThreadItemRendererProps): import("react/jsx-runtime").JSX.Element;
//# sourceMappingURL=MessageThread.d.ts.map