import type{LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';export type{LyraNodeTypeStyle}from'../../../internal/node-type-style.js';import{type LyraSpan}from'../trace-tree/span.js';export type{LyraSpan}from'../trace-tree/span.js';export interface LyraAgentTraceEventMap{ /** Bubbles, composed, from the composed `` (identical `{ spanId }` detail), or is * fired directly when a handoff quick-jump entry is activated -- a host handles both origins * through this one event. */ 'lr-span-select':CustomEvent<{spanId:string;}>; /** Bubbles, composed, from the composed ``, unchanged. */ 'lr-span-toggle':CustomEvent<{spanId:string;expanded:boolean;}>; /** Timeline-owned translation of the composed graph legend's visibility event. */ 'lr-span-visibility-change':CustomEvent>;} /** * `` — a provider-neutral agent/LLM trace view: a span-kind filter row, a * handoff quick-jump list, and the full trace hierarchy, all driven by one shared `LyraSpan[]` * array (the same shape `` and `` already consume). * * The actual trace rendering -- hierarchy, expand/collapse, roving-tabindex keyboard navigation, * duration bars, the empty state -- is entirely ``'s own: this component only ever * passes it a (possibly filtered) `spans` array plus a handful of pass-through properties, never * building its own row markup. `` was chosen over `` because a * trace is fundamentally the hierarchy relationship between spans (which agent called which tool, * which handed off to which sub-agent) -- exactly what `parentId`-derived `aria-level` nesting * conveys and a flat, `startMs`-ordered timeline does not. * * This component's own contribution is the multi-domain filter layer on top of that: a filter * row composing `` -- the same abstract type/visibility-toggle legend pattern * that component already establishes for ``'s node types, reused here (it neither * reads nor writes an actual graph) for `LyraSpan.kind` visibility instead -- and a handoff * quick-jump list composing `` for each visible `'agent'`-kind span (an * agent invocation is, in trace terms, a handoff of control to that agent). Hidden kinds are * simply excluded from the array handed to ``; a span whose parent got filtered * out is promoted to a root by ``'s own existing orphan handling, never dropped. * * Selection is controlled end-to-end for deep-linking: `activeSpanId` flows down into * `` verbatim, and both activation paths -- a row click inside the tree, or a * handoff quick-jump entry -- update it and fire the identical `lr-span-select` `{ spanId }` * shape, so * a host can encode the current span id in a URL and feed it straight back in. * * Public collection properties take bounded readonly snapshots. `spans` keeps its admitted item * identities only long enough for the shared descriptor-safe projection to copy its fields; later * rendering never re-reads an admitted source row. Create a new collection and reassign it after * changes; mutating the assigned array does not update the view. * * @customElement lr-agent-trace * @event lr-span-select - `detail: { spanId }` — a span was activated, from the tree or the handoff list. * @event lr-span-toggle - `detail: { spanId, expanded }` — a tree row was expanded or collapsed. * @event lr-span-visibility-change - `detail: { hiddenKinds }` — the span-kind filter changed. * @csspart base - The root wrapper. * @csspart filter - The composed `` filter row, only rendered while `spans` has at least one span. * @csspart handoffs - The handoff quick-jump list wrapper, only rendered while at least one visible span has `kind: 'agent'`. * @csspart handoff - One handoff quick-jump entry (a `