import type { ReactNode } from "react"; import type { ActivityItem, ToolCallItem, TurnOutcome } from "./types.js"; import type { OpenGeniText } from "../messages/runtime.js"; export declare const BUILT_IN_TURN_SUMMARY_FACET_IDS: readonly ["steps", "files", "commands", "screenshots", "memories", "compacted", "duration"]; export type BuiltInTurnSummaryFacetId = (typeof BUILT_IN_TURN_SUMMARY_FACET_IDS)[number]; export type TurnSummaryContext = Readonly<{ /** Every normalized activity item folded into this summary. */ items: readonly ActivityItem[]; /** Tool calls from `items`, retained in timeline order for convenient aggregation. */ toolCalls: readonly ToolCallItem[]; /** The settled turn verdict, or absent for a neutral/incomplete cluster. */ outcome: TurnOutcome | undefined; /** The bounded failure reason rendered by the enclosing summary, when present. */ failureText: string | undefined; /** Total turn duration when the enclosing group has both valid timestamps. */ durationMs: number | undefined; /** False when any projected activity is still running or streaming. */ settled: boolean; /** * Adjacent compaction landmarks next to this fold. Landmark remains the * primary UI; this is a secondary chip signal only. */ contextCompactionCount: number; /** Text in the host's language, for facets that show words. */ t: OpenGeniText; }>; export type TurnSummaryFacetResult = Readonly<{ icon?: ReactNode; content: ReactNode; ariaLabel?: string; title?: string; }>; export type TurnSummaryFacet = Readonly<{ /** Stable identity used for removal and deterministic de-duplication. */ id: string; /** Return null when this facet has nothing useful to show. */ summarize(context: TurnSummaryContext): TurnSummaryFacetResult | null; }>; type ModifyTurnSummaryFacets = Readonly<{ /** Appended after the remaining built-ins, in supplied order. */ add?: readonly TurnSummaryFacet[]; /** Built-ins to omit before custom facets are appended. */ remove?: readonly BuiltInTurnSummaryFacetId[]; replace?: never; }>; type ReplaceTurnSummaryFacets = Readonly<{ /** The complete ordered facet list. Mutually exclusive with add/remove. */ replace: readonly TurnSummaryFacet[]; add?: never; remove?: never; }>; export type TurnSummaryFacetConfiguration = ModifyTurnSummaryFacets | ReplaceTurnSummaryFacets; export type TurnSummaryOptions = Readonly<{ /** * Readable per-turn presentation. Assistant progress stays fully formatted; * each turn has its own Working / Worked row and rolling latest step. * Ordinary tip-follow and manual scrolling are unchanged. */ rolling?: boolean; facets?: TurnSummaryFacetConfiguration; }>; /** * Exchange status shown in place of the plain facet line. `working` and * `waiting` run a live clock from `since`; `worked` shows the settled span. */ export type TurnSummaryStatus = Readonly<{ kind: "working" | "waiting" | "worked"; /** Replaces the default "Working" / "Waiting" wording. */ label?: string | undefined; /** Who the wait is on: `you` when it needs the reader. */ waitingOn?: "you" | undefined; /** For a `worked` row folding quiet cycles: how many updates it spans. */ updates?: number | undefined; /** Live clock start for `working` and `waiting`. */ since?: string | undefined; /** Settled span for `worked`. */ durationMs?: number | undefined; /** Live step preview under the row while it is collapsed. */ preview?: ReactNode; /** * Guidance under the row that stays visible whether the fold is open or * closed, e.g. what a wait needs from the reader. */ guidance?: ReactNode; }>; /** Elapsed wall time with seconds below an hour: "14s", "2m 14s", "1h 05m". */ /** * The label of a turn row with no status line and no facets. Steps are not * counted, so the row still names what opening it reveals: "Preparation" when * it holds only startup phases (and no unloaded steps), else "Steps". */ export declare function turnSummaryFallbackLabel(t: OpenGeniText, items: readonly ActivityItem[], unloadedSteps?: boolean): string; export declare function formatElapsed(t: OpenGeniText, durationMs: number): string; export declare function createTurnSummaryContext(t: OpenGeniText, items: ActivityItem[], outcome: TurnOutcome | undefined, failureText: string | undefined, durationMs: number | undefined, contextCompactionCount: number): TurnSummaryContext; export declare const BUILT_IN_TURN_SUMMARY_FACETS: readonly TurnSummaryFacet[]; export declare function resolveTurnSummaryFacets(configuration: TurnSummaryFacetConfiguration | undefined): readonly TurnSummaryFacet[]; export declare function formatDurationFacet(t: OpenGeniText, durationMs: number | undefined): string | null; /** * The facets a turn header shows. With a readable status line, duration lives in * the status, and a live or waiting status shows no built-in facets. A failing * custom facet is skipped rather than breaking the header. */ export declare function selectTurnSummaryFacets(definitions: readonly TurnSummaryFacet[], context: TurnSummaryContext, statusKind: TurnSummaryStatus["kind"] | undefined): Array<{ facet: TurnSummaryFacet; result: TurnSummaryFacetResult; }>; export {};