@usetheo/ui 0.23.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/components/composites/annotation-input/annotation-input.d.ts +38 -0
  2. package/dist/components/composites/annotation-input/index.d.ts +4 -0
  3. package/dist/components/composites/annotation-input/types.d.ts +31 -0
  4. package/dist/components/composites/annotation-summary-group/annotation-summary-group.d.ts +28 -0
  5. package/dist/components/composites/annotation-summary-group/index.d.ts +1 -0
  6. package/dist/components/composites/chat-message-card/chat-message-card.d.ts +14 -0
  7. package/dist/components/composites/chat-message-card/index.d.ts +1 -0
  8. package/dist/components/composites/comment-thread/comment-thread.d.ts +24 -0
  9. package/dist/components/composites/comment-thread/index.d.ts +2 -0
  10. package/dist/components/composites/dataset-item-diff/dataset-item-diff.d.ts +19 -0
  11. package/dist/components/composites/dataset-item-diff/index.d.ts +4 -0
  12. package/dist/components/composites/dataset-item-diff/to-diff-text.d.ts +22 -0
  13. package/dist/components/composites/diff-view/diff-section.d.ts +19 -0
  14. package/dist/components/composites/diff-view/diff-view.d.ts +39 -0
  15. package/dist/components/composites/diff-view/index.d.ts +2 -0
  16. package/dist/components/composites/evaluator-form/evaluator-form.d.ts +25 -0
  17. package/dist/components/composites/evaluator-form/index.d.ts +3 -0
  18. package/dist/components/composites/evaluator-form/types.d.ts +41 -0
  19. package/dist/components/composites/histogram/histogram.d.ts +19 -0
  20. package/dist/components/composites/histogram/index.d.ts +2 -0
  21. package/dist/components/composites/message-branch-selector/index.d.ts +1 -0
  22. package/dist/components/composites/message-branch-selector/message-branch-selector.d.ts +27 -0
  23. package/dist/components/composites/percentile-chart/index.d.ts +2 -0
  24. package/dist/components/composites/percentile-chart/percentile-chart.d.ts +37 -0
  25. package/dist/components/composites/price-breakdown/index.d.ts +2 -0
  26. package/dist/components/composites/price-breakdown/price-breakdown.d.ts +21 -0
  27. package/dist/components/composites/prompt-template-editor/extract-vars.d.ts +1 -0
  28. package/dist/components/composites/prompt-template-editor/index.d.ts +2 -0
  29. package/dist/components/composites/prompt-template-editor/prompt-template-editor.d.ts +24 -0
  30. package/dist/components/composites/prompt-version-diff/index.d.ts +4 -0
  31. package/dist/components/composites/prompt-version-diff/prompt-version-diff.d.ts +20 -0
  32. package/dist/components/composites/prompt-version-diff/to-diff-text.d.ts +26 -0
  33. package/dist/components/composites/session-summary/index.d.ts +1 -0
  34. package/dist/components/composites/session-summary/session-summary.d.ts +18 -0
  35. package/dist/components/composites/session-timeline/index.d.ts +1 -0
  36. package/dist/components/composites/session-timeline/session-timeline.d.ts +22 -0
  37. package/dist/components/composites/severity-badge/index.d.ts +2 -0
  38. package/dist/components/composites/severity-badge/severity-badge.d.ts +33 -0
  39. package/dist/components/composites/tag-input/index.d.ts +2 -0
  40. package/dist/components/composites/tag-input/tag-input.d.ts +32 -0
  41. package/dist/components/composites/token-cost-breakdown/index.d.ts +2 -0
  42. package/dist/components/composites/token-cost-breakdown/token-cost-breakdown.d.ts +26 -0
  43. package/dist/index.d.ts +43 -6
  44. package/dist/index.js +1533 -1
  45. package/dist/lib/chart/histogram.d.ts +21 -0
  46. package/dist/lib/chart/index.d.ts +1 -0
  47. package/dist/lib/diff/diff-lines.d.ts +23 -0
  48. package/dist/lib/diff/index.d.ts +1 -0
  49. package/dist/lib/session/aggregate.d.ts +18 -0
  50. package/dist/lib/session/index.d.ts +2 -0
  51. package/dist/lib/session/types.d.ts +30 -0
  52. package/package.json +1 -1
@@ -0,0 +1,38 @@
1
+ import type { AnnotationCategoricalConfig, AnnotationContinuousConfig, AnnotationFreeformConfig } from "./types.js";
2
+ /**
3
+ * AnnotationInput — a controlled, config-driven human annotation input (M12).
4
+ * Dispatches on `config.type` (Phoenix's three-type model): categorical →
5
+ * RadioGroup over named options; continuous → number input bounded by the
6
+ * config; freeform → textarea. Fully controlled (`value` + `onValueChange`);
7
+ * the consumer owns the config (fixture or backend store) and the submission.
8
+ * Composes the DS form primitives — zero new dependency (M12 ADR D2).
9
+ *
10
+ * <AnnotationInput name="Quality" config={qualityConfig}
11
+ * value={v} onValueChange={setV} />
12
+ */
13
+ interface AnnotationInputCommon {
14
+ /** The score name — rendered as the field label / radiogroup accessible name. */
15
+ name: string;
16
+ /** Overrides the generated control id (for external label association). */
17
+ id?: string;
18
+ /** Optional helper text, wired via aria-describedby. */
19
+ description?: string;
20
+ required?: boolean;
21
+ disabled?: boolean;
22
+ className?: string;
23
+ }
24
+ export type AnnotationInputProps = (AnnotationInputCommon & {
25
+ config: AnnotationCategoricalConfig;
26
+ value: string | null;
27
+ onValueChange: (value: string | null) => void;
28
+ }) | (AnnotationInputCommon & {
29
+ config: AnnotationContinuousConfig;
30
+ value: number | null;
31
+ onValueChange: (value: number | null) => void;
32
+ }) | (AnnotationInputCommon & {
33
+ config: AnnotationFreeformConfig;
34
+ value: string | null;
35
+ onValueChange: (value: string | null) => void;
36
+ });
37
+ declare function AnnotationInput(props: AnnotationInputProps): import("react").JSX.Element;
38
+ export { AnnotationInput };
@@ -0,0 +1,4 @@
1
+ export { AnnotationInput } from "./annotation-input.js";
2
+ export type { AnnotationInputProps } from "./annotation-input.js";
3
+ export type { CategoricalOption, AnnotationCategoricalConfig, AnnotationContinuousConfig, AnnotationFreeformConfig, AnnotationConfig, } from "./types.js";
4
+ export { isCategoricalConfig, isContinuousConfig, isFreeformConfig } from "./types.js";
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Annotation config types — the named-score-type contract for AnnotationInput
3
+ * (M12). Follows Phoenix's three-type model (categorical / continuous /
4
+ * freeform); Langfuse's BOOLEAN is categorical-of-two and CORRECTION is
5
+ * system-only, so neither adds to a controlled human input. The config is a
6
+ * plain descriptor the consumer owns (fixture or backend store) — the DS
7
+ * component is config-driven and stateless.
8
+ */
9
+ /** One named categorical choice; `score` optionally maps the label to a numeric value on submit. */
10
+ export interface CategoricalOption {
11
+ label: string;
12
+ score?: number | null;
13
+ }
14
+ export interface AnnotationCategoricalConfig {
15
+ type: "categorical";
16
+ options: CategoricalOption[];
17
+ }
18
+ export interface AnnotationContinuousConfig {
19
+ type: "continuous";
20
+ min: number;
21
+ max: number;
22
+ step?: number;
23
+ }
24
+ export interface AnnotationFreeformConfig {
25
+ type: "freeform";
26
+ maxLength?: number;
27
+ }
28
+ export type AnnotationConfig = AnnotationCategoricalConfig | AnnotationContinuousConfig | AnnotationFreeformConfig;
29
+ export declare function isCategoricalConfig(c: AnnotationConfig): c is AnnotationCategoricalConfig;
30
+ export declare function isContinuousConfig(c: AnnotationConfig): c is AnnotationContinuousConfig;
31
+ export declare function isFreeformConfig(c: AnnotationConfig): c is AnnotationFreeformConfig;
@@ -0,0 +1,28 @@
1
+ import type { AnnotationConfig } from "../annotation-input/types.js";
2
+ /**
3
+ * AnnotationSummaryGroup — a collapsible group showing AGGREGATE stats over a
4
+ * list of annotation values for one `AnnotationConfig` (M18). Reuses the M12
5
+ * `AnnotationConfig` contract (DRY, ADR D2) and dispatches on `config.type`:
6
+ * - continuous → mean of the finite numeric values + count.
7
+ * - categorical → count per option label + total count.
8
+ * - freeform → count of non-empty values.
9
+ *
10
+ * Controlled and pure — the consumer owns `values` (fixture or backend store);
11
+ * this component only summarizes. Uses a native `<details>`/`<summary>` for
12
+ * zero-JS collapsibility; composes `Card`/`Badge`. Zero new dependency.
13
+ *
14
+ * <AnnotationSummaryGroup config={cfg} values={vals} label="Quality" />
15
+ */
16
+ export interface AnnotationSummaryGroupProps {
17
+ /** The annotation config the values were collected against (reused from M12). */
18
+ config: AnnotationConfig;
19
+ /** The collected annotation values to aggregate. */
20
+ values: (string | number)[];
21
+ /** Group heading; falls back to the config type when omitted. */
22
+ label?: string;
23
+ /** Whether the group starts expanded. */
24
+ defaultOpen?: boolean;
25
+ className?: string;
26
+ }
27
+ declare const AnnotationSummaryGroup: import("react").ForwardRefExoticComponent<AnnotationSummaryGroupProps & import("react").RefAttributes<HTMLDetailsElement>>;
28
+ export { AnnotationSummaryGroup };
@@ -0,0 +1 @@
1
+ export { AnnotationSummaryGroup, type AnnotationSummaryGroupProps, } from "./annotation-summary-group.js";
@@ -0,0 +1,14 @@
1
+ import type { HTMLAttributes } from "react";
2
+ import type { ToolCall } from "../../../lib/trace/types.js";
3
+ export interface ChatMessageCardProps extends HTMLAttributes<HTMLDivElement> {
4
+ /** ChatML role — user / assistant / tool / system (or any string). */
5
+ role: string;
6
+ /** Text body of the message. */
7
+ content?: string;
8
+ /** Structured tool calls attached to the message (assistant turns). */
9
+ toolCalls?: ToolCall[];
10
+ /** Structured tool results (tool turns). Serialized to JSON for display. */
11
+ toolResults?: unknown[];
12
+ }
13
+ declare const ChatMessageCard: import("react").ForwardRefExoticComponent<ChatMessageCardProps & import("react").RefAttributes<HTMLDivElement>>;
14
+ export { ChatMessageCard };
@@ -0,0 +1 @@
1
+ export { ChatMessageCard, type ChatMessageCardProps } from "./chat-message-card.js";
@@ -0,0 +1,24 @@
1
+ /**
2
+ * A single comment in a {@link CommentThread}. The `id` keys the list; the
3
+ * consumer owns id assignment (backend or fixture).
4
+ */
5
+ export interface Comment {
6
+ id: string;
7
+ author: string;
8
+ body: string;
9
+ /** ISO string OR Unix **ms** (Timestamp contract) — NOT seconds. */
10
+ createdAt: string | number;
11
+ avatarUrl?: string;
12
+ }
13
+ export interface CommentThreadProps {
14
+ /** The rendered thread (controlled — the consumer brings/persists it). */
15
+ comments: Comment[];
16
+ /** Called with the trimmed draft when the composer submits a non-empty body. */
17
+ onSubmit: (body: string) => void;
18
+ /** Name of the person composing — surfaced as the composer avatar/context. */
19
+ currentUser?: string;
20
+ disabled?: boolean;
21
+ className?: string;
22
+ }
23
+ declare const CommentThread: import("react").ForwardRefExoticComponent<CommentThreadProps & import("react").RefAttributes<HTMLDivElement>>;
24
+ export { CommentThread };
@@ -0,0 +1,2 @@
1
+ export { CommentThread } from "./comment-thread.js";
2
+ export type { Comment, CommentThreadProps } from "./comment-thread.js";
@@ -0,0 +1,19 @@
1
+ import type { HTMLAttributes } from "react";
2
+ import { type DiffSectionCommon } from "../diff-view/diff-section.js";
3
+ import { type DatasetItemSnapshot } from "./to-diff-text.js";
4
+ /**
5
+ * DatasetItemDiff — diffs two dataset-item versions (M14 ADR D3). Stringifies
6
+ * each field (input / expectedOutput / metadata) and composes a labeled
7
+ * `DiffView` per field. Zero new dependency — reuses the DS diff primitive.
8
+ *
9
+ * A field absent in BOTH items is omitted honestly (no empty "No changes"
10
+ * table); a field present on either side is rendered so an add/remove shows.
11
+ *
12
+ * <DatasetItemDiff oldItem={v1} newItem={v2} />
13
+ */
14
+ export type DatasetItemDiffProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & DiffSectionCommon & {
15
+ oldItem: DatasetItemSnapshot;
16
+ newItem: DatasetItemSnapshot;
17
+ };
18
+ declare function DatasetItemDiff(props: DatasetItemDiffProps): import("react").JSX.Element;
19
+ export { DatasetItemDiff };
@@ -0,0 +1,4 @@
1
+ export { DatasetItemDiff } from "./dataset-item-diff.js";
2
+ export type { DatasetItemDiffProps } from "./dataset-item-diff.js";
3
+ export type { DatasetItemSnapshot } from "./to-diff-text.js";
4
+ export { fieldToText, fieldPresent } from "./to-diff-text.js";
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Pure normalizers for dataset-item snapshots (M14 ADR D3). Turns each field
3
+ * (input / expectedOutput / metadata), whose value is `unknown`, into the plain
4
+ * text a `DiffView` diffs. No React, no I/O; total and deterministic.
5
+ */
6
+ /** A dataset item version. Fields are optional so absent ones can be omitted. */
7
+ export interface DatasetItemSnapshot {
8
+ input: unknown;
9
+ expectedOutput?: unknown;
10
+ metadata?: Record<string, unknown>;
11
+ }
12
+ /**
13
+ * Stringify a field value for diffing: a string passes through unchanged;
14
+ * `undefined`/`null` become ""; anything else is pretty-printed JSON. Keeping
15
+ * strings raw avoids wrapping user text in quotes/escapes in the diff.
16
+ */
17
+ export declare function fieldToText(value: unknown): string;
18
+ /**
19
+ * True when a field is present on either side — the caller renders a section
20
+ * only for present fields, omitting one absent in BOTH items honestly.
21
+ */
22
+ export declare function fieldPresent(a: unknown, b: unknown): boolean;
@@ -0,0 +1,19 @@
1
+ import { type DiffViewMode } from "./diff-view.js";
2
+ /**
3
+ * DiffSection — a labeled `DiffView` (a heading + the diff table). Shared by the
4
+ * domain composites (PromptVersionDiff, DatasetItemDiff) so each labeled diff is
5
+ * a single call instead of a repeated heading+DiffView block (DRY).
6
+ */
7
+ /** The DiffView pass-through props the composites forward to every section. */
8
+ export interface DiffSectionCommon {
9
+ /** Layout mode, forwarded to DiffView. */
10
+ mode?: DiffViewMode;
11
+ oldLabel?: string;
12
+ newLabel?: string;
13
+ }
14
+ export type DiffSectionProps = DiffSectionCommon & {
15
+ title: string;
16
+ oldText: string;
17
+ newText: string;
18
+ };
19
+ export declare function DiffSection({ title, oldText, newText, ...rest }: DiffSectionProps): import("react").JSX.Element;
@@ -0,0 +1,39 @@
1
+ import type { HTMLAttributes } from "react";
2
+ /**
3
+ * DiffView — a controlled, line-level text diff rendered as a semantic table
4
+ * (M14 ADR D2). Runs the pure `diffLines` LCS over `oldText`/`newText`; zero
5
+ * new dependency (registry stays copy-pasteable — M14 ADR D1).
6
+ *
7
+ * `mode="split"` (default) shows two columns — old on the left, new on the
8
+ * right, aligning `del` rows on the left and `add` rows on the right; `eq` on
9
+ * both. `mode="unified"` shows a single inline column with `+`/`-` prefixes.
10
+ *
11
+ * A11y is not color-alone: every changed row carries a TEXTUAL marker
12
+ * (`+`/`-`/` `) plus `data-diff`, and the whole thing is a `<table>` with an
13
+ * sr-only `<caption>` so screen readers announce a data table. Identical input
14
+ * reads as an honest "No changes" state, never an empty table.
15
+ *
16
+ * <DiffView oldText={v1} newText={v2} oldLabel="v1" newLabel="v2" />
17
+ */
18
+ export type DiffViewMode = "split" | "unified";
19
+ export type DiffViewProps = Omit<HTMLAttributes<HTMLTableElement>, "children"> & {
20
+ oldText: string;
21
+ newText: string;
22
+ /** Layout: two-column split (default) or inline unified. */
23
+ mode?: DiffViewMode;
24
+ /** Column header for the old text (split) / caption context. */
25
+ oldLabel?: string;
26
+ /** Column header for the new text (split) / caption context. */
27
+ newLabel?: string;
28
+ };
29
+ declare const DiffView: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLTableElement>, "children"> & {
30
+ oldText: string;
31
+ newText: string;
32
+ /** Layout: two-column split (default) or inline unified. */
33
+ mode?: DiffViewMode;
34
+ /** Column header for the old text (split) / caption context. */
35
+ oldLabel?: string;
36
+ /** Column header for the new text (split) / caption context. */
37
+ newLabel?: string;
38
+ } & import("react").RefAttributes<HTMLTableElement>>;
39
+ export { DiffView };
@@ -0,0 +1,2 @@
1
+ export { DiffView } from "./diff-view.js";
2
+ export type { DiffViewProps, DiffViewMode } from "./diff-view.js";
@@ -0,0 +1,25 @@
1
+ import { type EvaluatorConfig } from "./types.js";
2
+ /**
3
+ * EvaluatorForm — a controlled, config-driven builder for a built-in evaluator
4
+ * (M18). Dispatches on `value.type` (Phoenix's code-evaluator model): a
5
+ * `<select>` switches the evaluator type; the fields below it edit the config
6
+ * for the current type — exact_match/contains → a target string; regex →
7
+ * pattern + optional flags; levenshtein/json_distance → a numeric threshold.
8
+ * Switching type emits a FRESH config of that type with sensible defaults.
9
+ *
10
+ * Fully controlled (`value` + `onChange`); the consumer owns the config and its
11
+ * persistence. The form only EDITS — execution/sandboxing of the evaluator is a
12
+ * platform concern (ADR D3). Composes DS primitives; zero new dependency.
13
+ *
14
+ * <EvaluatorForm value={cfg} onChange={setCfg} />
15
+ */
16
+ export interface EvaluatorFormProps {
17
+ /** The evaluator config being edited (discriminated by `type`). */
18
+ value: EvaluatorConfig;
19
+ /** Emitted with the new config on any edit — always fully typed. */
20
+ onChange: (value: EvaluatorConfig) => void;
21
+ disabled?: boolean;
22
+ className?: string;
23
+ }
24
+ declare const EvaluatorForm: import("react").ForwardRefExoticComponent<EvaluatorFormProps & import("react").RefAttributes<HTMLDivElement>>;
25
+ export { EvaluatorForm };
@@ -0,0 +1,3 @@
1
+ export { EvaluatorForm, type EvaluatorFormProps } from "./evaluator-form.js";
2
+ export type { EvaluatorConfig, EvaluatorType, ExactMatchEvaluatorConfig, ContainsEvaluatorConfig, RegexEvaluatorConfig, LevenshteinEvaluatorConfig, JsonDistanceEvaluatorConfig, } from "./types.js";
3
+ export { defaultEvaluatorConfig, isTargetEvaluator, isRegexEvaluator, isThresholdEvaluator, } from "./types.js";
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Evaluator config types — the discriminated-union contract for EvaluatorForm
3
+ * (M18). Follows Phoenix's built-in code-evaluator model: each evaluator has a
4
+ * `type` discriminant plus the fields that type needs. The config is a plain
5
+ * descriptor the consumer owns (fixture or backend store) — EvaluatorForm only
6
+ * EDITS it; execution/sandboxing of the evaluator is a platform concern (ADR
7
+ * D3). Same union + Extract narrowing pattern as AnnotationInput (M12), which
8
+ * side-steps the TS#30581 correlated-union limitation.
9
+ */
10
+ /** A string-target evaluator: the produced output is matched against `target`. */
11
+ export interface ExactMatchEvaluatorConfig {
12
+ type: "exact_match";
13
+ target: string;
14
+ }
15
+ export interface ContainsEvaluatorConfig {
16
+ type: "contains";
17
+ target: string;
18
+ }
19
+ /** A regex evaluator: `pattern` is the source, `flags` the optional RegExp flags. */
20
+ export interface RegexEvaluatorConfig {
21
+ type: "regex";
22
+ pattern: string;
23
+ flags?: string;
24
+ }
25
+ /** A Levenshtein-distance evaluator: passes when distance ≤ `threshold`. */
26
+ export interface LevenshteinEvaluatorConfig {
27
+ type: "levenshtein";
28
+ threshold: number;
29
+ }
30
+ /** A JSON-structural-distance evaluator: passes when distance ≤ `threshold`. */
31
+ export interface JsonDistanceEvaluatorConfig {
32
+ type: "json_distance";
33
+ threshold: number;
34
+ }
35
+ export type EvaluatorType = EvaluatorConfig["type"];
36
+ export type EvaluatorConfig = ExactMatchEvaluatorConfig | ContainsEvaluatorConfig | RegexEvaluatorConfig | LevenshteinEvaluatorConfig | JsonDistanceEvaluatorConfig;
37
+ export declare function isTargetEvaluator(c: EvaluatorConfig): c is ExactMatchEvaluatorConfig | ContainsEvaluatorConfig;
38
+ export declare function isRegexEvaluator(c: EvaluatorConfig): c is RegexEvaluatorConfig;
39
+ export declare function isThresholdEvaluator(c: EvaluatorConfig): c is LevenshteinEvaluatorConfig | JsonDistanceEvaluatorConfig;
40
+ /** A fresh config of `type` with sensible defaults — emitted on a type switch. */
41
+ export declare function defaultEvaluatorConfig(type: EvaluatorType): EvaluatorConfig;
@@ -0,0 +1,19 @@
1
+ import type { HTMLAttributes } from "react";
2
+ import { type HistogramBin } from "../../../lib/chart/histogram.js";
3
+ type HistogramData = {
4
+ bins: HistogramBin[];
5
+ values?: never;
6
+ binCount?: never;
7
+ } | {
8
+ values: number[];
9
+ binCount: number;
10
+ bins?: never;
11
+ };
12
+ export type HistogramProps = HTMLAttributes<HTMLElement> & {
13
+ title: string;
14
+ height?: number;
15
+ /** Formats the count axis label and the bin bounds in the a11y table. */
16
+ valueFormatter?: (v: number) => string;
17
+ } & HistogramData;
18
+ declare const Histogram: import("react").ForwardRefExoticComponent<HistogramProps & import("react").RefAttributes<HTMLElement>>;
19
+ export { Histogram };
@@ -0,0 +1,2 @@
1
+ export { Histogram } from "./histogram.js";
2
+ export type { HistogramProps } from "./histogram.js";
@@ -0,0 +1 @@
1
+ export { MessageBranchSelector, type MessageBranchSelectorProps, } from "./message-branch-selector.js";
@@ -0,0 +1,27 @@
1
+ import type { HTMLAttributes } from "react";
2
+ /**
3
+ * MessageBranchSelector — controlled navigator across alternative message
4
+ * branches (e.g. regenerated responses): "‹ 2 / 5 ›" with prev/next buttons.
5
+ *
6
+ * Fully controlled (M19 ADR D3): the consumer owns `index` and reacts to
7
+ * `onPrev` / `onNext`; regenerate / streaming is a platform concern, not the DS.
8
+ * Prev is disabled at the first branch, next at the last. With a single branch
9
+ * (`count <= 1`) there is nothing to navigate, so it renders nothing.
10
+ *
11
+ * <MessageBranchSelector index={i} count={branches.length}
12
+ * onPrev={() => setI(i - 1)} onNext={() => setI(i + 1)} />
13
+ */
14
+ export interface MessageBranchSelectorProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
15
+ /** Zero-based index of the active branch. */
16
+ index: number;
17
+ /** Total number of branches. */
18
+ count: number;
19
+ /** Navigate to the previous branch. */
20
+ onPrev: () => void;
21
+ /** Navigate to the next branch. */
22
+ onNext: () => void;
23
+ /** Disable both controls (e.g. while a branch is loading). */
24
+ disabled?: boolean;
25
+ }
26
+ declare const MessageBranchSelector: import("react").ForwardRefExoticComponent<MessageBranchSelectorProps & import("react").RefAttributes<HTMLDivElement>>;
27
+ export { MessageBranchSelector };
@@ -0,0 +1,2 @@
1
+ export { PercentileChart } from "./percentile-chart.js";
2
+ export type { PercentileBucket, PercentileChartProps } from "./percentile-chart.js";
@@ -0,0 +1,37 @@
1
+ import type { HTMLAttributes } from "react";
2
+ /**
3
+ * PercentileChart — p50/p95/p99 over time as shaded BANDS (not three flat
4
+ * lines), pure-SVG (M3 anti-chart-lib ADR upheld, M11 ADR D1). The p50–p95 and
5
+ * p95–p99 spans render as filled areas + a p50 reference line, so the spread is
6
+ * read at a glance (phoenix `TraceLatencyPercentilesTimeSeries` pattern, M11
7
+ * ADR D2 — the upgrade over the lens' current three-line overlay). Reuses
8
+ * `linScale`/`niceMax`/`seriesPath` from TrendChart — zero new chart dep.
9
+ *
10
+ * <PercentileChart title="Latency" buckets={latencyBuckets}
11
+ * valueFormatter={(v) => `${v}ms`} />
12
+ */
13
+ export interface PercentileBucket {
14
+ /** p50 value for this time bucket. */
15
+ p50: number;
16
+ /** p95 value for this time bucket. */
17
+ p95: number;
18
+ /** p99 value for this time bucket. */
19
+ p99: number;
20
+ /** Optional bucket label (read in the a11y table). */
21
+ label?: string;
22
+ }
23
+ export type PercentileChartProps = HTMLAttributes<HTMLElement> & {
24
+ title: string;
25
+ buckets: PercentileBucket[];
26
+ height?: number;
27
+ /** Formats the y-axis label and the a11y table cells. */
28
+ valueFormatter?: (v: number) => string;
29
+ };
30
+ declare const PercentileChart: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLElement> & {
31
+ title: string;
32
+ buckets: PercentileBucket[];
33
+ height?: number;
34
+ /** Formats the y-axis label and the a11y table cells. */
35
+ valueFormatter?: (v: number) => string;
36
+ } & import("react").RefAttributes<HTMLElement>>;
37
+ export { PercentileChart };
@@ -0,0 +1,2 @@
1
+ export { PriceBreakdown } from "./price-breakdown.js";
2
+ export type { PriceBreakdownProps } from "./price-breakdown.js";
@@ -0,0 +1,21 @@
1
+ import type { HTMLAttributes } from "react";
2
+ /**
3
+ * PriceBreakdown — a `<table>` of unit prices scaled to per-unit, per-1K, and
4
+ * per-1M columns. Controlled and pure — the consumer supplies a `prices` map of
5
+ * usage-type label → price per unit; each scale is a plain multiplication
6
+ * (`price`, `price × 1000`, `price × 1_000_000`).
7
+ *
8
+ * An empty `prices` map renders an honest empty state, not an empty table. A
9
+ * visually-hidden caption gives screen readers the table's purpose.
10
+ *
11
+ * <PriceBreakdown prices={{ input: 0.000003, output: 0.000015 }} unit="token" />
12
+ */
13
+ export interface PriceBreakdownProps extends HTMLAttributes<HTMLTableElement> {
14
+ /** Usage-type label → price per unit. */
15
+ prices: Record<string, number>;
16
+ /** The unit each price is quoted per. Default `"token"`. */
17
+ unit?: string;
18
+ className?: string;
19
+ }
20
+ declare const PriceBreakdown: import("react").ForwardRefExoticComponent<PriceBreakdownProps & import("react").RefAttributes<HTMLTableElement>>;
21
+ export { PriceBreakdown };
@@ -0,0 +1 @@
1
+ export declare function extractVars(template: string): string[];
@@ -0,0 +1,2 @@
1
+ export { PromptTemplateEditor, type PromptTemplateEditorProps, } from "./prompt-template-editor.js";
2
+ export { extractVars } from "./extract-vars.js";
@@ -0,0 +1,24 @@
1
+ import type { HTMLAttributes } from "react";
2
+ /**
3
+ * PromptTemplateEditor — a controlled template editor: a `Textarea` plus a
4
+ * simple hint area listing available variables and which are used vs missing.
5
+ *
6
+ * The hint is a lightweight overlay over the plain textarea (M19 ADR D1 —
7
+ * parsimony rung 5): variable detection uses the pure `extractVars` helper;
8
+ * NO CodeMirror / editor library. "Used" = the variable appears in the current
9
+ * value; "missing" = it is used in the value but not declared in `variables`.
10
+ *
11
+ * <PromptTemplateEditor value={t} onChange={setT} variables={["name","city"]} />
12
+ */
13
+ export interface PromptTemplateEditorProps extends Omit<HTMLAttributes<HTMLTextAreaElement>, "onChange"> {
14
+ /** The template text. */
15
+ value: string;
16
+ /** Emits the new template text on each edit. */
17
+ onChange: (value: string) => void;
18
+ /** Variables the caller declares available to this template. */
19
+ variables?: string[];
20
+ /** Disable editing. */
21
+ disabled?: boolean;
22
+ }
23
+ declare const PromptTemplateEditor: import("react").ForwardRefExoticComponent<PromptTemplateEditorProps & import("react").RefAttributes<HTMLTextAreaElement>>;
24
+ export { PromptTemplateEditor };
@@ -0,0 +1,4 @@
1
+ export { PromptVersionDiff } from "./prompt-version-diff.js";
2
+ export type { PromptVersionDiffProps } from "./prompt-version-diff.js";
3
+ export type { PromptSnapshot, ChatMessage } from "./to-diff-text.js";
4
+ export { templateToText, configToText } from "./to-diff-text.js";
@@ -0,0 +1,20 @@
1
+ import type { HTMLAttributes } from "react";
2
+ import { type DiffSectionCommon } from "../diff-view/diff-section.js";
3
+ import { type PromptSnapshot } from "./to-diff-text.js";
4
+ /**
5
+ * PromptVersionDiff — diffs two prompt versions (M14 ADR D3). Normalizes each
6
+ * snapshot's template (string passthrough; chat array → `role: content` text)
7
+ * and config (pretty JSON) to plain text, then composes `DiffView` for content
8
+ * and, when present, config. Zero new dependency — reuses the DS diff primitive.
9
+ *
10
+ * The config diff is omitted honestly when both versions have no config, rather
11
+ * than rendering an empty "No changes" table nobody asked for.
12
+ *
13
+ * <PromptVersionDiff oldPrompt={v1} newPrompt={v2} />
14
+ */
15
+ export type PromptVersionDiffProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & DiffSectionCommon & {
16
+ oldPrompt: PromptSnapshot;
17
+ newPrompt: PromptSnapshot;
18
+ };
19
+ declare function PromptVersionDiff(props: PromptVersionDiffProps): import("react").JSX.Element;
20
+ export { PromptVersionDiff };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Pure normalizers that turn a prompt snapshot's domain shape into the plain
3
+ * text `DiffView` diffs (M14 ADR D3 — composites normalize, DiffView diffs).
4
+ * No React, no I/O; total and deterministic.
5
+ */
6
+ /** A single chat message in an array-shaped (ChatML-style) template. */
7
+ export interface ChatMessage {
8
+ role: string;
9
+ content: string;
10
+ }
11
+ /** A prompt version: either a raw string template or a chat-message array. */
12
+ export interface PromptSnapshot {
13
+ template: string | ChatMessage[];
14
+ config?: Record<string, unknown>;
15
+ }
16
+ /**
17
+ * Normalize a template to readable text. A string passes through unchanged; a
18
+ * chat array becomes one `role: content` line per message (blank line between
19
+ * messages so multi-line contents stay legible in the diff).
20
+ */
21
+ export declare function templateToText(template: string | ChatMessage[]): string;
22
+ /**
23
+ * Pretty-print a config object to JSON. Absent/empty → "" (the caller omits the
24
+ * config diff entirely when both sides are empty).
25
+ */
26
+ export declare function configToText(config?: Record<string, unknown>): string;
@@ -0,0 +1 @@
1
+ export { SessionSummary, type SessionSummaryProps } from "./session-summary.js";
@@ -0,0 +1,18 @@
1
+ import type { SessionMetrics, SessionTraceItem } from "../../../lib/session/types.js";
2
+ export interface SessionSummaryProps {
3
+ /** The session's traces — aggregated internally. Supply `metrics` instead to pass a pre-aggregate. */
4
+ items?: SessionTraceItem[];
5
+ /** Pre-computed metrics (overrides `items`). */
6
+ metrics?: SessionMetrics;
7
+ /** USD cost formatter. Default `$0.0000`. */
8
+ formatCostUsd?: (usd: number) => string;
9
+ className?: string;
10
+ "aria-label"?: string;
11
+ }
12
+ /**
13
+ * SessionSummary — a `<dl>` of honest aggregate metrics over a session's traces: trace count, the
14
+ * session wall-clock window, ∑ cost, ∑ tokens, error count (highlighted destructive when > 0), and
15
+ * the distinct models. Sums of zero are honest (`$0.0000`, `0`), never an em-dash. Pass `items` (it
16
+ * aggregates via `aggregateSession`) or a pre-computed `metrics`.
17
+ */
18
+ export declare function SessionSummary({ items, metrics, formatCostUsd, className, "aria-label": ariaLabel, }: SessionSummaryProps): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export { SessionTimeline, type SessionTimelineProps } from "./session-timeline.js";
@@ -0,0 +1,22 @@
1
+ import type { SessionTraceItem } from "../../../lib/session/types.js";
2
+ export interface SessionTimelineProps {
3
+ /** The session's traces (rendered in start-time order regardless of input order). */
4
+ items: SessionTraceItem[];
5
+ selectedId: string | null;
6
+ onSelect: (id: string) => void;
7
+ /** ns → label for the row timestamp. Default ISO datetime. */
8
+ formatTimestamp?: (ns: bigint) => string;
9
+ /** USD cost formatter. Default `$0.0000`. */
10
+ formatCostUsd?: (usd: number) => string;
11
+ /** Row count at/above which the virtualized path engages. Default 200. */
12
+ virtualizeThreshold?: number;
13
+ className?: string;
14
+ "aria-label"?: string;
15
+ }
16
+ /**
17
+ * SessionTimeline — a temporal replay of a session: one row per trace, sorted by start time, each
18
+ * showing the timestamp, name, a duration bar relative to the session window (via the trace-core
19
+ * `computeBarLayout`), status, and cost. Controlled selection; virtualizes above the threshold.
20
+ * Escaped text only.
21
+ */
22
+ export declare function SessionTimeline({ items, selectedId, onSelect, formatTimestamp, formatCostUsd, virtualizeThreshold, className, "aria-label": ariaLabel, }: SessionTimelineProps): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { SeverityBadge } from "./severity-badge.js";
2
+ export type { Severity, BadgeVariant, SeverityBadgeProps } from "./severity-badge.js";