import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraFrame}from'../../../internal/variants.js';import{type LyraHeadingLevel}from'../../../internal/heading-level.js'; /** A plan step's lifecycle state — not permission-gated, so there is no `denied` state here * (unlike ``'s status vocabulary, which does need one). */ export type TaskStatus='pending'|'running'|'success'|'error'; /** Visual chrome for ``'s root — the library's shared container-frame vocabulary. */ export type TaskListAppearance=LyraFrame;export interface TaskItem{ /** Unique among every top-level task and direct child while `reorderable`; duplicated data stays * visible but fails closed for reorder requests. */ id:string;label:string;status:TaskStatus; /** Optional secondary plain-text line, e.g. an error message or a short progress note. */ detail?:string; /** One level of sub-steps. Deeper nesting (a child's own `children`) is ignored. */ children?:readonly TaskItem[];}export interface TaskListToggleDetail{expanded:boolean;}export interface LyraTaskListEventMap{'lr-toggle':CustomEvent;'lr-reorder':CustomEvent<{taskId:string;parentTaskId:string|null;fromIndex:number;toIndex:number;}>;} /** `true`-defaulting boolean attribute converter -- Lit's default presence-based `type: Boolean` * can never be set back to `false` from a plain-HTML attribute once the property's own default is * `true` (removing an attribute that was never present fires no `attributeChangedCallback`), so * `fromAttribute` checks the literal string instead (mirrors `lr-generation-metrics`'s * `showStopConverter`). Unlike that converter, `toAttribute` here reflects the `true` state as a * present attribute rather than omitting it: `expanded`'s host attribute drives this component's * own `:host([expanded])` styling, so the attribute must actually be present while expanded and * absent while collapsed for that selector to work. Shared by both `expanded` and `collapsible`, * which have the identical `true`-default parsing need -- `collapsible` just isn't reflected. */ /** * `` — a live, collapsible tracker for an agent's plan: ordered steps with * per-step lifecycle status and one level of nested sub-steps, embedded in the transcript. * `items` is controlled and never mutated by this component, mirroring ``'s `steps` * contract. Unlike stepper's single-`current` navigation control, task-list has no selection and * several steps may be `running` at once. Set `reorderable` to request sibling-scoped keyboard * moves; the host applies the reordered `items` array. Non-record rows and rows without a nonempty * string id are omitted. Reordering additionally requires globally unique ids among every retained * top-level task and direct child; duplicate data stays visible but fails closed. * The visible header is a level-three heading by default; set `heading-level` from `1`–`6` to fit * the surrounding document outline, or `none` for a visual-only header. * Status changes and confirmed moves are announced through an internal ``. * * 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. * * Only the first 500 top-level items are mounted into the DOM (matching the render ceiling this * family's other bounded lists use); the header's "N of M completed" summary still counts every * item in `items`, and reorder index math still reads full sibling order from `items` regardless * of what is actually rendered. * * @customElement lr-task-list * @slot detail- - Dynamic, one per item id (e.g. `slot="detail-step-3"`). Rich detail under * that item's label, after its `detail` text -- typically a `` or file * ``. Plain-HTML friendly, no render props. * @event lr-toggle - The header was activated, expanding or collapsing the panel. `detail: { * expanded }`. * @event lr-reorder - `detail: { taskId, parentTaskId, fromIndex, toIndex }` — * Ctrl/Cmd+ArrowUp/ArrowDown requests moving the focused task within its own sibling list * (`parentTaskId` is `null` for a * top-level task; indices are sibling-scoped). Only fired while `reorderable` with unique ids; * a boundary key never reparents. A move is announced only after the rendered order confirms it. * @csspart base - The outer container. * @csspart header - The visible header content (a `