@usetheo/ui 0.28.1 → 0.29.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/index.d.ts +1 -1
- package/dist/index.js +21 -7
- package/dist/lib/trace/cost.d.ts +8 -0
- package/dist/lib/trace/types.d.ts +6 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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";
|
|
2
|
+
export { aggregateCost, asChat, contentText, isRedactedThinking, buildLayeredGraph, computeBarLayout, computeTraceBounds, deriveSpanKind, durationMs, flattenAll, flattenVisible, GRAPH_NODE_CAP, isSpanError, KIND_LABEL, niceAxisTicks, packRows, prettyValue, spanCostUsd, spanOwnCostUsd, toNs, alignSpanTrees, groupByNamespace, traceMetrics, toTranscriptRows, VIRTUALIZE_THRESHOLD, } from "./lib/trace/index.js";
|
|
3
3
|
export type { AlignDelta, AlignRow, AttributeGroup, AxisTick, BarLayout, ChatMessage, FlatSpan, GraphEdge, GraphNode, LayeredGraph, SpanKind, SpanStatus, ToolCall, TraceSpan, TranscriptRow, TranscriptRowStats, } from "./lib/trace/index.js";
|
|
4
4
|
export { Button, buttonVariants, type ButtonProps } from "./components/primitives/button/index.js";
|
|
5
5
|
export { Badge, badgeVariants, type BadgeProps } from "./components/primitives/badge/index.js";
|
package/dist/index.js
CHANGED
|
@@ -153,6 +153,19 @@ function spanCostUsd(span) {
|
|
|
153
153
|
}
|
|
154
154
|
return 0;
|
|
155
155
|
}
|
|
156
|
+
function spanOwnCostUsd(span) {
|
|
157
|
+
if (typeof span.costUsd === "number" && Number.isFinite(span.costUsd)) {
|
|
158
|
+
return span.costUsd > 0 ? span.costUsd : void 0;
|
|
159
|
+
}
|
|
160
|
+
const attrs = span.attributes ?? {};
|
|
161
|
+
for (const key of COST_ATTRIBUTE_KEYS) {
|
|
162
|
+
if (!(key in attrs)) continue;
|
|
163
|
+
const raw = attrs[key];
|
|
164
|
+
const n = typeof raw === "number" ? raw : typeof raw === "string" ? Number(raw) : Number.NaN;
|
|
165
|
+
if (Number.isFinite(n)) return n > 0 ? n : void 0;
|
|
166
|
+
}
|
|
167
|
+
return void 0;
|
|
168
|
+
}
|
|
156
169
|
function aggregateCost(span) {
|
|
157
170
|
const seen = /* @__PURE__ */ new Set();
|
|
158
171
|
const walk = (s) => {
|
|
@@ -209,7 +222,7 @@ function toTranscriptRows(root) {
|
|
|
209
222
|
stats: {
|
|
210
223
|
inputTokens: span.inputTokens ?? 0,
|
|
211
224
|
outputTokens: span.outputTokens ?? 0,
|
|
212
|
-
costUsd:
|
|
225
|
+
costUsd: spanOwnCostUsd(span),
|
|
213
226
|
durationMs: durationMs(span)
|
|
214
227
|
}
|
|
215
228
|
});
|
|
@@ -2434,7 +2447,7 @@ var SelectContent = forwardRef(({ className, children, position = "popper", ...p
|
|
|
2434
2447
|
ref,
|
|
2435
2448
|
position,
|
|
2436
2449
|
className: cn(
|
|
2437
|
-
"relative z-50 min-w-[
|
|
2450
|
+
"relative z-50 min-w-[12rem] overflow-hidden rounded-lg border bg-popover text-popover-foreground shadow-md",
|
|
2438
2451
|
"data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:animate-in",
|
|
2439
2452
|
"data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:animate-out",
|
|
2440
2453
|
position === "popper" && "data-[side=top]:-translate-y-1 data-[side=bottom]:translate-y-1",
|
|
@@ -4204,7 +4217,7 @@ var Content12 = forwardRef(({ className, sideOffset = 4, ...props }, ref) => /*
|
|
|
4204
4217
|
ref,
|
|
4205
4218
|
sideOffset,
|
|
4206
4219
|
className: cn(
|
|
4207
|
-
"z-50 min-w-
|
|
4220
|
+
"z-50 min-w-[12rem] overflow-hidden rounded-lg border bg-popover p-1",
|
|
4208
4221
|
"text-popover-foreground shadow-md",
|
|
4209
4222
|
"data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:animate-in",
|
|
4210
4223
|
"data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:animate-out",
|
|
@@ -4335,7 +4348,7 @@ var SubContent2 = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ j
|
|
|
4335
4348
|
"data-slot": "dropdown-menu-sub-content",
|
|
4336
4349
|
ref,
|
|
4337
4350
|
className: cn(
|
|
4338
|
-
"z-50 min-w-
|
|
4351
|
+
"z-50 min-w-[12rem] overflow-hidden rounded-lg border bg-popover p-1",
|
|
4339
4352
|
"text-popover-foreground shadow-md",
|
|
4340
4353
|
"data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:animate-in",
|
|
4341
4354
|
"data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:animate-out",
|
|
@@ -7227,8 +7240,9 @@ function Row3({ row, ...ctx }) {
|
|
|
7227
7240
|
stats.inputTokens,
|
|
7228
7241
|
"\u2192",
|
|
7229
7242
|
stats.outputTokens,
|
|
7230
|
-
" \xB7
|
|
7231
|
-
|
|
7243
|
+
" \xB7",
|
|
7244
|
+
" ",
|
|
7245
|
+
stats.costUsd === void 0 ? "\u2014" : ctx.formatCostUsd(stats.costUsd),
|
|
7232
7246
|
" \xB7",
|
|
7233
7247
|
" ",
|
|
7234
7248
|
formatDurationMs(stats.durationMs)
|
|
@@ -9067,4 +9081,4 @@ var PromptTemplateEditor = forwardRef(
|
|
|
9067
9081
|
);
|
|
9068
9082
|
PromptTemplateEditor.displayName = "PromptTemplateEditor";
|
|
9069
9083
|
|
|
9070
|
-
export { AccountMenu, ActionBar, Alert, AnnotationInput, AnnotationSummaryGroup, AttributesTable, Avatar, BadgeWithDot as Badge, Breadcrumb, Button, Card, ChatMessageCard, Checkbox, CodeBlock, Combobox, CommandPalette, CommentThread, ConfirmDialog, CopyButton, DangerZone, DataTable, DatasetItemDiff, DeploymentRow, DescriptionList, Dialog, DiffView, DomainConfig, DropdownMenu, EmptyState, EnvVarEditor, EvaluatorForm, FileDropzone, FormField, GRAPH_NODE_CAP, Histogram, IOCards, Input, JsonViewer, KIND_LABEL, Label, LoginSplit, MessageBranchSelector, MessageCard, MessageItem, MetricCard, MetricsPanel, PageShell, Pagination, PercentileChart, PinInput, PlanBadge, PreviewEnvCard, PriceBreakdown, Progress, ProjectCard, PromptTemplateEditor, PromptVersionDiff, RadioGroup, RollbackUI, ScrollArea, Select, SessionSummary, SessionTimeline, SeverityBadge, Sheet, Sidebar, Skeleton, Slider, SocialAuthRow, SpanGraph, SpanTree, SpanTreeRow, SpanWaterfall, StatTile, StatusDot, StatusIndicator, Stepper, Switch, Table, Tabs, TagInput, TaskHeader, Textarea, Timestamp, Toast, Toaster, TokenCostBreakdown, TooltipWithStatics as Tooltip, TopNav, TraceCompare, TraceTranscript, TrendChart, UpdateBanner, VIRTUALIZE_THRESHOLD, aggregateCost, aggregateSession, alignSpanTrees, asChat, avatarVariants, badgeVariants, buildLayeredGraph, buttonVariants, cn, computeBarLayout, computeHistogram, computePageRange, computeTraceBounds, configToText, contentText, defaultEvaluatorConfig, deriveSpanKind, deriveSteps, diffLines, durationMs, extractVars, fieldPresent, fieldToText, flattenAll, flattenVisible, groupByNamespace, isCategoricalConfig, isContinuousConfig, isFreeformConfig, isNearBottom, isRedactedThinking, isRegexEvaluator, isSpanError, isTargetEvaluator, isThresholdEvaluator, linScale, matchesAccept, niceAxisTicks, niceMax, packRows, prettyValue, seriesPath, sessionBounds, sheetVariants, spanCostUsd, templateToText, toNs, toTranscriptRows, traceMetrics, useStickToBottom, useToast, validateFiles };
|
|
9084
|
+
export { AccountMenu, ActionBar, Alert, AnnotationInput, AnnotationSummaryGroup, AttributesTable, Avatar, BadgeWithDot as Badge, Breadcrumb, Button, Card, ChatMessageCard, Checkbox, CodeBlock, Combobox, CommandPalette, CommentThread, ConfirmDialog, CopyButton, DangerZone, DataTable, DatasetItemDiff, DeploymentRow, DescriptionList, Dialog, DiffView, DomainConfig, DropdownMenu, EmptyState, EnvVarEditor, EvaluatorForm, FileDropzone, FormField, GRAPH_NODE_CAP, Histogram, IOCards, Input, JsonViewer, KIND_LABEL, Label, LoginSplit, MessageBranchSelector, MessageCard, MessageItem, MetricCard, MetricsPanel, PageShell, Pagination, PercentileChart, PinInput, PlanBadge, PreviewEnvCard, PriceBreakdown, Progress, ProjectCard, PromptTemplateEditor, PromptVersionDiff, RadioGroup, RollbackUI, ScrollArea, Select, SessionSummary, SessionTimeline, SeverityBadge, Sheet, Sidebar, Skeleton, Slider, SocialAuthRow, SpanGraph, SpanTree, SpanTreeRow, SpanWaterfall, StatTile, StatusDot, StatusIndicator, Stepper, Switch, Table, Tabs, TagInput, TaskHeader, Textarea, Timestamp, Toast, Toaster, TokenCostBreakdown, TooltipWithStatics as Tooltip, TopNav, TraceCompare, TraceTranscript, TrendChart, UpdateBanner, VIRTUALIZE_THRESHOLD, aggregateCost, aggregateSession, alignSpanTrees, asChat, avatarVariants, badgeVariants, buildLayeredGraph, buttonVariants, cn, computeBarLayout, computeHistogram, computePageRange, computeTraceBounds, configToText, contentText, defaultEvaluatorConfig, deriveSpanKind, deriveSteps, diffLines, durationMs, extractVars, fieldPresent, fieldToText, flattenAll, flattenVisible, groupByNamespace, isCategoricalConfig, isContinuousConfig, isFreeformConfig, isNearBottom, isRedactedThinking, isRegexEvaluator, isSpanError, isTargetEvaluator, isThresholdEvaluator, linScale, matchesAccept, niceAxisTicks, niceMax, packRows, prettyValue, seriesPath, sessionBounds, sheetVariants, spanCostUsd, spanOwnCostUsd, templateToText, toNs, toTranscriptRows, traceMetrics, useStickToBottom, useToast, validateFiles };
|
package/dist/lib/trace/cost.d.ts
CHANGED
|
@@ -9,6 +9,14 @@ import type { TraceSpan } from "./types.js";
|
|
|
9
9
|
* negative costs floor to 0.
|
|
10
10
|
*/
|
|
11
11
|
export declare function spanCostUsd(span: TraceSpan): number;
|
|
12
|
+
/**
|
|
13
|
+
* A single span's own USD cost for PER-SPAN DISPLAY: the promoted `costUsd` field, else the first
|
|
14
|
+
* parseable cost attribute — but returns `undefined` when the span has no individually-computed
|
|
15
|
+
* cost (absent / non-numeric / ≤ 0). Distinct from `spanCostUsd` (which collapses to 0 for honest
|
|
16
|
+
* `∑` badges): a per-span cost is "exists or doesn't", not a sum, so the absent case renders `—`
|
|
17
|
+
* (em-dash) downstream instead of a fabricated `$0.0000` (M52 / theo-lens#71 Finding 3).
|
|
18
|
+
*/
|
|
19
|
+
export declare function spanOwnCostUsd(span: TraceSpan): number | undefined;
|
|
12
20
|
/**
|
|
13
21
|
* Sum a span's own cost + all descendants' (`∑`). Total: missing cost counts as 0, never NaN.
|
|
14
22
|
* Cycle-safe: a repeated/self-referential child is counted at most once (no stack overflow).
|
|
@@ -66,7 +66,12 @@ export interface FlatSpan {
|
|
|
66
66
|
export interface TranscriptRowStats {
|
|
67
67
|
inputTokens: number;
|
|
68
68
|
outputTokens: number;
|
|
69
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Per-span own cost. `undefined` when the span has no individually-computed cost — the feed
|
|
71
|
+
* renders `—` then, never a fabricated `$0.0000` (M52 / theo-lens#71 Finding 3). A real computed
|
|
72
|
+
* cost is a positive number.
|
|
73
|
+
*/
|
|
74
|
+
costUsd: number | undefined;
|
|
70
75
|
durationMs: number | null;
|
|
71
76
|
}
|
|
72
77
|
/** One row in the reader-mode transcript feed. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usetheo/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"packageManager": "pnpm@10.32.1+sha512.a706938f0e89ac1456b6563eab4edf1d1faf3368d1191fc5c59790e96dc918e4456ab2e67d613de1043d2e8c81f87303e6b40d4ffeca9df15ef1ad567348f2be",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|