import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import{type LyraSpan}from'./span.js';export type{LyraSpan}from'./span.js';export interface LyraTraceTreeEventMap{'lr-span-select':CustomEvent<{spanId:string;}>;'lr-span-toggle':CustomEvent<{spanId:string;expanded:boolean;}>;} /** * `` — a collapsible span hierarchy for one agent/LLM trace * (Langfuse/LangSmith run-tree style): kind icon, name, status, an inline * duration bar on the shared trace time scale, and optional tokens/cost * columns. Consumes the same `LyraSpan[]` as ``. * * Public collection properties take bounded, clone-owned readonly snapshots. Create a new * collection and reassign it after changes; mutating the assigned array does not update the view. * * Duration bars always scale to the whole trace, including spans the 500-row ceiling drops, so a * truncated tail never stretches the surviving bars across their tracks. * * @customElement lr-trace-tree * @event lr-span-select - `detail: { spanId }` — a row was activated (click, Enter, Space). * @event lr-span-toggle - `detail: { spanId, expanded }` — a row was expanded or collapsed. * @csspart base - The root wrapper (`role="tree"`). * @csspart header - The column-header row, rendered only when `showTokens`/`showCost` is on. * @csspart row - One span's row (`role="treeitem"`). * @csspart toggle - A row's expand/collapse button. * @csspart icon - The span-kind icon. * @csspart name - The span's name. * @csspart detail - The span's secondary text, from `LyraSpan.detail`. * @csspart status-text - The visible status label. * @csspart duration - The formatted duration text. * @csspart tokens-in - The tokens-in column cell (when `showTokens`). * @csspart tokens-out - The tokens-out column cell (when `showTokens`). * @csspart cost - The cost column cell (when `showCost`). * @csspart bar-track - The duration bar's background track. * @csspart bar - The duration bar's filled portion. * @csspart empty - The empty-state message shown when `spans` is empty. * @csspart limit - Localized notice shown when the shared 500-span projection ceiling is reached. * @csspart live-region - The internal status-announcement live region. * @cssprop [--lr-trace-tree-row-active-bg=var(--lr-color-brand-quiet)] - Background of the active * (`activeSpanId`) row. Shadow Parts forbids an attribute selector after `::part()`, so the active * row could otherwise only be restyled by hijacking the library-wide `--lr-color-brand-quiet` token. * Pairs with `--lr-trace-tree-row-active-color`: set both together, since the defaults assume the * active background stays on the same side of the lightness midpoint as the ambient surface — a * dark tint in light mode needs the matching text color set too, or the row's secondary text drops * below the WCAG AA contrast floor. * @cssprop [--lr-trace-tree-row-active-color=var(--lr-color-text)] - Foreground reference for the * active (`activeSpanId`) row. It sets the color of that row's secondary text (`detail`, * `duration`, `tokens-in`, `tokens-out`, `cost`, and the `pending` status label), which is raised * from the quiet token to full-strength text so it clears WCAG AA against the active row's tint. * The semantic status labels keep their own hue but are mixed 25% toward this same value, so * overriding it re-aims every foreground on the row at once rather than leaving the status colors * stranded. See the pairing caveat on `--lr-trace-tree-row-active-bg`. * @cssprop [--lr-trace-tree-toggle-hover-bg=var(--lr-color-brand-quiet)] - Toggle hover background. * @cssprop [--lr-trace-tree-success-color=var(--lr-color-success)] - Success status text and bar. * @cssprop [--lr-trace-tree-error-color=var(--lr-color-danger)] - Error status text and bar. * @cssprop [--lr-trace-tree-denied-color=var(--lr-color-warning)] - Denied status text and bar. * @cssprop [--lr-trace-tree-running-color=var(--lr-color-brand)] - Running status text and stripe. * @cssprop [--lr-trace-tree-pending-color=var(--lr-color-text-quiet)] - Pending status text and bar. * @cssprop [--lr-trace-tree-bar-track-bg=var(--lr-color-surface-raised)] - Duration bar track. * @cssprop [--lr-trace-tree-max-indent=var(--lr-size-12rem)] - Maximum visual nesting indentation; * semantic `aria-level` remains exact at deeper levels. * @cssprop [--lr-trace-tree-running-stripe-bg=var(--lr-color-brand-quiet)] - Running stripe contrast. * @status stable * @since 4.0.0 */ export declare class LyraTraceTree extends LyraElement{protected static readonly ownedCollectionProperties:readonly string[];static styles:import("lit").CSSResultGroup[]; /** * Flat span array. Hierarchy is derived from `parentId`; siblings order by `startMs`. * At most 500 unique spans with finite timestamps are rendered. A resolved `activeSpanId` and * its nearest ancestor path reserve positions before ordinary input-order rows, so a controlled * selection remains current and revealable across the ceiling. Malformed parent cycles are * broken into roots so hostile trace data cannot recurse indefinitely. Foreign runtime * `kind`/`status` values normalize to `'other'`/`'pending'` before rendering. */ spans:readonly LyraSpan[]; /** Controlled selection — the matching row carries `aria-current`/`data-active` and scrolls into view. */ activeSpanId:string|null; /** Optional accessible-name override for the `role="tree"` element. Omission localizes the * default; any supplied string, including `''`, is rendered verbatim. A host `aria-label` * names the host itself and is not cloned onto the independently interactive tree. */ label?:string; /** Adds tokens-in/tokens-out columns. */ showTokens:boolean; /** Adds a cost column, rendering `costText` verbatim. */ showCost:boolean; /** Suppresses the inline duration bar, for dense/narrow embeddings. */ hideBars:boolean; /** Ids of rows explicitly collapsed by the user. Absence means expanded — every row starts expanded. */ private collapsedIds;private focusedId;private liveRegion?;private previousStatuses;private pendingAnnouncements;private limitAnnouncementSink?;private limitAnnouncementInitialized;private previouslyTruncated;private renderedProjectionTruncated;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;private syncLimitAnnouncementSink;private buildHierarchy;private buildRows; /** * Trace-relative end used to scale every duration bar. * * It reads the projection's PRE-CAP extent rather than reducing over the rendered rows: past * MAX_RENDERED_LYRA_SPANS the surviving rows are the earliest ones, so a truncated tail shrank * the denominator and stretched every bar to fill its track -- a 1s span in a 10s trace drew at * 100% width. Capping the ROWS is a resource bound; rescaling the axis under them is a misreport. */ private traceExtent;private formatDuration;private formatNumber;private validTokenMetric;private toggleSpan; /** Expand every collapsible row. Resolves once the update reflecting it has committed. */ expandAll():Promise; /** Collapse every row that has children. */ collapseAll():void;private focusRow;private selectRow;private onKeyDown;protected willUpdate(changed:PropertyValues):void;private renderedRowById;protected updated(changed:PropertyValues):void;private renderHeader;private renderRow;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-trace-tree':LyraTraceTree;}}