@usetheo/ui 0.22.1 → 0.26.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.
- package/dist/components/composites/annotation-input/annotation-input.d.ts +38 -0
- package/dist/components/composites/annotation-input/index.d.ts +4 -0
- package/dist/components/composites/annotation-input/types.d.ts +31 -0
- package/dist/components/composites/attributes-table/attributes-table.d.ts +20 -0
- package/dist/components/composites/attributes-table/index.d.ts +1 -0
- package/dist/components/composites/histogram/histogram.d.ts +19 -0
- package/dist/components/composites/histogram/index.d.ts +2 -0
- package/dist/components/composites/io-cards/index.d.ts +2 -0
- package/dist/components/composites/io-cards/io-cards.d.ts +17 -0
- package/dist/components/composites/io-cards/message-card.d.ts +21 -0
- package/dist/components/composites/percentile-chart/index.d.ts +2 -0
- package/dist/components/composites/percentile-chart/percentile-chart.d.ts +37 -0
- package/dist/components/composites/session-summary/index.d.ts +1 -0
- package/dist/components/composites/session-summary/session-summary.d.ts +18 -0
- package/dist/components/composites/session-timeline/index.d.ts +1 -0
- package/dist/components/composites/session-timeline/session-timeline.d.ts +22 -0
- package/dist/components/composites/span-graph/index.d.ts +1 -0
- package/dist/components/composites/span-graph/span-graph.d.ts +19 -0
- package/dist/components/composites/span-tree/index.d.ts +2 -0
- package/dist/components/composites/span-tree/span-tree-row.d.ts +22 -0
- package/dist/components/composites/span-tree/span-tree-virtual.d.ts +7 -0
- package/dist/components/composites/span-tree/span-tree.d.ts +34 -0
- package/dist/components/composites/span-waterfall/index.d.ts +1 -0
- package/dist/components/composites/span-waterfall/span-waterfall.d.ts +28 -0
- package/dist/components/composites/trace-compare/index.d.ts +1 -0
- package/dist/components/composites/trace-compare/trace-compare.d.ts +27 -0
- package/dist/components/composites/trace-transcript/index.d.ts +1 -0
- package/dist/components/composites/trace-transcript/trace-transcript.d.ts +26 -0
- package/dist/components/primitives/combobox/combobox.d.ts +3 -3
- package/dist/index.d.ts +30 -0
- package/dist/index.js +2177 -1
- package/dist/lib/chart/histogram.d.ts +21 -0
- package/dist/lib/chart/index.d.ts +1 -0
- package/dist/lib/session/aggregate.d.ts +18 -0
- package/dist/lib/session/index.d.ts +2 -0
- package/dist/lib/session/types.d.ts +30 -0
- package/dist/lib/trace/align.d.ts +41 -0
- package/dist/lib/trace/attributes.d.ts +11 -0
- package/dist/lib/trace/bar-layout.d.ts +52 -0
- package/dist/lib/trace/chat.d.ts +14 -0
- package/dist/lib/trace/cost.d.ts +16 -0
- package/dist/lib/trace/duration.d.ts +18 -0
- package/dist/lib/trace/flatten.d.ts +28 -0
- package/dist/lib/trace/graph-layout.d.ts +52 -0
- package/dist/lib/trace/index.d.ts +9 -0
- package/dist/lib/trace/types.d.ts +80 -0
- package/dist/test/fixtures/trace.d.ts +19 -0
- package/package.json +3 -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,20 @@
|
|
|
1
|
+
export interface AttributesTableProps {
|
|
2
|
+
attrs?: Record<string, unknown>;
|
|
3
|
+
/** Predicate marking a key's value as sensitive (masked fail-closed). Default: nothing masked. */
|
|
4
|
+
maskedKeys?: (key: string) => boolean;
|
|
5
|
+
/** Whether the viewer is authorized to reveal masked values. Default false (fail-closed). */
|
|
6
|
+
canReveal?: boolean;
|
|
7
|
+
/** Keys promoted to a badge header above the namespace cards. */
|
|
8
|
+
promoted?: string[];
|
|
9
|
+
/** Namespace cards start expanded. Default true. */
|
|
10
|
+
defaultOpen?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* AttributesTable — namespace-grouped OTel span attributes with fail-closed
|
|
14
|
+
* PII masking. A `maskedKeys`-flagged value renders as `•••`; its raw string
|
|
15
|
+
* NEVER enters the DOM (no text node, no title/aria/data) until Reveal is
|
|
16
|
+
* clicked AND `canReveal` is true, and its CopyButton is withheld until then.
|
|
17
|
+
* When `!canReveal` the reveal control is a quiet "masked" hint, not an inert
|
|
18
|
+
* button. Object values fall back to the dependency-free `JsonViewer`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function AttributesTable({ attrs, maskedKeys, canReveal, promoted, defaultOpen, }: AttributesTableProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AttributesTable, type AttributesTableProps } from "./attributes-table.js";
|
|
@@ -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,17 @@
|
|
|
1
|
+
import { type RenderMarkdown } from "./message-card.js";
|
|
2
|
+
export interface IOCardsProps {
|
|
3
|
+
/** Raw payload string: a chat-message-array JSON, other JSON, or plain text. */
|
|
4
|
+
value?: string;
|
|
5
|
+
/** Optional slot for rendering markdown bodies (e.g. react-markdown + sanitize). Default: plain text. */
|
|
6
|
+
renderMarkdown?: RenderMarkdown;
|
|
7
|
+
"data-testid"?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* IOCards — renders a span's input/output value. A chat-message array becomes
|
|
11
|
+
* role-labeled cards (with tool-call/result linkage and long-history
|
|
12
|
+
* collapse); a redacted marker and non-chat payloads fall back to a plain
|
|
13
|
+
* message or the dependency-free `JsonViewer`. Markdown bodies go through the
|
|
14
|
+
* optional `renderMarkdown` slot — the default renderer NEVER interprets HTML
|
|
15
|
+
* (XSS-safe by construction; no `dangerouslySetInnerHTML` anywhere).
|
|
16
|
+
*/
|
|
17
|
+
export declare function IOCards({ value, renderMarkdown, "data-testid": testId }: IOCardsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ChatMessage, ToolCall } from "../../../lib/trace/types.js";
|
|
3
|
+
export type RenderMarkdown = (text: string) => ReactNode;
|
|
4
|
+
/** Props shared by the message-rendering components (kills the repeated `{message, renderMarkdown}` shape). */
|
|
5
|
+
interface MessageProps {
|
|
6
|
+
message: ChatMessage;
|
|
7
|
+
renderMarkdown?: RenderMarkdown;
|
|
8
|
+
}
|
|
9
|
+
/** A bordered, role-labeled Card: role Badge + body (markdown slot or plain text) + raw-JSON toggle. */
|
|
10
|
+
export declare function MessageCard({ message, renderMarkdown }: MessageProps): import("react").JSX.Element;
|
|
11
|
+
/** A dedicated tool-call card: function name + call-id + JSON arguments. Linked to its result by id. */
|
|
12
|
+
export declare function ToolCallCard({ call }: {
|
|
13
|
+
call: ToolCall;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
15
|
+
/** A tool-result card, linked to its originating call by `tool_call_id`. */
|
|
16
|
+
export declare function ToolResultCard({ message }: {
|
|
17
|
+
message: ChatMessage;
|
|
18
|
+
}): import("react").JSX.Element;
|
|
19
|
+
/** Render one chat message as its appropriate card kind (tool-result → tool-calls → plain message). */
|
|
20
|
+
export declare function MessageItem({ message, renderMarkdown }: MessageProps): import("react").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -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 @@
|
|
|
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 @@
|
|
|
1
|
+
export { SpanGraph, type SpanGraphProps } from "./span-graph.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { TraceSpan } from "../../../lib/trace/types.js";
|
|
2
|
+
export interface SpanGraphProps {
|
|
3
|
+
root: TraceSpan;
|
|
4
|
+
selectedId: string | null;
|
|
5
|
+
onSelect: (id: string) => void;
|
|
6
|
+
/** Max spans before the honest "too large" state renders. Default 200. */
|
|
7
|
+
nodeCap?: number;
|
|
8
|
+
className?: string;
|
|
9
|
+
"aria-label"?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* SpanGraph — a deterministic, dependency-free SVG rendering of the trace as a
|
|
13
|
+
* layered agent graph (depth = distance from root, order = index within
|
|
14
|
+
* depth). Edges follow parent/call order; the root→selected path is
|
|
15
|
+
* highlighted. Over `nodeCap` spans it renders an honest "too large" state
|
|
16
|
+
* instead of an unreadable hairball. No layout lib (elkjs/d3) — SVG-pure by
|
|
17
|
+
* ADR D4. Nodes are focusable buttons; selection is controlled.
|
|
18
|
+
*/
|
|
19
|
+
export declare function SpanGraph({ root, selectedId, onSelect, nodeCap, className, "aria-label": ariaLabel, }: SpanGraphProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { TraceSpan } from "../../../lib/trace/types.js";
|
|
3
|
+
export interface SpanTreeRowProps {
|
|
4
|
+
span: TraceSpan;
|
|
5
|
+
depth: number;
|
|
6
|
+
selected: boolean;
|
|
7
|
+
collapsed: boolean;
|
|
8
|
+
hasChildren: boolean;
|
|
9
|
+
posinset: number;
|
|
10
|
+
setsize: number;
|
|
11
|
+
showMetrics?: boolean;
|
|
12
|
+
/** Optional trace window for the inline timeline bar. */
|
|
13
|
+
bounds?: {
|
|
14
|
+
startNs: bigint;
|
|
15
|
+
endNs: bigint;
|
|
16
|
+
};
|
|
17
|
+
onSelect: (id: string) => void;
|
|
18
|
+
onToggle: (id: string) => void;
|
|
19
|
+
renderBadge?: (span: TraceSpan) => ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/** The single clickable row for a span — shared by the recursive and virtualized paths. */
|
|
22
|
+
export declare function SpanTreeRow({ span, depth, selected, collapsed, hasChildren, posinset, setsize, showMetrics, bounds, onSelect, onToggle, renderBadge, }: SpanTreeRowProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FlatSpan } from "../../../lib/trace/types.js";
|
|
2
|
+
import type { SpanTreeRenderCtx } from "./span-tree.js";
|
|
3
|
+
export interface SpanTreeVirtualProps extends SpanTreeRenderCtx {
|
|
4
|
+
flat: FlatSpan[];
|
|
5
|
+
}
|
|
6
|
+
/** Virtualized flat-list tree (large traces at/above the threshold), reusing @tanstack/react-virtual. */
|
|
7
|
+
export declare function SpanTreeVirtual({ flat, selectedId, collapsed, showMetrics, bounds, onSelect, onToggle, renderBadge, }: SpanTreeVirtualProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { TraceSpan } from "../../../lib/trace/types.js";
|
|
3
|
+
/** Shared render context threaded to every row (kills per-node prop duplication). */
|
|
4
|
+
export interface SpanTreeRenderCtx {
|
|
5
|
+
selectedId: string | null;
|
|
6
|
+
collapsed: Set<string>;
|
|
7
|
+
showMetrics?: boolean;
|
|
8
|
+
bounds?: {
|
|
9
|
+
startNs: bigint;
|
|
10
|
+
endNs: bigint;
|
|
11
|
+
};
|
|
12
|
+
onSelect: (id: string) => void;
|
|
13
|
+
onToggle: (id: string) => void;
|
|
14
|
+
renderBadge?: (span: TraceSpan) => ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export interface SpanTreeProps extends Omit<SpanTreeRenderCtx, "onToggle"> {
|
|
17
|
+
/** Root span of the trace. */
|
|
18
|
+
root: TraceSpan;
|
|
19
|
+
/** Collapse toggle (controlled). */
|
|
20
|
+
onToggleCollapse: (id: string) => void;
|
|
21
|
+
/** Visible-row count at/above which the virtualized path engages. Default 200. */
|
|
22
|
+
virtualizeThreshold?: number;
|
|
23
|
+
className?: string;
|
|
24
|
+
"aria-label"?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* SpanTree — an accessible, controllable tree of trace spans with full
|
|
28
|
+
* WAI-ARIA APG TreeView semantics (treeitem / level / posinset / setsize /
|
|
29
|
+
* selected / expanded / group). Renders recursively for small traces and
|
|
30
|
+
* switches to a virtualized flat-list at/above `virtualizeThreshold`. The
|
|
31
|
+
* container is keyboard-navigable (↑/↓ move, Home/End jump, Enter/Space
|
|
32
|
+
* select). Fully controlled: selection + collapse live in the consumer.
|
|
33
|
+
*/
|
|
34
|
+
export declare function SpanTree({ root, selectedId, onSelect, collapsed, onToggleCollapse, showMetrics, bounds, virtualizeThreshold, renderBadge, className, "aria-label": ariaLabel, }: SpanTreeProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SpanWaterfall, type SpanWaterfallProps } from "./span-waterfall.js";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { TraceSpan } from "../../../lib/trace/types.js";
|
|
2
|
+
type Bounds = {
|
|
3
|
+
startNs: bigint;
|
|
4
|
+
endNs: bigint;
|
|
5
|
+
};
|
|
6
|
+
export interface SpanWaterfallProps {
|
|
7
|
+
root: TraceSpan;
|
|
8
|
+
/** Trace window; defaults to the honest min-start/max-end envelope of the whole tree. */
|
|
9
|
+
bounds?: Bounds;
|
|
10
|
+
selectedId: string | null;
|
|
11
|
+
onSelect: (id: string) => void;
|
|
12
|
+
collapsed: Set<string>;
|
|
13
|
+
/** ns → label for the hover-needle. Default ISO datetime. */
|
|
14
|
+
formatTimestamp?: (ns: bigint) => string;
|
|
15
|
+
/** USD cost formatter for the ∑ rollup badge. Default `$0.0000`. */
|
|
16
|
+
formatCostUsd?: (usd: number) => string;
|
|
17
|
+
className?: string;
|
|
18
|
+
"aria-label"?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* SpanWaterfall — a nice-interval time axis over row-packed span bars, a
|
|
22
|
+
* hover-needle reading the absolute wall-clock time under the pointer, and a
|
|
23
|
+
* `∑` rollup-cost badge on parent rows. Bars are percentage-positioned via
|
|
24
|
+
* `computeBarLayout` (clock-skew / in-flight → dashed unbounded). Controlled:
|
|
25
|
+
* selection lives in the consumer. Escaped text only — no HTML injection.
|
|
26
|
+
*/
|
|
27
|
+
export declare function SpanWaterfall({ root, bounds, selectedId, onSelect, collapsed, formatTimestamp, formatCostUsd, className, "aria-label": ariaLabel, }: SpanWaterfallProps): import("react").JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TraceCompare, type TraceCompareProps, type CompareLane } from "./trace-compare.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type AlignRow } from "../../../lib/trace/align.js";
|
|
2
|
+
import type { TraceSpan } from "../../../lib/trace/types.js";
|
|
3
|
+
export interface CompareLane {
|
|
4
|
+
/** Display label (e.g. a trace id). */
|
|
5
|
+
id: string;
|
|
6
|
+
root: TraceSpan;
|
|
7
|
+
/** Data still loading — the lane renders a skeleton and no deltas compute. */
|
|
8
|
+
pending?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface TraceCompareProps {
|
|
11
|
+
/** Baseline lane. */
|
|
12
|
+
laneA: CompareLane;
|
|
13
|
+
/** Compared lane (B vs A). */
|
|
14
|
+
laneB: CompareLane;
|
|
15
|
+
/** Custom aligner (default: structural `alignSpanTrees`). */
|
|
16
|
+
align?: (a: TraceSpan, b: TraceSpan) => AlignRow[];
|
|
17
|
+
/** USD cost formatter. Default `$0.0000`. */
|
|
18
|
+
formatCostUsd?: (usd: number) => string;
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* TraceCompare — two traces side by side (B vs A baseline): a metrics header
|
|
23
|
+
* per lane and a structural diff table. Deltas are honest — a span present in
|
|
24
|
+
* only one trace is marked `only in A/B` with no fabricated delta. The
|
|
25
|
+
* component receives DATA (lanes); fetching/URL live in the consumer.
|
|
26
|
+
*/
|
|
27
|
+
export declare function TraceCompare({ laneA, laneB, align, formatCostUsd, className, }: TraceCompareProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TraceTranscript, type TraceTranscriptProps } from "./trace-transcript.js";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { TraceSpan, TranscriptRow } from "../../../lib/trace/types.js";
|
|
2
|
+
export interface TraceTranscriptProps {
|
|
3
|
+
/** Trace root — the row model is derived via `toTranscriptRows`. */
|
|
4
|
+
root: TraceSpan;
|
|
5
|
+
/** Pre-computed rows (overrides `root` derivation — mainly for tests / custom row models). */
|
|
6
|
+
rows?: TranscriptRow[];
|
|
7
|
+
selectedId: string | null;
|
|
8
|
+
onSelect: (id: string) => void;
|
|
9
|
+
/** Collapsed group ids (subagent subtrees). Uncontrolled-friendly: omit to keep all expanded. */
|
|
10
|
+
collapsedGroups?: Set<string>;
|
|
11
|
+
onToggleGroup?: (groupId: string) => void;
|
|
12
|
+
/** USD cost formatter for per-row stats. Default `$0.0000`. */
|
|
13
|
+
formatCostUsd?: (usd: number) => string;
|
|
14
|
+
/** Row count at/above which the virtualized path engages. Default 200. */
|
|
15
|
+
virtualizeThreshold?: number;
|
|
16
|
+
className?: string;
|
|
17
|
+
"aria-label"?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* TraceTranscript — a reader-mode feed of a trace: one card per span (role
|
|
21
|
+
* badge + name + output preview + micro-stats), with collapsible group
|
|
22
|
+
* headers for subagent subtrees. Virtualizes at/above `virtualizeThreshold`.
|
|
23
|
+
* Controlled selection; group collapse is controlled when `collapsedGroups`
|
|
24
|
+
* is supplied. Escaped text only.
|
|
25
|
+
*/
|
|
26
|
+
export declare function TraceTranscript({ root, rows: rowsProp, selectedId, onSelect, collapsedGroups, onToggleGroup, formatCostUsd, virtualizeThreshold, className, "aria-label": ariaLabel, }: TraceTranscriptProps): import("react").JSX.Element;
|
|
@@ -23,7 +23,7 @@ declare const Combobox: import("react").ForwardRefExoticComponent<ComboboxProps
|
|
|
23
23
|
ref?: React.Ref<HTMLInputElement>;
|
|
24
24
|
} & {
|
|
25
25
|
asChild?: boolean;
|
|
26
|
-
}, "
|
|
26
|
+
}, "key" | "asChild" | keyof import("react").InputHTMLAttributes<HTMLInputElement>>, "type" | "value" | "onChange"> & {
|
|
27
27
|
value?: string;
|
|
28
28
|
onValueChange?: (search: string) => void;
|
|
29
29
|
} & import("react").RefAttributes<HTMLInputElement>, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -34,7 +34,7 @@ declare const Combobox: import("react").ForwardRefExoticComponent<ComboboxProps
|
|
|
34
34
|
ref?: React.Ref<HTMLDivElement>;
|
|
35
35
|
} & {
|
|
36
36
|
asChild?: boolean;
|
|
37
|
-
}, "
|
|
37
|
+
}, "key" | "asChild" | keyof HTMLAttributes<HTMLDivElement>>, "value" | "disabled" | "onSelect"> & {
|
|
38
38
|
disabled?: boolean;
|
|
39
39
|
onSelect?: (value: string) => void;
|
|
40
40
|
value?: string;
|
|
@@ -47,7 +47,7 @@ declare const Combobox: import("react").ForwardRefExoticComponent<ComboboxProps
|
|
|
47
47
|
ref?: React.Ref<HTMLDivElement>;
|
|
48
48
|
} & {
|
|
49
49
|
asChild?: boolean;
|
|
50
|
-
}, "
|
|
50
|
+
}, "key" | "asChild" | keyof HTMLAttributes<HTMLDivElement>> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
51
51
|
};
|
|
52
52
|
export { Combobox };
|
|
53
53
|
export type { ComboboxProps, ComboboxContentProps, ComboboxInputProps, ComboboxItemProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { cn } from "./lib/cn.js";
|
|
2
|
+
export { aggregateCost, asChat, contentText, isRedactedThinking, buildLayeredGraph, computeBarLayout, computeTraceBounds, deriveSpanKind, durationMs, flattenAll, flattenVisible, GRAPH_NODE_CAP, isSpanError, KIND_LABEL, niceAxisTicks, packRows, prettyValue, spanCostUsd, toNs, alignSpanTrees, groupByNamespace, traceMetrics, toTranscriptRows, VIRTUALIZE_THRESHOLD, } from "./lib/trace/index.js";
|
|
3
|
+
export type { AlignDelta, AlignRow, AttributeGroup, AxisTick, BarLayout, ChatMessage, FlatSpan, GraphEdge, GraphNode, LayeredGraph, SpanKind, SpanStatus, ToolCall, TraceSpan, TranscriptRow, TranscriptRowStats, } from "./lib/trace/index.js";
|
|
2
4
|
export { Button, buttonVariants, type ButtonProps } from "./components/primitives/button/index.js";
|
|
3
5
|
export { Badge, badgeVariants, type BadgeProps } from "./components/primitives/badge/index.js";
|
|
4
6
|
export { Breadcrumb, type BreadcrumbLinkProps, } from "./components/primitives/breadcrumb/index.js";
|
|
@@ -61,3 +63,31 @@ export { PreviewEnvCard, type PreviewEnv, type PreviewService, } from "./compone
|
|
|
61
63
|
export { DomainConfig, type Domain, type DomainStatus, } from "./components/composites/domain-config/index.js";
|
|
62
64
|
export { RollbackUI, type RollbackTarget, } from "./components/composites/rollback-ui/index.js";
|
|
63
65
|
export { CommandPalette, type CommandItem, } from "./components/composites/command-palette/index.js";
|
|
66
|
+
export { SpanTree, SpanTreeRow } from "./components/composites/span-tree/index.js";
|
|
67
|
+
export type { SpanTreeProps, SpanTreeRowProps, SpanTreeRenderCtx, } from "./components/composites/span-tree/index.js";
|
|
68
|
+
export { SpanWaterfall } from "./components/composites/span-waterfall/index.js";
|
|
69
|
+
export type { SpanWaterfallProps } from "./components/composites/span-waterfall/index.js";
|
|
70
|
+
export { AttributesTable } from "./components/composites/attributes-table/index.js";
|
|
71
|
+
export type { AttributesTableProps } from "./components/composites/attributes-table/index.js";
|
|
72
|
+
export { IOCards, MessageCard, MessageItem } from "./components/composites/io-cards/index.js";
|
|
73
|
+
export type { IOCardsProps, RenderMarkdown } from "./components/composites/io-cards/index.js";
|
|
74
|
+
export { TraceTranscript } from "./components/composites/trace-transcript/index.js";
|
|
75
|
+
export type { TraceTranscriptProps } from "./components/composites/trace-transcript/index.js";
|
|
76
|
+
export { SpanGraph } from "./components/composites/span-graph/index.js";
|
|
77
|
+
export type { SpanGraphProps } from "./components/composites/span-graph/index.js";
|
|
78
|
+
export { TraceCompare } from "./components/composites/trace-compare/index.js";
|
|
79
|
+
export type { TraceCompareProps, CompareLane, } from "./components/composites/trace-compare/index.js";
|
|
80
|
+
export { aggregateSession, sessionBounds } from "./lib/session/index.js";
|
|
81
|
+
export type { SessionTraceItem, SessionMetrics } from "./lib/session/index.js";
|
|
82
|
+
export { SessionSummary } from "./components/composites/session-summary/index.js";
|
|
83
|
+
export type { SessionSummaryProps } from "./components/composites/session-summary/index.js";
|
|
84
|
+
export { SessionTimeline } from "./components/composites/session-timeline/index.js";
|
|
85
|
+
export type { SessionTimelineProps } from "./components/composites/session-timeline/index.js";
|
|
86
|
+
export { computeHistogram } from "./lib/chart/index.js";
|
|
87
|
+
export type { HistogramBin } from "./lib/chart/index.js";
|
|
88
|
+
export { Histogram } from "./components/composites/histogram/index.js";
|
|
89
|
+
export type { HistogramProps } from "./components/composites/histogram/index.js";
|
|
90
|
+
export { PercentileChart } from "./components/composites/percentile-chart/index.js";
|
|
91
|
+
export type { PercentileBucket, PercentileChartProps, } from "./components/composites/percentile-chart/index.js";
|
|
92
|
+
export { AnnotationInput, isCategoricalConfig, isContinuousConfig, isFreeformConfig, } from "./components/composites/annotation-input/index.js";
|
|
93
|
+
export type { AnnotationInputProps, CategoricalOption, AnnotationCategoricalConfig, AnnotationContinuousConfig, AnnotationFreeformConfig, AnnotationConfig, } from "./components/composites/annotation-input/index.js";
|