πͺ’ Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(dashboards): render horizontal bar widgets as top lists with copyable labels (#16296)
Trang Nguyena329171cff86
diff --git a/web/src/features/README.md b/web/src/features/README.mdindex 025663d75f..9cdc152648 100644--- a/web/src/features/README.md+++ b/web/src/features/README.md@@ -7,7 +7,6 @@ Implementation- Wrap with `withMiddleware`- Type-safe and authed API Route with `createAuthedAPIRoute`- Add zod types to `/features/public-api/types` folder.-- Use [`coerce`](https://zod.dev/?id=coercion-for-primitives) to handle primitives, such as dates, for use in your application and tests.- Use `strict()` on all objects that should not return additional properties. Recommended as default. In these cases, the test utility `makeZodVerifiedAPICall` will throw an error if the response contains additional properties. Also, we will log an error in production if the response contains additional properties.diff --git a/web/src/features/blobstorage-integration/README.md b/web/src/features/blobstorage-integration/README.mdindex 119e2c6b17..7b010f25f9 100644--- a/web/src/features/blobstorage-integration/README.md+++ b/web/src/features/blobstorage-integration/README.md@@ -109,15 +109,15 @@ worker picks up the job and sets `runStartedAt`.## Key files-| File | Role |-| --------------------------------------------------------------------------- | ------------------------------------------------- |-| `deriveSyncStatus.ts` | Derives display status from DB fields |-| `types.ts` | Form zod schema, `BlobStorageSyncStatus` type |+| File | Role |+| --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |+| `deriveSyncStatus.ts` | Derives display status from DB fields |+| `types.ts` | Form zod schema, `BlobStorageSyncStatus` type || `../analytics-integrations/exportSource.ts` | Export-source option/alert UI adapters (pure); policy in `packages/shared/.../export-source-policy.ts` |-| `service.ts` | Upsert logic (web save path) |-| `blobstorage-integration-router.ts` | tRPC router (save, runNow) |-| `worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.ts` | Worker job handler |-| `worker/src/features/blobstorage/handleBlobStorageIntegrationSchedule.ts` | Scheduler (enqueues due jobs) |+| `service.ts` | Upsert logic (web save path) |+| `blobstorage-integration-router.ts` | tRPC router (save, runNow) |+| `worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.ts` | Worker job handler |+| `worker/src/features/blobstorage/handleBlobStorageIntegrationSchedule.ts` | Scheduler (enqueues due jobs) |## UI Owner Map@@ -132,17 +132,17 @@ feature components below.**Structure** (`components/`):-| File | Role |-| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |+| File | Role |+| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ || `BlobStorageIntegrationContainer.tsx` | State layer: export-source policy context assembly, the four mutations, entity-action buttons (Validate / Run Now / Reset), loading gate, identity key |-| `BlobStorageIntegrationForm.tsx` | Disposable draft layer: `useForm` + schema, fields, Save; no tRPC |-| `formValues.ts` | Pure `buildBlobStorageFormValues()` + shared `BlobStorageFormControl` type |-| `StorageProviderFields.tsx` | Provider select + provider-dependent connection fields |-| `ExportScheduleFields.tsx` | Frequency, file type, export mode, custom start date |-| `ExportSourceField.tsx` | Source selector + blocked-save alert (LFE-10296) |-| `ExportFieldGroupsField.tsx` | Field-group checkboxes |-| `GzipCompressionField.tsx` | Gzip toggle; self-hides for Parquet |-| `BlobStorageStatusSection.tsx` | Status header, last-error alert, sync card |+| `BlobStorageIntegrationForm.tsx` | Disposable draft layer: `useForm` + schema, fields, Save; no tRPC |+| `formValues.ts` | Pure `buildBlobStorageFormValues()` + shared `BlobStorageFormControl` type |+| `StorageProviderFields.tsx` | Provider select + provider-dependent connection fields |+| `ExportScheduleFields.tsx` | Frequency, file type, export mode, custom start date |+| `ExportSourceField.tsx` | Source selector + blocked-save alert (LFE-10296) |+| `ExportFieldGroupsField.tsx` | Field-group checkboxes |+| `GzipCompressionField.tsx` | Gzip toggle; self-hides for Parquet |+| `BlobStorageStatusSection.tsx` | Status header, last-error alert, sync card |**External consumers**: none β the components are only mounted by thesettings page above.diff --git a/web/src/features/dashboard/components/TracesBarListChart.tsx b/web/src/features/dashboard/components/TracesBarListChart.tsxindex 83ea49a667..4101925f1f 100644--- a/web/src/features/dashboard/components/TracesBarListChart.tsx+++ b/web/src/features/dashboard/components/TracesBarListChart.tsx@@ -1,7 +1,5 @@/* eslint-disable @repo/no-style-props */import { type FilterState } from "@langfuse/shared";-import { ExpandListButton } from "@/src/features/dashboard/components/cards/ChevronButton";-import { useState } from "react";import { DashboardCard } from "@/src/features/dashboard/components/cards/DashboardCard";import { TotalMetric } from "@/src/features/dashboard/components/TotalMetric";import { compactNumberFormatter } from "@/src/utils/numbers";@@ -11,15 +9,11 @@ import { formatMetric } from "@/src/features/widgets/chart-library/utils";import { BarListChartArea } from "@/src/features/dashboard/components/cards/BarListChartArea";import { traceViewQuery } from "@/src/features/dashboard/lib/dashboard-utils";import { useScheduledDashboardExecuteQuery } from "@/src/hooks/useDashboardQueryScheduler";-import { useFitRowCount } from "@/src/features/dashboard/hooks/useFitRowCount";import { cn } from "@/src/utils/tailwind";-// Target height of one bar row (bar + spacing) and the x-axis strip below the-// bars. Used both to decide how many bars fit and to size the expanded chart.-const BAR_ROW_HEIGHT = 40;-const CHART_AXIS_PADDING = 30;-// Cap on bars shown when expanded ("Show all"); the rest stay hidden.-const MAX_EXPANDED_BARS = 20;+// Cap on bars fetched and rendered; the top list scrolls within the tile when+// they don't all fit.+const MAX_BARS = 20;export const TracesBarListChart = ({className,@@ -40,8 +34,6 @@ export const TracesBarListChart = ({metricsVersion?: ViewVersion;schedulerId?: string;}) => {- const [isExpanded, setIsExpanded] = useState(false);-const isV2 = metricsVersion === "v2";const traceNameField = isV2 ? "traceName" : "name";const countField = isV2 ? "uniq_traceId" : "count_count";@@ -85,7 +77,7 @@ export const TracesBarListChart = ({fromTimestamp: fromTimestamp.toISOString(),toTimestamp: toTimestamp.toISOString(),orderBy: [{ field: countField, direction: "desc" }],- chartConfig: { type: "table", row_limit: 20 },+ chartConfig: { type: "table", row_limit: MAX_BARS },};const traces = useScheduledDashboardExecuteQuery(@@ -116,31 +108,12 @@ export const TracesBarListChart = ({};}) ?? [];- // Fit the number of bars to the tile height instead of a fixed count: the- // collapsed view renders exactly as many bars as fill the measured chart area- // (no scrollbar, no dead gap), and "Show all" reveals the rest. The hook- // measures a layout-guaranteed box and hands `height` down to a pure chart- // (BarListChartArea) β one-way, no measure/resize feedback. (LFE-11035, LFE-11060)- const { containerRef, rowCount, height } = useFitRowCount({- rowHeightPx: BAR_ROW_HEIGHT,- reservedPx: CHART_AXIS_PADDING,- min: 1,- fallback: 5,- });-- const expandedCount = Math.min(MAX_EXPANDED_BARS, transformedTraces.length);- const collapsedCount = Math.min(rowCount, transformedTraces.length);- const adjustedData = transformedTraces.slice(- 0,- isExpanded ? expandedCount : collapsedCount,- );-return (<DashboardCard- // h-full (not just min-h-full) pins the card to the tile so the chart- // area measures the AVAILABLE height, not its own content; min-h-0 on the- // content lets the flex column shrink so the chart viewport does too and- // scrolls internally instead of overflowing the tile. (LFE-11035)+ // h-full pins the card to the tile so the chart area gets the AVAILABLE+ // height, not its own content; min-h-0 on the content lets the flex+ // column shrink so the top list scrolls internally instead of+ // overflowing the tile.className={cn(className, "h-full")}cardContentClassName="min-h-0"title="Traces"@@ -158,13 +131,8 @@ export const TracesBarListChart = ({/>{transformedTraces.length > 0 ? (<BarListChartArea- containerRef={containerRef}- measuredHeightPx={height}- isExpanded={isExpanded}- data={adjustedData}- barRowHeightPx={BAR_ROW_HEIGHT}- axisPaddingPx={CHART_AXIS_PADDING}- maxExpandedBars={MAX_EXPANDED_BARS}+ data={transformedTraces}+ maxBars={MAX_BARS}metricLabel="Traces"unit="traces"metricFormatter={(value) => formatMetric(value, { style: "full" })}@@ -177,17 +145,6 @@ export const TracesBarListChart = ({className="h-auto grow"/>)}- <ExpandListButton- isExpanded={isExpanded}- setExpanded={setIsExpanded}- totalLength={transformedTraces.length}- maxLength={collapsedCount}- expandText={- transformedTraces.length > MAX_EXPANDED_BARS- ? `Show top ${MAX_EXPANDED_BARS}`- : "Show all"- }- /></></DashboardCard>);diff --git a/web/src/features/dashboard/components/UserChart.tsx b/web/src/features/dashboard/components/UserChart.tsxindex bb504730b6..4fa99685f8 100644--- a/web/src/features/dashboard/components/UserChart.tsx+++ b/web/src/features/dashboard/components/UserChart.tsx@@ -4,21 +4,17 @@ import { DashboardCard } from "@/src/features/dashboard/components/cards/Dashboaimport { compactNumberFormatter, costFormatter } from "@/src/utils/numbers";import { TabComponent } from "@/src/features/dashboard/components/TabsComponent";import { TotalMetric } from "@/src/features/dashboard/components/TotalMetric";-import { ExpandListButton } from "@/src/features/dashboard/components/cards/ChevronButton";-import { useState } from "react";import { NoDataOrLoading } from "@/src/components/NoDataOrLoading";import { type QueryType, type ViewVersion } from "@langfuse/shared/query";import { mapLegacyUiTableFilterToView } from "@/src/features/dashboard/lib/dashboardUiTableToViewMapping";import { BarListChartArea } from "@/src/features/dashboard/components/cards/BarListChartArea";import { traceViewQuery } from "@/src/features/dashboard/lib/dashboard-utils";import { useScheduledDashboardExecuteQuery } from "@/src/hooks/useDashboardQueryScheduler";-import { useFitRowCount } from "@/src/features/dashboard/hooks/useFitRowCount";import { cn } from "@/src/utils/tailwind";-// Target height of one bar row (bar + spacing) and the x-axis strip; matches-// TracesBarListChart so bars are the same thickness across the two cards.-const BAR_ROW_HEIGHT = 40;-const CHART_AXIS_PADDING = 30;+// Cap on bars fetched and rendered; matches TracesBarListChart. The top list+// scrolls within the tile when they don't all fit.+const MAX_BARS = 20;type BarChartDataPoint = {name: string;@@ -44,9 +40,6 @@ export const UserChart = ({metricsVersion?: ViewVersion;schedulerId?: string;}) => {- const [isExpanded, setIsExpanded] = useState(false);- const maxNumberOfEntries = { collapsed: 5, expanded: 20 } as const;-const userCostQuery: QueryType = {view: "observations",dimensions: [{ field: "userId" }],@@ -69,7 +62,7 @@ export const UserChart = ({orderBy: [{ field: "sum_totalCost", direction: "desc" }],chartConfig: {type: "HORIZONTAL_BAR",- row_limit: maxNumberOfEntries.expanded,+ row_limit: MAX_BARS,},};@@ -112,7 +105,7 @@ export const UserChart = ({],chartConfig: {type: "HORIZONTAL_BAR",- row_limit: maxNumberOfEntries.expanded,+ row_limit: MAX_BARS,},};@@ -165,17 +158,6 @@ export const UserChart = ({0,);- // Fit the number of bars to the tile height (see TracesBarListChart): render- // exactly the bars that fill the measured chart area, no scrollbar, and defer- // the rest to "Show all". The measured `height` flows one-way into the pure- // BarListChartArea chart. (LFE-11035, LFE-11060)- const { containerRef, rowCount, height } = useFitRowCount({- rowHeightPx: BAR_ROW_HEIGHT,- reservedPx: CHART_AXIS_PADDING,- min: 1,- fallback: maxNumberOfEntries.collapsed,- });-const data = [{tabTitle: "Token cost",@@ -199,9 +181,9 @@ export const UserChart = ({return (<DashboardCard- // h-full pins the card to the tile so the chart area measures the- // AVAILABLE height, not its own content; min-h-0 lets the flex column- // shrink so the chart viewport scrolls internally. (LFE-11035)+ // h-full pins the card to the tile so the chart area gets the AVAILABLE+ // height, not its own content; min-h-0 lets the flex column shrink so+ // the top list scrolls internally.className={cn(className, "h-full")}cardContentClassName="min-h-0"title="User consumption"@@ -209,12 +191,6 @@ export const UserChart = ({><TabComponenttabs={data.map((item) => {- const shown = item.data.slice(- 0,- isExpanded- ? Math.min(maxNumberOfEntries.expanded, item.data.length)- : Math.min(rowCount, item.data.length),- );return {tabTitle: item.tabTitle,content: (@@ -226,13 +202,8 @@ export const UserChart = ({description={item.metricDescription}/><BarListChartArea- containerRef={containerRef}- measuredHeightPx={height}- isExpanded={isExpanded}- data={shown}- barRowHeightPx={BAR_ROW_HEIGHT}- axisPaddingPx={CHART_AXIS_PADDING}- maxExpandedBars={maxNumberOfEntries.expanded}+ data={item.data}+ maxBars={MAX_BARS}metricLabel={item.chartMetricLabel}unit={item.chartUnit}/>@@ -250,17 +221,6 @@ export const UserChart = ({};})}/>- <ExpandListButton- isExpanded={isExpanded}- setExpanded={setIsExpanded}- totalLength={transformedCost.length}- maxLength={Math.min(rowCount, transformedCost.length)}- expandText={- transformedCost.length > maxNumberOfEntries.expanded- ? `Show top ${maxNumberOfEntries.expanded}`- : "Show all"- }- /></DashboardCard>);};diff --git a/web/src/features/dashboard/components/cards/BarListChartArea.tsx b/web/src/features/dashboard/components/cards/BarListChartArea.tsxindex 94e01c798b..a90bdeed85 100644--- a/web/src/features/dashboard/components/cards/BarListChartArea.tsx+++ b/web/src/features/dashboard/components/cards/BarListChartArea.tsx@@ -8,91 +8,42 @@ export type BarListDataPoint = {};/**- * Presentational, one-way chart area for the fit-to-tile horizontal bar cards- * (Traces, User consumption). It renders the leftover-height region a- * {@link useFitRowCount} hook observes plus a definite-height inner box that- * hosts a pure {@link Chart}. Data flows one way: the hook measures the- * layout-guaranteed `flex-1` box (which this component never resizes) and hands- * a concrete pixel `measuredHeightPx` down here; the chart is then a pure- * function of that number and the already-sliced `data`. It never measures- * itself, so there is no measure -> setState -> resize -> remeasure feedback.- * Mirrors how DashboardGrid's `useDebouncedContainerWidth` measures once and- * passes `width` down. (LFE-11060)+ * Chart area for the horizontal bar cards (Traces, User consumption). The+ * TopListChart lays its rows out with a fixed 20β56px rhythm and scrolls+ * internally when they don't fit, so this wrapper only has to bound the+ * height: `flex-1 min-h-0` takes the card's leftover space and the chart+ * fills it. No measurement, no expand state; replaces the previous+ * fit-row-count height-measuring hook.*/export function BarListChartArea({- containerRef,- measuredHeightPx,- isExpanded,data,- barRowHeightPx,- axisPaddingPx,- maxExpandedBars,+ maxBars,metricLabel,unit,metricFormatter,}: {- /** Callback ref from `useFitRowCount`; attaches the ResizeObserver here. */- containerRef: (node: HTMLElement | null) => void;- /**- * Measured height of the observed box in px, or `null` before the first- * measurement (SSR / initial paint). Recharts needs a definite height, so we- * fall back until then.- */- measuredHeightPx: number | null;- isExpanded: boolean;- /** Bars to show, already sliced to the fitted/expanded count by the caller. */+ /** Bars to show, already capped by the caller's query row limit. */data: BarListDataPoint[];- barRowHeightPx: number;- axisPaddingPx: number;- maxExpandedBars: number;+ maxBars: number;metricLabel: string;unit: string;metricFormatter?: MetricFormatterFunction;}) {return (- // Two boxes, deliberately split:- //- // - the OUTER box carries the ResizeObserver ref and does NOT scroll. Its- // height is pure flex layout (flex-1 of the card), so it can never be- // reduced by a scrollbar appearing on a descendant. useFitRowCount- // therefore measures a stable value and cannot enter a- // measure -> shrink -> remeasure loop β even in browsers/OSes whose- // scrollbars consume layout space (classic, non-overlay).- // - the INNER box scrolls: `overflow-y-auto` lets the expanded list scroll- // within the tile, while `overflow-x-hidden` stops a horizontal scrollbar- // from ever appearing (the chart is width-fitted, so nothing is clipped).- // A horizontal scrollbar is what would otherwise consume vertical space- // and flicker on wide content (e.g. many long trace names).- //- // The chart is a pure function of the passed dimensions and never measures- // itself. Collapsed, the sized box takes the measured height so the bars- // spread to fill it (no dead gap, no scrollbar); expanded, it grows to the- // bars' natural height and the inner box scrolls. (LFE-11060, revises LFE-11035)- <div ref={containerRef} data-fit-box className="mt-4 min-h-0 w-full flex-1">- <div className="h-full min-h-0 w-full overflow-x-hidden overflow-y-auto">- <div- className="w-full"- style={{- height: isExpanded- ? data.length * barRowHeightPx + axisPaddingPx- : (measuredHeightPx ?? 200),- }}- >- <Chart- chartType="HORIZONTAL_BAR"- data={barListToDataPoints(data)}- metricFormatter={metricFormatter}- config={{ metric: { label: metricLabel } }}- rowLimit={maxExpandedBars}- chartConfig={{- type: "HORIZONTAL_BAR",- row_limit: maxExpandedBars,- unit,- show_value_labels: true,- }}- />- </div>- </div>+ <div className="mt-4 min-h-0 w-full flex-1">+ <Chart+ chartType="HORIZONTAL_BAR"+ data={barListToDataPoints(data)}+ metricFormatter={metricFormatter}+ config={{ metric: { label: metricLabel } }}+ rowLimit={maxBars}+ chartConfig={{+ type: "HORIZONTAL_BAR",+ row_limit: maxBars,+ unit,+ show_value_labels: true,+ }}+ /></div>);}diff --git a/web/src/features/score-analytics/README.md b/web/src/features/score-analytics/README.mdindex 0da79f3320..e3cd812e9f 100644--- a/web/src/features/score-analytics/README.md+++ b/web/src/features/score-analytics/README.md@@ -88,11 +88,13 @@ Chart Components (receive props)**Purpose**: Context provider that wraps `useScoreAnalyticsQuery` and exposes data to child components.**Responsibilities**:+- Calls `useScoreAnalyticsQuery` with query parameters- Determines color scheme based on mode (single vs two scores)- Exposes data, loading state, params, and colors via context**Usage**:+```tsx<ScoreAnalyticsProviderprojectId="..."@@ -112,6 +114,7 @@ Chart Components (receive props)**Purpose**: Fetches data from API and transforms it ONCE using pure functions.**Responsibilities**:+- Fetch data via tRPC (`api.scoreAnalytics.getScoreComparisonAnalytics`)- Transform data using functions from `/lib/scoreAnalyticsTransformers.ts`:- Extract categories (categorical/boolean only)@@ -124,6 +127,7 @@ Chart Components (receive props)- Return structured `ScoreAnalyticsData` object**Key Interfaces**:+```typescriptinterface ScoreAnalyticsQueryParams {projectId: string;@@ -149,6 +153,7 @@ interface ScoreAnalyticsData {**Purpose**: Self-contained components that consume context and handle their own UI logic.**Pattern**:+```tsxexport function ExampleCard() {const { data, isLoading, params, colors } = useScoreAnalytics();@@ -168,6 +173,7 @@ export function ExampleCard() {```**All cards**:+- Consume `useScoreAnalytics()` hook (NOT props)- Handle their own loading/empty states- Use data directly from context (no prop drilling)@@ -178,6 +184,7 @@ export function ExampleCard() {**Purpose**: Pure presentation components that receive data via props.**Pattern**:+```tsxinterface ChartProps {data: SomeDataType;@@ -198,6 +205,7 @@ export function ExampleChart({ data, dataType, score1Name, score2Name }: ChartPr**Purpose**: Pure functions for data transformation (no side effects).**Key Functions**:+- `extractCategories()` - Get unique categories from confusion matrix/stacked distribution- `fillDistributionBins()` - Fill missing bins with zero counts- `calculateModeMetrics()` - Calculate mode and mode percentage@@ -205,6 +213,7 @@ export function ExampleChart({ data, dataType, score1Name, score2Name }: ChartPr- `generateBinLabels()` - Generate formatted bin labels for numeric distributions**All functions**:+- Pure (same input β same output)- No side effects- Fully typed@@ -226,6 +235,7 @@ export function ExampleChart({ data, dataType, score1Name, score2Name }: ChartPr**Purpose**: tRPC router exposing score analytics API endpoints.**Procedures**:+- **`getScoreIdentifiers`**: Returns all available scores in a project (name, dataType, source)- **`estimateScoreComparisonSize`**: Estimates query size and determines if sampling is needed- Returns: score counts, estimated matched count, willSample flag, estimatedQueryTime@@ -236,6 +246,7 @@ export function ExampleChart({ data, dataType, score1Name, score2Name }: ChartPr- Returns: statistics, distributions, time series, heatmap data**ClickHouse Optimizations**:+- Uses `cityHash64` for consistent sampling- Dynamic FINAL application based on dataset size- Proper time interval alignment (ISO 8601 weeks, calendar months)@@ -357,11 +368,13 @@ if (isSingleScoreColors(colors)) {**Feature Directory**: `/web/src/features/score-analytics/`**Server (tRPC)**:+- Router: `/web/src/features/score-analytics/server/scoreAnalyticsRouter.ts`- Registered as: `api.scoreAnalytics.*`- Root registration: `/web/src/server/api/root.ts`**Utilities**:+- All utilities: `/web/src/features/score-analytics/lib/`- `scoreAnalyticsTransformers.ts` - Pure transformation functions- `analytics-url-state.ts` - URL state management@@ -373,6 +386,7 @@ if (isSingleScoreColors(colors)) {- Time series gap filling: `/web/src/utils/fill-time-series-gaps.ts`**Backend Repositories**:+- Score analytics queries: `/packages/shared/src/server/repositories/score-analytics.ts`## Performance Considerations@@ -387,6 +401,7 @@ if (isSingleScoreColors(colors)) {Backend tests: `/web/src/__tests__/server/score-comparison-analytics.servertest.ts`Test coverage:+- All data types (NUMERIC, BOOLEAN, CATEGORICAL)- All modes (single, two-score, same-score-twice)- Edge cases (empty data, missing bins, timezone handling)@@ -396,6 +411,7 @@ Test coverage:- Object type filtering (trace, observation, session, dataset_run)Run tests:+```bashpnpm --filter=web test "score-comparison-analytics"```diff --git a/web/src/features/search-bar/AI_FILTER_PLAN.md b/web/src/features/search-bar/AI_FILTER_PLAN.mdindex 34a4bd59ba..bc6794014a 100644--- a/web/src/features/search-bar/AI_FILTER_PLAN.md+++ b/web/src/features/search-bar/AI_FILTER_PLAN.md@@ -50,14 +50,14 @@ Quality is **bimodal and driven by the model** (`claude-3-haiku`), not theplumbing. Specific prompts are accurate; terse/refine prompts fall back to theprompt's few-shot example.-| Sev | Finding | Repro |-| --- | --- | --- |-| π΄ Major | **Refine silently corrupts existing filters on terse instructions.** The model regurgitates the prompt's few-shot example and ignores both the request and the visible refine context. | From `level:ERROR` + last-hour, "only in production" β `environment:production` + `latency:>5` (hallucinated) + `startTime:>24h` (wrong window); `level:ERROR` **dropped**. Reproduced with "also only errors" too. |-| π΄ Major | **Blind to the project's data** (no knowledge of actual metadata keys / observed values). | "routing queue should be membership-support" β `traceName:membership-support` (should be `metadata.routing.queue:*membership-support*`). |-| π Mod | **Focus dropped after a generation.** `disabled={pending}` blurs the input to `<body>` and it's never refocused; after a failed/empty generation, Esc no longer cancels and you must re-click to retype. | After a failed generate, `document.activeElement === body`. |-| π Mod | **Datetime pills are cryptic.** "last hour" renders as `startTime:>"2026-06-23T11:12:37.255Z"` (ms-precision ISO). Bar-wide rendering issue, surfaced by AI. | β |-| π‘ Minor | Refine context shows as a flat grey monospace string (truncates), not the colored pills used elsewhere. | β |-| π‘ Minor | Discoverability β "Ask AI" is a small muted button while the placeholder pushes the DSL; no cue that the AI produced the pills. | β |+| Sev | Finding | Repro |+| -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| π΄ Major | **Refine silently corrupts existing filters on terse instructions.** The model regurgitates the prompt's few-shot example and ignores both the request and the visible refine context. | From `level:ERROR` + last-hour, "only in production" β `environment:production` + `latency:>5` (hallucinated) + `startTime:>24h` (wrong window); `level:ERROR` **dropped**. Reproduced with "also only errors" too. |+| π΄ Major | **Blind to the project's data** (no knowledge of actual metadata keys / observed values). | "routing queue should be membership-support" β `traceName:membership-support` (should be `metadata.routing.queue:*membership-support*`). |+| π Mod | **Focus dropped after a generation.** `disabled={pending}` blurs the input to `<body>` and it's never refocused; after a failed/empty generation, Esc no longer cancels and you must re-click to retype. | After a failed generate, `document.activeElement === body`. |+| π Mod | **Datetime pills are cryptic.** "last hour" renders as `startTime:>"2026-06-23T11:12:37.255Z"` (ms-precision ISO). Bar-wide rendering issue, surfaced by AI. | β |+| π‘ Minor | Refine context shows as a flat grey monospace string (truncates), not the colored pills used elsewhere. | β |+| π‘ Minor | Discoverability β "Ask AI" is a small muted button while the placeholder pushes the DSL; no cue that the AI produced the pills. | β |**Works well (keep):** specific builds are accurate ("errors in the last hour","user alice slower than 10s", multi-filter); results are transparent editable@@ -76,21 +76,21 @@ stable across runs.**preserving context). Since prod runs Opus 4.8, the MVP prompt is good as-is; notuning needed to ship.-| Scenario | Prompt (+ refine ctx) | Expected cols | Opus 4.8 |-| --- | --- | --- | --- |-| build | errors in the last hour | level, startTime | β |-| build | slow traces in production | latency, environment | β |-| build | failed traces from user alice | level, userId | β |-| build | traces tagged billing | traceTags | β |-| build | accuracy score below 0.8 | scores_avg | β |-| build | output mentions refund | output | β |-| build | root observations only | isRootObservation | β |-| build | expensive gpt-4 calls over $0.5 | totalCost, providedModelName | β |-| refine (add) | `level:ERROR startTime:>β¦` + "also only in production" | level, startTime, environment | β preserved + added |-| refine (remove) | `latency:>2` + "drop latency, show only errors" | level | β removed + added |-| refine (change) | `environment:production` + "make it staging instead" | environment | β value changed |-| edge | gibberish | (none) | β empty |-| **gap** | routing queue is membership-support | metadata.routing.queue | β guesses traceName/sessionId |+| Scenario | Prompt (+ refine ctx) | Expected cols | Opus 4.8 |+| --------------- | ------------------------------------------------------ | ----------------------------- | ------------------------------ |+| build | errors in the last hour | level, startTime | β |+| build | slow traces in production | latency, environment | β |+| build | failed traces from user alice | level, userId | β |+| build | traces tagged billing | traceTags | β |+| build | accuracy score below 0.8 | scores_avg | β |+| build | output mentions refund | output | β |+| build | root observations only | isRootObservation | β |+| build | expensive gpt-4 calls over $0.5 | totalCost, providedModelName | β |+| refine (add) | `level:ERROR startTime:>β¦` + "also only in production" | level, startTime, environment | β preserved + added |+| refine (remove) | `latency:>2` + "drop latency, show only errors" | level | β removed + added |+| refine (change) | `environment:production` + "make it staging instead" | environment | β value changed |+| edge | gibberish | (none) | β empty |+| **gap** | routing queue is membership-support | metadata.routing.queue | β guesses traceName/sessionId |The one failure was the **data-awareness gap**: the model didn't know theproject's metadata keys (or actual `type`/name values), so it guessed a column.@@ -101,30 +101,30 @@ sampled from the visible rows) + the current result count β built on the clienfrom already-loaded `filterOptions` + visible rows (`lib/ai-context.ts`), cappedfor cost. Re-validated on Opus 4.8 with that context:-| Prompt | Before | After (with context) |-| --- | --- | --- |-| only support chat sessions | `type:chat` β 0 rows | `traceName:SupportChatSession` β |+| Prompt | Before | After (with context) |+| ----------------------------------- | ----------------------------- | ---------------------------------------------- |+| only support chat sessions | `type:chat` β 0 rows | `traceName:SupportChatSession` β || routing queue is membership-support | `traceName:β¦` / `sessionId:β¦` | `metadata.routing.queue:membership-support` β |-| errors in the last hour (control) | β | still β |+| errors in the last hour (control) | β | still β |The scenario set above is the seed for the Piece-2 eval dataset. Remaining-Piece-2 work: a sample of visible-row *content* (input/output) for even richer+Piece-2 work: a sample of visible-row _content_ (input/output) for even richergrounding, and the full managed-prompt + dataset/eval loop.### Full-surface capability coverage (also in the MVP)The prompt was expanded to teach the **whole** v4 grammar β not just simplecolumn matches β and to be **brave with metadata**. Validated on Opus 4.8 with-*variations* (not the verbatim examples), 7/7:--| Request | Generated |-| --- | --- |-| filter to the acme tenant | `metadata.tenant:acme` |-| mention 'password reset' in the response | `output:"password reset"` |-| where the sentiment is positive | `scores.sentiment:positive` |-| traces missing a user id | `-has:userId` |-| exclude debug and warning levels | `-level:(DEBUG OR WARNING)` |-| tagged with both experiment and baseline | `traceTags:(experiment AND baseline)` |+_variations_ (not the verbatim examples), 7/7:++| Request | Generated |+| ---------------------------------------------------- | -------------------------------------------------------------------------- |+| filter to the acme tenant | `metadata.tenant:acme` |+| mention 'password reset' in the response | `output:"password reset"` |+| where the sentiment is positive | `scores.sentiment:positive` |+| traces missing a user id | `-has:userId` |+| exclude debug and warning levels | `-level:(DEBUG OR WARNING)` |+| tagged with both experiment and baseline | `traceTags:(experiment AND baseline)` || expensive claude calls in staging that aren't errors | `providedModelName:claude totalCost:>0.5 environment:staging -level:ERROR` |So the generator now reaches into metadata, content (input/output) search,@@ -176,7 +176,7 @@ Don't choose between "registry-derived in code" and "managed in Langfuse" βThe endpoint fetches the prompt by label, compiles with those variables, and**links the prompt version to every trace** (`prompt:` in `traceSinkParams`, asthe v3 path already does). This is the lynchpin: it makes the example and the-refine instruction *versioned data we can A/B*, which is precisely where the+refine instruction _versioned data we can A/B_, which is precisely where theleakage lives.## 6. The dogfood loop@@ -208,11 +208,13 @@ case).## 7. TODO**Phase 0 β enrich tracing (small, parallelizable)**+- [ ] Add to each trace: mode (build/refine), `currentQuery`, parsed filters,`droppedCount`, applied-vs-empty; tag traces.- [ ] Confirm traces land in the AI-features project and are queryable by env.**Phase 1 β prompt β Prompt Management (hybrid)**+- [ ] Create managed prompt `search-bar-filter` (chat) in the AI-features projectwith the variables above; seed it from the current in-code prompt.- [ ] Refactor `buildFilterPrompt.ts` β `buildFilterVariables()` (catalog from@@ -222,6 +224,7 @@ case).fetch fails.**Phase 2 β eval harness + baseline**+- [ ] Build the `search-bar-filter-evals` dataset (seed cases incl. the failures).- [ ] Implement the deterministic scorer (reuse `parseGeneratedFilters` +`filterStateToQueryText`): exact-set, F1, `context_preserved`.@@ -229,6 +232,7 @@ case).current prompt+model before changing anything.**Phase 3 β tune with data**+- [ ] Iterate prompt versions: de-sticky / abstract the few-shot example;strengthen "preserve current filters; change only what's asked" for refine.- [ ] Add `{{observedContext}}` (metadata keys + observed values); ablate to prove@@ -239,10 +243,12 @@ case).silent loss is visible.**Phase 4 β close the loop (ongoing)**+- [ ] Curate failing production traces into the dataset.- [ ] Online implicit-feedback score (kept vs cleared/edited within N seconds).**Quick UX fixes (independent of the eval loop)**+- [ ] Restore focus after a generation (don't leave the input blurred to body).- [ ] Render the refine context as read-only pills, not a flat truncated string.- [ ] Friendlier datetime pill rendering (bar-wide; separate workstream).diff --git a/web/src/features/widgets/chart-library/Chart.tsx b/web/src/features/widgets/chart-library/Chart.tsxindex afa57015e9..d2c7c27ab8 100644--- a/web/src/features/widgets/chart-library/Chart.tsx+++ b/web/src/features/widgets/chart-library/Chart.tsx@@ -16,7 +16,7 @@ import { CardContent } from "@/src/components/ui/card";import { LineChartTimeSeries } from "@/src/features/widgets/chart-library/LineChartTimeSeries";import { AreaChartTimeSeries } from "@/src/features/widgets/chart-library/AreaChartTimeSeries";import { VerticalBarChartTimeSeries } from "@/src/features/widgets/chart-library/VerticalBarChartTimeSeries";-import { HorizontalBarChart } from "@/src/features/widgets/chart-library/HorizontalBarChart";+import { TopListChart } from "@/src/features/widgets/chart-library/TopListChart";import { VerticalBarChart } from "@/src/features/widgets/chart-library/VerticalBarChart";import { PieChart } from "@/src/features/widgets/chart-library/PieChart";import HistogramChart from "@/src/features/widgets/chart-library/HistogramChart";@@ -207,10 +207,9 @@ const ChartComponent = ({);case "HORIZONTAL_BAR":return (- <HorizontalBarChart+ <TopListChartdata={renderedData.slice(0, rowLimit)}config={resolvedConfig}- showValueLabels={chartConfig?.show_value_labels}metricFormatter={metricFormatter}subtleFill={chartConfig?.subtle_fill}/>@@ -272,9 +271,8 @@ const ChartComponent = ({}default:return (- <HorizontalBarChart+ <TopListChartdata={renderedData.slice(0, rowLimit)}- showValueLabels={chartConfig?.show_value_labels}metricFormatter={metricFormatter}/>);diff --git a/web/src/features/widgets/chart-library/TopListChart.tsx b/web/src/features/widgets/chart-library/TopListChart.tsxnew file mode 100644index 0000000000..8888eab8c2--- /dev/null+++ b/web/src/features/widgets/chart-library/TopListChart.tsx@@ -0,0 +1,144 @@+import React, { useCallback, useMemo, useState } from "react";+import { Check, Copy } from "lucide-react";+import { copyTextToClipboard } from "@/src/utils/clipboard";+import { type ChartProps } from "@/src/features/widgets/chart-library/chart-props";+import {+ formatMetric,+ toFullMetricString,+} from "@/src/features/widgets/chart-library/utils";++// Row rhythm: rows lay out top-aligned at up to MAX_ROW_PX each, shrink evenly+// down to MIN_ROW_PX when the tile is tight, and scroll below that. Done with+// flex-basis/min-height only, so the component never measures its container+// (charts must stay a pure function of their box β see BarListChartArea).+const MAX_ROW_PX = 56;+const MIN_ROW_PX = 20;+const ROW_GAP_PX = 1;+// Label/value text steps through the type scale with the row height (each+// row is a size container): text-xs by default, text-sm from 36px rows,+// text-base from 48px β never anything off-scale, capped at base.+const ROW_TEXT_STEPS =+ "text-xs [@container(min-height:36px)]:text-sm [@container(min-height:48px)]:text-base";++const CopyDimensionButton: React.FC<{ value: string }> = ({ value }) => {+ const [copied, setCopied] = useState(false);+ return (+ <button+ type="button"+ aria-label={`Copy "${value}"`}+ title={`Copy "${value}"`}+ className="text-muted-foreground hover:bg-background/60 hover:text-foreground pointer-events-auto shrink-0 rounded p-1 opacity-0 transition-opacity group-hover/row:opacity-100 focus-visible:opacity-100"+ onClick={async (e) => {+ e.stopPropagation();+ try {+ // Shared util: falls back to execCommand on non-secure contexts+ // (plain-HTTP self-hosted deployments).+ await copyTextToClipboard(value);+ setCopied(true);+ setTimeout(() => setCopied(false), 1200);+ } catch (error) {+ console.error("Unable to copy to clipboard", error);+ }+ }}+ >+ {copied ? (+ <Check className="h-3.5 w-3.5" />+ ) : (+ <Copy className="h-3.5 w-3.5" />+ )}+ </button>+ );+};++/**+ * TopListChart: the HORIZONTAL_BAR visualiser. A ranked list where each row+ * shows the metric value in a left column and the dimension label on top of a+ * subtle proportional bar (top-list pattern Γ la Datadog). Rows keep a+ * readable rhythm regardless of how few or many there are β few rows sit+ * top-aligned instead of being spread across the tile β and the+ * dimension name is copyable on hover.+ */+export const TopListChart: React.FC<ChartProps> = ({+ data,+ metricFormatter = (value, options) => formatMetric(value, options),+ subtleFill = false,+}) => {+ const formatValue = useCallback(+ (value: number) =>+ toFullMetricString(metricFormatter(value, { style: "compact" })),+ [metricFormatter],+ );++ const rows = useMemo(+ () =>+ (data ?? []).map((d) => ({+ dimension: d.dimension ?? "n/a",+ value: typeof d.metric === "number" ? d.metric : Number(d.metric ?? 0),+ })),+ [data],+ );++ // Bars encode magnitude relative to the largest |value|; the signed value+ // in the adjacent column carries the sign. This keeps negative metrics+ // (e.g. an averaged -1..1 score) visually ranked instead of collapsing+ // every bar to zero width.+ const maxMagnitude = useMemo(+ () => Math.max(...rows.map((r) => Math.abs(r.value)), 0),+ [rows],+ );++ // Size the value column to the longest formatted value so bars align.+ const valueColumnCh = useMemo(+ () => Math.max(...rows.map((r) => formatValue(r.value).length), 2),+ [rows, formatValue],+ );++ return (+ <div+ // :has() dims every row except the hovered one, so the hovered row (and+ // its copy affordance) reads as the single focused item.+ className="flex h-full min-h-0 w-full flex-col overflow-x-hidden overflow-y-auto [&:has(>div:hover)>div:not(:hover)]:opacity-40"+ style={{ gap: ROW_GAP_PX }}+ data-testid="top-list-chart"+ >+ {rows.map((row, i) => (+ <div+ key={`${row.dimension}-${i}`}+ className="group/row hover:bg-accent/60 flex items-center gap-2 rounded-sm transition-opacity"+ style={{+ flex: `0 1 ${MAX_ROW_PX}px`,+ minHeight: MIN_ROW_PX,+ // Each row is a size container so ROW_TEXT_STEPS can step the+ // type scale by row height.+ containerType: "size",+ }}+ title={`${row.dimension}: ${formatValue(row.value)}`}+ >+ <div+ className={`shrink-0 text-right font-bold tabular-nums ${ROW_TEXT_STEPS}`}+ style={{ width: `${valueColumnCh}ch` }}+ >+ {formatValue(row.value)}+ </div>+ <div className="relative h-full min-w-0 flex-1">+ <div+ className="h-full rounded-sm"+ style={{+ width: `${maxMagnitude > 0 ? (Math.abs(row.value) / maxMagnitude) * 100 : 0}%`,+ backgroundColor: `hsl(var(--chart-1) / ${subtleFill ? 0.15 : 0.3})`,+ }}+ />+ <div+ className={`absolute inset-y-0 left-2 flex max-w-full min-w-0 items-center gap-1 pr-2 ${ROW_TEXT_STEPS}`}+ >+ <span className="text-foreground truncate" title={row.dimension}>+ {row.dimension}+ </span>+ <CopyDimensionButton value={row.dimension} />+ </div>+ </div>+ </div>+ ))}+ </div>+ );+};diff --git a/web/src/features/widgets/components/DashboardGrid.tsx b/web/src/features/widgets/components/DashboardGrid.tsxindex 85282ddce7..626a4bb694 100644--- a/web/src/features/widgets/components/DashboardGrid.tsx+++ b/web/src/features/widgets/components/DashboardGrid.tsx@@ -78,7 +78,6 @@ export function DashboardGrid({getWidgetSchedulerId,onLockedEditAttempt,readOnly,- onPasteWidget,onDuplicateWidget,onDuplicatePreset,}: {@@ -101,9 +100,7 @@ export function DashboardGrid({onLockedEditAttempt?: () => void;/** Pure viewing surface (e.g. Home): tiles render no edit affordances. */readOnly?: boolean;- /** Paste the clipboard widget/card next to a tile (editable dashboards only). */- onPasteWidget?: (anchor: DashboardPlacement) => void;- /** Duplicate a tile's widget next to it (editable dashboards only). */+ /** Clone a tile's widget next to it (editable dashboards only). */onDuplicateWidget?: (anchor: WidgetPlacement,widget: WidgetExportSource,@@ -179,7 +176,6 @@ export function DashboardGrid({schedulerId={getWidgetSchedulerId?.(widget.id)}onLockedEditAttempt={onLockedEditAttempt}readOnly={readOnly}- onPasteWidget={onPasteWidget}onDuplicatePreset={onDuplicatePreset}/>) : (@@ -194,7 +190,6 @@ export function DashboardGrid({schedulerId={getWidgetSchedulerId?.(widget.id)}onLockedEditAttempt={onLockedEditAttempt}readOnly={readOnly}- onPasteWidget={onPasteWidget}onDuplicateWidget={onDuplicateWidget}/>);diff --git a/web/src/features/widgets/components/DashboardWidget.tsx b/web/src/features/widgets/components/DashboardWidget.tsxindex 01a0abf25e..90a4929bdb 100644--- a/web/src/features/widgets/components/DashboardWidget.tsx+++ b/web/src/features/widgets/components/DashboardWidget.tsx@@ -21,7 +21,6 @@ import {GripVerticalIcon,MoreVerticalIcon,CopyIcon,- ClipboardPasteIcon,CopyPlusIcon,FileJsonIcon,DownloadIcon,@@ -34,6 +33,7 @@ import {} from "@/src/features/dashboard/lib/buildTableFilterHref";import { useHasProjectAccess } from "@/src/features/rbac/utils/checkProjectAccess";import { showErrorToast } from "@/src/features/notifications/showErrorToast";+import { showSuccessToast } from "@/src/features/notifications/showSuccessToast";import { downloadChartDataCsv } from "@/src/features/widgets/chart-library/downloadChartDataCsv";import {buildWidgetExport,@@ -41,9 +41,7 @@ import {type WidgetExportSource,} from "@/src/features/widgets/utils/import-export-utils";import { copyTextToClipboard } from "@/src/utils/clipboard";-import { useClipboardWidgetProbe } from "@/src/features/widgets/hooks/useClipboardWidgetProbe";import { useCaptureWidgetHighCardinalityError } from "@/src/features/widgets/hooks/useWidgetQueryErrorCapture";-import { isPasteablePlacementPayload } from "@/src/features/dashboard/utils/dashboard-import-export";import {DropdownMenu,DropdownMenuContent,@@ -91,7 +89,6 @@ export function DashboardWidget({schedulerId,onLockedEditAttempt,readOnly,- onPasteWidget,onDuplicateWidget,}: {projectId: string;@@ -111,12 +108,7 @@ export function DashboardWidget({/** Pure viewing surface (e.g. Home): render no edit affordances. */readOnly?: boolean;/**- * Pastes the clipboard widget next to this tile. Passed only on editable- * (non-locked) dashboards; absent β no "Paste to the right" menu item.- */- onPasteWidget?: (anchor: WidgetPlacement) => void;- /**- * Duplicates this widget (new widget row seeded from `widget`) next to this+ * Clones this widget (new widget row seeded from `widget`) next to this* tile. Passed only on editable (non-locked) dashboards.*/onDuplicateWidget?: (@@ -175,17 +167,6 @@ export function DashboardWidget({});const [retryCount, setRetryCount] = useState(0);const [isCopyDialogOpen, setIsCopyDialogOpen] = useState(false);- const [isActionsMenuOpen, setIsActionsMenuOpen] = useState(false);- // Gate "Paste to the right" on the clipboard actually holding a pasteable- // payload, where the browser lets us check silently.- const isPasteablePayload = useCallback(- (text: string) => isPasteablePlacementPayload(text, { isBetaEnabled }),- [isBetaEnabled],- );- const clipboardProbe = useClipboardWidgetProbe(- isActionsMenuOpen && Boolean(onPasteWidget),- isPasteablePayload,- );// Apply defaultSort when it becomes available (after widget data loads)// but only if user hasn't interacted yet@@ -606,6 +587,10 @@ export function DashboardWidget({widget_id: placement.widgetId,dashboard_id: dashboardId,});+ showSuccessToast({+ title: "Widget copied",+ description: "Paste it on any dashboard with Cmd/Ctrl+V.",+ });} catch {showErrorToast("Copy failed", "Could not write to the clipboard.");}@@ -687,16 +672,9 @@ export function DashboardWidget({<PencilIcon size={16} /></button>) : null}- <button- onClick={handleDelete}- className="text-muted-foreground hover:text-destructive hidden group-hover:block"- aria-label="Delete widget"- >- <TrashIcon size={16} />- </button></>)}- <DropdownMenu onOpenChange={setIsActionsMenuOpen}>+ <DropdownMenu><DropdownMenuTrigger asChild><buttonclassName="text-muted-foreground hover:text-foreground hidden group-hover:block data-[state=open]:block"@@ -729,17 +707,8 @@ export function DashboardWidget({)}<DropdownMenuItem onClick={handleCopyToClipboard}><CopyIcon className="mr-2 h-4 w-4" />- Copy to clipboard+ Copy widget</DropdownMenuItem>- {onPasteWidget && (- <DropdownMenuItem- disabled={clipboardProbe === "no-widget"}- onClick={() => onPasteWidget(placement)}- >- <ClipboardPasteIcon className="mr-2 h-4 w-4" />- Paste to the right- </DropdownMenuItem>- )}{onDuplicateWidget && (<DropdownMenuItemonClick={() =>@@ -747,7 +716,7 @@ export function DashboardWidget({}><CopyPlusIcon className="mr-2 h-4 w-4" />- Duplicate+ Clone</DropdownMenuItem>)}<DropdownMenuSeparator />@@ -765,6 +734,18 @@ export function DashboardWidget({<DownloadIcon className="mr-2 h-4 w-4" />Download data as CSV</DropdownMenuItem>+ {!readOnly && (hasCUDAccess || isLockedEditable) && (+ <>+ <DropdownMenuSeparator />+ <DropdownMenuItem+ onClick={handleDelete}+ className="text-destructive focus:text-destructive"+ >+ <TrashIcon className="mr-2 h-4 w-4" />+ Delete+ </DropdownMenuItem>+ </>+ )}</DropdownMenuContent></DropdownMenu></div>diff --git a/web/src/features/widgets/components/PresetDashboardWidget.tsx b/web/src/features/widgets/components/PresetDashboardWidget.tsxindex 881c89262f..d1b9a4998b 100644--- a/web/src/features/widgets/components/PresetDashboardWidget.tsx+++ b/web/src/features/widgets/components/PresetDashboardWidget.tsx@@ -1,6 +1,5 @@-import { useCallback, useMemo, useState } from "react";+import { useMemo } from "react";import {- ClipboardPasteIcon,CopyIcon,CopyPlusIcon,GripVerticalIcon,@@ -16,18 +15,16 @@ import {getHomePreset,type PresetWidgetContext,} from "@/src/features/dashboard/components/home-preset-registry";-import {- buildPresetExport,- isPasteablePlacementPayload,-} from "@/src/features/dashboard/utils/dashboard-import-export";+import { buildPresetExport } from "@/src/features/dashboard/utils/dashboard-import-export";import { copyTextToClipboard } from "@/src/utils/clipboard";import { showErrorToast } from "@/src/features/notifications/showErrorToast";+import { showSuccessToast } from "@/src/features/notifications/showSuccessToast";import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";-import { useClipboardWidgetProbe } from "@/src/features/widgets/hooks/useClipboardWidgetProbe";import {DropdownMenu,DropdownMenuContent,DropdownMenuItem,+ DropdownMenuSeparator,DropdownMenuTrigger,} from "@/src/components/ui/dropdown-menu";@@ -57,7 +54,6 @@ export function PresetDashboardWidget({schedulerId,onLockedEditAttempt,readOnly,- onPasteWidget,onDuplicatePreset,}: {projectId: string;@@ -77,13 +73,8 @@ export function PresetDashboardWidget({/** Pure viewing surface (e.g. Home): render no edit affordances. */readOnly?: boolean;/**- * Pastes the clipboard widget/card next to this tile. Passed only on- * editable (non-locked) dashboards.- */- onPasteWidget?: (anchor: PresetPlacement) => void;- /**- * Adds another placement of this preset card next to this tile. Passed- * only on editable (non-locked) dashboards.+ * Adds another placement of this preset card next to this tile (clone).+ * Passed only on editable (non-locked) dashboards.*/onDuplicatePreset?: (anchor: PresetPlacement) => void;}) {@@ -167,18 +158,6 @@ export function PresetDashboardWidget({};const capture = usePostHogClientCapture();- const [isActionsMenuOpen, setIsActionsMenuOpen] = useState(false);- // Gate "Paste to the right" on the clipboard actually holding a pasteable- // payload, where the browser lets us check silently.- const isPasteablePayload = useCallback(- (text: string) => isPasteablePlacementPayload(text, { isBetaEnabled }),- [isBetaEnabled],- );- const clipboardProbe = useClipboardWidgetProbe(- isActionsMenuOpen && Boolean(onPasteWidget),- isPasteablePayload,- );-const handleCopyToClipboard = async () => {try {await copyTextToClipboard(@@ -190,6 +169,10 @@ export function PresetDashboardWidget({preset_id: placement.presetId,dashboard_id: dashboardId,});+ showSuccessToast({+ title: "Card copied",+ description: "Paste it on any dashboard with Cmd/Ctrl+V.",+ });} catch {showErrorToast("Copy failed", "Could not write to the clipboard.");}@@ -212,21 +195,12 @@ export function PresetDashboardWidget({only the edit affordances (drag, delete) are gated. */}<div className="bg-background/95 absolute top-2 right-2 z-10 hidden items-center gap-2 rounded-md border px-1.5 py-1 shadow-sm group-hover:flex has-data-[state=open]:flex">{!readOnly && (hasCUDAccess || isLockedEditable) && (- <>- <GripVerticalIcon- size={16}- className="drag-handle text-muted-foreground hover:text-foreground hidden cursor-grab active:cursor-grabbing lg:block"- />- <button- onClick={handleDelete}- className="text-muted-foreground hover:text-destructive"- aria-label="Delete widget"- >- <TrashIcon size={16} />- </button>- </>+ <GripVerticalIcon+ size={16}+ className="drag-handle text-muted-foreground hover:text-foreground hidden cursor-grab active:cursor-grabbing lg:block"+ />)}- <DropdownMenu onOpenChange={setIsActionsMenuOpen}>+ <DropdownMenu><DropdownMenuTrigger asChild><buttonclassName="text-muted-foreground hover:text-foreground"@@ -238,23 +212,26 @@ export function PresetDashboardWidget({<DropdownMenuContent align="end"><DropdownMenuItem onClick={handleCopyToClipboard}><CopyIcon className="mr-2 h-4 w-4" />- Copy to clipboard+ Copy card</DropdownMenuItem>- {onPasteWidget && (- <DropdownMenuItem- disabled={clipboardProbe === "no-widget"}- onClick={() => onPasteWidget(placement)}- >- <ClipboardPasteIcon className="mr-2 h-4 w-4" />- Paste to the right- </DropdownMenuItem>- )}{onDuplicatePreset && (<DropdownMenuItem onClick={() => onDuplicatePreset(placement)}><CopyPlusIcon className="mr-2 h-4 w-4" />- Duplicate+ Clone</DropdownMenuItem>)}+ {!readOnly && (hasCUDAccess || isLockedEditable) && (+ <>+ <DropdownMenuSeparator />+ <DropdownMenuItem+ onClick={handleDelete}+ className="text-destructive focus:text-destructive"+ >+ <TrashIcon className="mr-2 h-4 w-4" />+ Delete+ </DropdownMenuItem>+ </>+ )}</DropdownMenuContent></DropdownMenu></div>diff --git a/web/src/features/widgets/components/WidgetTable.tsx b/web/src/features/widgets/components/WidgetTable.tsxindex bb13615b1c..8aae6c5cf8 100644--- a/web/src/features/widgets/components/WidgetTable.tsx+++ b/web/src/features/widgets/components/WidgetTable.tsx@@ -141,6 +141,10 @@ function WidgetActionsCell({kind: "widget",widget_id: widgetId,});+ showSuccessToast({+ title: "Widget copied",+ description: "Paste it on any dashboard with Cmd/Ctrl+V.",+ });} catch (error) {showErrorToast("Failed to copy widget",@@ -168,7 +172,7 @@ function WidgetActionsCell({});utils.dashboardWidgets.invalidate();showSuccessToast({- title: "Widget duplicated",+ title: "Widget cloned",description: `Created "${exportSource.name} (Copy)".`,});} catch (error) {@@ -190,11 +194,11 @@ function WidgetActionsCell({<DropdownMenuContent align="end"><DropdownMenuItem onClick={handleCopyToClipboard}><Copy className="mr-2 h-4 w-4" />- Copy to clipboard+ Copy widget</DropdownMenuItem><DropdownMenuItem disabled={!hasCUDAccess} onClick={handleDuplicate}><CopyPlus className="mr-2 h-4 w-4" />- Duplicate+ Clone</DropdownMenuItem><DropdownMenuItem onClick={handleDownloadJson}><FileJson className="mr-2 h-4 w-4" />diff --git a/web/src/pages/dev/widget-bar-spacing.tsx b/web/src/pages/dev/widget-bar-spacing.tsxnew file mode 100644index 0000000000..8995f4d245--- /dev/null+++ b/web/src/pages/dev/widget-bar-spacing.tsx@@ -0,0 +1,510 @@+// Dev-only test bed for dashboard widget chart spacing.+// Renders the HORIZONTAL_BAR widget chart in several spacing strategies at+// several row counts so the options can be compared side by side.+// Not linked from anywhere; visit /dev/widget-bar-spacing directly.+import React, { useCallback, useMemo, useState } from "react";+import { useRouter } from "next/router";+import { Check, Copy } from "lucide-react";+import {+ ChartContainer,+ ChartTooltip,+ ChartTooltipContent,+} from "@/src/components/ui/chart";+import {+ Bar,+ BarChart,+ LabelList,+ type RenderableText,+ XAxis,+ YAxis,+} from "recharts";+import { HorizontalBarChart } from "@/src/features/widgets/chart-library/HorizontalBarChart";+import {+ formatAxisLabel,+ formatMetric,+ toFullMetricString,+} from "@/src/features/widgets/chart-library/utils";+import { barListToDataPoints } from "@/src/features/dashboard/lib/chart-data-adapters";+import { numberFormatter } from "@/src/utils/numbers";+import { copyTextToClipboard } from "@/src/utils/clipboard";++const TRACE_NAMES = [+ "in-app-agent-conversation",+ "agent-turn",+ "chat-completion",+ "generate-summary",+ "qa-retrieval",+ "classify-intent",+ "extract-entities",+ "rerank-documents",+ "embed-chunks",+ "guardrail-check",+ "tool-call-search",+ "tool-call-code",+ "prompt-experiment",+ "eval-run",+ "session-title",+ "autocomplete",+ "translate-message",+ "moderation",+ "healthcheck-probe",+ "batch-export",+];++function mockRows(n: number) {+ return TRACE_NAMES.slice(0, n).map((name, i) => ({+ name,+ value: Math.round(3306 / (1 + i * 0.55)),+ }));+}++// Constants mirrored from TracesBarListChart.tsx+const BAR_ROW_HEIGHT = 40;+const CHART_AXIS_PADDING = 30;++/**+ * Local copy of HorizontalBarChart with the bar sizing knobs exposed, so+ * variants can change maxBarSize / barCategoryGap without touching prod code.+ */+const TunableHorizontalBarChart: React.FC<{+ data: ReturnType<typeof barListToDataPoints>;+ maxBarSize?: number;+ barCategoryGap?: string | number;+}> = ({ data, maxBarSize, barCategoryGap = "12%" }) => {+ const formatValue = useCallback(+ (value: number) =>+ toFullMetricString(formatMetric(value, { style: "compact" })),+ [],+ );+ const rightMargin = useMemo(() => {+ if (!data?.length) return 8;+ const maxLabelLength = Math.max(+ ...data.map((d) => formatValue(Number(d.metric ?? 0)).length),+ );+ return Math.min(120, Math.max(20, maxLabelLength * 7 + 16));+ }, [data, formatValue]);++ return (+ <ChartContainer+ config={{+ metric: {+ theme: {+ light: "hsl(var(--chart-1))",+ dark: "hsl(var(--chart-1))",+ },+ },+ }}+ className="min-h-0 w-full"+ >+ <BarChart+ data={data}+ layout="vertical"+ margin={{ top: 4, right: rightMargin, bottom: 4, left: 0 }}+ barCategoryGap={barCategoryGap}+ barGap={4}+ >+ <XAxis+ type="number"+ stroke="hsl(var(--chart-grid))"+ fontSize={12}+ tickLine={false}+ axisLine={false}+ niceTicks="auto"+ tickFormatter={(value) => formatValue(Number(value))}+ />+ <YAxis+ type="category"+ dataKey="dimension"+ stroke="hsl(var(--chart-grid))"+ fontSize={12}+ tickLine={false}+ axisLine={false}+ width={120}+ tick={({ x, y, payload }) => {+ const fullLabel =+ typeof payload === "string"+ ? payload+ : ((payload as { value?: string })?.value ?? String(payload));+ return (+ <g transform={`translate(${x},${y})`}>+ <title>{fullLabel}</title>+ <text+ textAnchor="end"+ x={0}+ y={0}+ dy={4}+ fill="hsl(var(--muted-foreground))"+ fontSize={12}+ >+ {formatAxisLabel(fullLabel)}+ </text>+ </g>+ );+ }}+ />+ <Bar+ dataKey="metric"+ radius={[0, 4, 4, 0]}+ maxBarSize={maxBarSize}+ className="fill-(--color-metric)"+ isAnimationActive={false}+ >+ <LabelList+ dataKey="metric"+ position="right"+ formatter={(value: RenderableText) =>+ formatValue(Number(value ?? 0))+ }+ className="fill-muted-foreground"+ style={{ fontSize: 12 }}+ />+ </Bar>+ <ChartTooltip+ cursor={false}+ contentStyle={{ backgroundColor: "hsl(var(--background))" }}+ content={({ active, payload, label }) => (+ <ChartTooltipContent+ active={active}+ payload={payload}+ label={label}+ valueFormatter={(v) => formatValue(Number(v))}+ />+ )}+ />+ </BarChart>+ </ChartContainer>+ );+};++/** Hover-reveal copy button for a top-list row's dimension name. */+const CopyNameButton: React.FC<{ name: string }> = ({ name }) => {+ const [copied, setCopied] = useState(false);+ return (+ <button+ aria-label={`Copy "${name}"`}+ title={`Copy "${name}"`}+ className="text-muted-foreground hover:bg-background/60 hover:text-foreground pointer-events-auto rounded p-1 opacity-0 transition-opacity group-hover/row:opacity-100 focus-visible:opacity-100"+ onClick={async () => {+ try {+ await copyTextToClipboard(name);+ setCopied(true);+ setTimeout(() => setCopied(false), 1200);+ } catch (error) {+ console.error("Unable to copy to clipboard", error);+ }+ }}+ >+ {copied ? (+ <Check className="h-3.5 w-3.5" />+ ) : (+ <Copy className="h-3.5 w-3.5" />+ )}+ </button>+ );+};++/**+ * Top list: value in a left column, dimension label rendered on+ * top of the bar, rows top-aligned. Row height grows with available space up+ * to a threshold (MAX_ROW), shrinks down to MIN_ROW, then the list scrolls.+ */+const TopList: React.FC<{+ rows: { name: string; value: number }[];+ availableHeightPx: number;+ minRowPx?: number;+ maxRowPx?: number;+}> = ({ rows, availableHeightPx, minRowPx = 20, maxRowPx = 56 }) => {+ const GAP = 1;+ const max = Math.max(...rows.map((r) => r.value), 1);+ const fit = (availableHeightPx - GAP * (rows.length - 1)) / rows.length;+ const rowH = Math.max(minRowPx, Math.min(maxRowPx, Math.floor(fit)));+ const formatValue = (value: number) =>+ toFullMetricString(formatMetric(value, { style: "compact" }));+ return (+ <div+ className="flex h-full min-h-0 flex-col overflow-y-auto [&:has(>div:hover)>div:not(:hover)]:opacity-40"+ style={{ gap: GAP }}+ >+ {rows.map((r) => (+ <div+ key={r.name}+ className={`group/row hover:bg-accent/60 flex shrink-0 items-center gap-2 rounded-sm transition-opacity ${+ rowH >= 48 ? "text-base" : rowH >= 36 ? "text-sm" : "text-xs"+ }`}+ style={{ height: rowH }}+ >+ <div className="w-14 shrink-0 text-right text-sm font-bold tabular-nums">+ {formatValue(r.value)}+ </div>+ <div className="relative h-full min-w-0 flex-1">+ <div+ className="h-full rounded-sm"+ style={{+ width: `${(r.value / max) * 100}%`,+ backgroundColor: "hsl(var(--chart-1) / 0.3)",+ }}+ />+ <span+ className="text-foreground absolute inset-y-0 left-2 flex items-center gap-1 text-sm whitespace-nowrap"+ title={r.name}+ >+ {r.name}+ <CopyNameButton name={r.name} />+ </span>+ </div>+ </div>+ ))}+ </div>+ );+};++/** Pure-CSS bar list (no Recharts): fixed compact rows, top-aligned. */+const CssBarList: React.FC<{ rows: { name: string; value: number }[] }> = ({+ rows,+}) => {+ const max = Math.max(...rows.map((r) => r.value), 1);+ return (+ <div className="flex h-full min-h-0 flex-col gap-1.5 overflow-y-auto pr-2">+ {rows.map((r) => (+ <div key={r.name} className="flex shrink-0 items-center gap-2">+ <div+ className="text-muted-foreground w-[120px] shrink-0 truncate text-right text-xs"+ title={r.name}+ >+ {r.name}+ </div>+ <div className="relative h-6 flex-1">+ <div+ className="h-full rounded-r bg-[hsl(var(--chart-1))]"+ style={{ width: `${(r.value / max) * 100}%` }}+ />+ </div>+ <div className="text-muted-foreground w-12 shrink-0 text-xs">+ {numberFormatter(r.value, 0)}+ </div>+ </div>+ ))}+ </div>+ );+};++const TILE_HEADER_PX = 64;++const Tile: React.FC<{+ title: string;+ subtitle: string;+ heightPx: number;+ children: React.ReactNode;+}> = ({ title, subtitle, heightPx, children }) => (+ <div+ className="bg-card flex w-[420px] shrink-0 flex-col rounded-lg border p-4"+ style={{ height: heightPx }}+ >+ <div style={{ height: TILE_HEADER_PX - 16 }}>+ <div className="text-sm font-bold">{title}</div>+ <div className="text-muted-foreground text-xs">{subtitle}</div>+ </div>+ <div className="min-h-0 w-full flex-1">{children}</div>+ </div>+);++export default function WidgetBarSpacingTestPage() {+ const [tileHeight, setTileHeight] = useState(420);+ // ?variant=<key> renders only that variant, ?counts=2,5,10 overrides the+ // row counts, ?bare=1 hides page chrome (clean screenshots).+ const router = useRouter();+ const variantFilter =+ typeof router.query.variant === "string" ? router.query.variant : null;+ const counts =+ typeof router.query.counts === "string"+ ? router.query.counts+ .split(",")+ .map(Number)+ .filter((n) => n > 0)+ : [2, 3, 5, 10, 20];+ const bare = router.query.bare === "1";+ const chartAreaHeight = tileHeight - 16 * 2 - TILE_HEADER_PX + 16;++ const variants: {+ key: string;+ title: string;+ subtitle: string;+ render: (rows: { name: string; value: number }[]) => React.ReactNode;+ }[] = [+ {+ key: "current",+ title: "A Β· Current (bug)",+ subtitle: "bars spread across full tile height, 28px cap",+ render: (rows) => (+ <div className="h-full w-full">+ <HorizontalBarChart+ data={barListToDataPoints(rows)}+ showValueLabels+ />+ </div>+ ),+ },+ {+ key: "hug-top",+ title: "B Β· Hug rows, top-aligned",+ subtitle: `chart height = min(tile, rows Γ ${BAR_ROW_HEIGHT} + ${CHART_AXIS_PADDING})`,+ render: (rows) => (+ <div className="h-full w-full overflow-y-auto">+ <div+ className="w-full"+ style={{+ height: Math.min(+ chartAreaHeight,+ rows.length * BAR_ROW_HEIGHT + CHART_AXIS_PADDING,+ ),+ }}+ >+ <HorizontalBarChart+ data={barListToDataPoints(rows)}+ showValueLabels+ />+ </div>+ </div>+ ),+ },+ {+ key: "combo-bd",+ title: "G Β· B+D combo, capped (Recharts)",+ subtitle: "row band grows 40β64px with spare room, then top-aligns",+ render: (rows) => {+ const rowBand = Math.max(+ BAR_ROW_HEIGHT,+ Math.min(+ 64,+ Math.floor((chartAreaHeight - CHART_AXIS_PADDING) / rows.length),+ ),+ );+ const chartHeight = Math.min(+ chartAreaHeight,+ rows.length * rowBand + CHART_AXIS_PADDING,+ );+ return (+ <div className="h-full w-full overflow-y-auto">+ <div className="w-full" style={{ height: chartHeight }}>+ <TunableHorizontalBarChart+ data={barListToDataPoints(rows)}+ maxBarSize={48}+ />+ </div>+ </div>+ );+ },+ },+ {+ key: "top-list",+ title: "F Β· Top list",+ subtitle:+ "value left, label on bar; rows grow to max 56px, min 20px; hover row to copy name",+ render: (rows) => (+ <TopList rows={rows} availableHeightPx={chartAreaHeight} />+ ),+ },+ {+ key: "hug-center",+ title: "C Β· Hug rows, centered",+ subtitle: "same capped height, vertically centered in tile",+ render: (rows) => (+ <div className="flex h-full w-full flex-col justify-center overflow-y-auto">+ <div+ className="w-full shrink-0"+ style={{+ height: Math.min(+ chartAreaHeight,+ rows.length * BAR_ROW_HEIGHT + CHART_AXIS_PADDING,+ ),+ }}+ >+ <HorizontalBarChart+ data={barListToDataPoints(rows)}+ showValueLabels+ />+ </div>+ </div>+ ),+ },+ {+ key: "fill-uncapped",+ title: "D Β· Fill, uncapped bars",+ subtitle: "no maxBarSize; bars fatten to fill tile, 25% gap",+ render: (rows) => (+ <div className="h-full w-full">+ <TunableHorizontalBarChart+ data={barListToDataPoints(rows)}+ barCategoryGap="25%"+ />+ </div>+ ),+ },+ {+ key: "css-list",+ title: "E Β· CSS bar list",+ subtitle: "no Recharts; fixed 24px rows, top-aligned, scrolls",+ render: (rows) => <CssBarList rows={rows} />,+ },+ ];++ return (+ <div className="bg-background text-foreground min-h-screen p-8">+ {!bare && (+ <>+ <h1 className="text-xl font-bold">+ Dashboard widget bar chart spacing variants+ </h1>+ <p className="text-muted-foreground mt-1 max-w-3xl text-sm">+ Each section fixes the row count and shows all variants side by side+ in a tile the size of the Home "Traces" card. Variant A is+ today's behavior: Recharts distributes N category bands evenly+ over the full tile height and caps bar thickness at 28px, so few+ rows β bars pinned far apart.+ </p>+ <div className="mt-4 flex items-center gap-2 text-sm">+ <span className="text-muted-foreground">Tile height:</span>+ {[320, 420, 560].map((h) => (+ <button+ key={h}+ onClick={() => setTileHeight(h)}+ className={`rounded border px-2 py-1 ${+ tileHeight === h+ ? "bg-primary text-primary-foreground"+ : "bg-card hover:bg-accent"+ }`}+ >+ {h}px+ </button>+ ))}+ </div>+ </>+ )}++ {counts.map((n) => {+ const rows = mockRows(n);+ return (+ <section key={n} className={bare ? "" : "mt-10"}>+ {!bare && <h2 className="mb-3 text-base font-bold">{n} rows</h2>}+ <div className="flex gap-4 overflow-x-auto pb-2">+ {variants+ .filter((v) => !variantFilter || v.key === variantFilter)+ .map((v) => (+ <Tile+ key={v.key}+ title={v.title}+ subtitle={v.subtitle}+ heightPx={tileHeight}+ >+ {v.render(rows)}+ </Tile>+ ))}+ </div>+ </section>+ );+ })}+ </div>+ );+}++WidgetBarSpacingTestPage.skipAppLayout = true;diff --git a/web/src/pages/project/[projectId]/dashboards/[dashboardId]/index.tsx b/web/src/pages/project/[projectId]/dashboards/[dashboardId]/index.tsxindex efb114c1db..5540804744 100644--- a/web/src/pages/project/[projectId]/dashboards/[dashboardId]/index.tsx+++ b/web/src/pages/project/[projectId]/dashboards/[dashboardId]/index.tsx@@ -421,7 +421,7 @@ export default function DashboardDetail() {const handlePastedPreset = useCallback((presetId: HomeDashboardPresetId,- source: "cmd_v" | "dashboard_menu" | "paste_right" | "drop",+ source: "cmd_v" | "dashboard_menu" | "drop",anchor?: DashboardPlacement,) => {capture("dashboard:widget_pasted", {@@ -476,7 +476,7 @@ export default function DashboardDetail() {const handleParsedWidgetPaste = useCallback(async (parsed: Exclude<PastedWidgetParseResult, { status: "not-widget" }>,- source: "cmd_v" | "dashboard_menu" | "paste_right" | "drop",+ source: "cmd_v" | "dashboard_menu" | "drop",anchor?: DashboardPlacement,) => {if (parsed.status === "invalid") {@@ -535,10 +535,7 @@ export default function DashboardDetail() {// Menu-driven paste ("Paste widget" / "Paste to the right"): read the// clipboard and reject non-widget payloads visibly.const pasteWidgetFromClipboard = useCallback(- async (- source: "dashboard_menu" | "paste_right",- anchor?: DashboardPlacement,- ) => {+ async (source: "dashboard_menu", anchor?: DashboardPlacement) => {const text = await readTextFromClipboard();if (text === null) {showErrorToast(@@ -1399,13 +1396,6 @@ export default function DashboardDetail() {onDuplicatePreset={hasCUDAccess ? handleDuplicatePreset : undefined}- onPasteWidget={- hasCUDAccess- ? (anchor) => {- pasteWidgetFromClipboard("paste_right", anchor);- }- : undefined- }/></div>)}diff --git a/web/src/utils/chatml/README.md b/web/src/utils/chatml/README.mdindex af1006c427..f08ea9d5bc 100644--- a/web/src/utils/chatml/README.md+++ b/web/src/utils/chatml/README.md@@ -6,8 +6,13 @@ In general, provider adapters preprocess data β ChatMlSchema validates β UI## Usage### Display (IOPreview)+```typescript-import { normalizeInput, normalizeOutput, combineInputOutputMessages } from "@/src/utils/chatml";+import {+ normalizeInput,+ normalizeOutput,+ combineInputOutputMessages,+} from "@/src/utils/chatml";const ctx = { metadata, observationName };const inResult = normalizeInput(input, ctx);@@ -16,6 +21,7 @@ const allMessages = combineInputOutputMessages(inResult, outResult, output);```### Playground+```typescriptimport { normalizeInput } from "@/src/utils/chatml";import { convertChatMlToPlayground } from "@/src/utils/chatml/playgroundConverter";@@ -29,6 +35,7 @@ const playgroundMessages = inResult.success## Adding a Provider1. Create `adapters/yourprovider.ts`:+```typescriptexport const yourProviderAdapter: ProviderAdapter = {id: "yourprovider",