🪢 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
fix(web): detail tabs share one 16px inset and consistent section spacing (#18276)
Trang Nguyen9835e23b261e
diff --git a/web/src/components/design-system/table/columns/createIOTableColumn.stories.tsx b/web/src/components/design-system/table/columns/createIOTableColumn.stories.tsxindex f9cb53ec8b..39ffc06507 100644--- a/web/src/components/design-system/table/columns/createIOTableColumn.stories.tsx+++ b/web/src/components/design-system/table/columns/createIOTableColumn.stories.tsx@@ -305,11 +305,9 @@ export const TestLoadedCellBackgrounds = meta.story({const [inputCell, outputCell] = Array.from(row.cells);await expect(inputCell).toHaveClass("bg-muted/50");- await expect(outputCell).toHaveClass("bg-accent-light-green");+ await expect(outputCell).toHaveClass("bg-surface-output");await expect(inputCell?.querySelector('[class~="bg-muted/50"]')).toBeNull();- await expect(- outputCell?.querySelector(".bg-accent-light-green"),- ).toBeNull();+ await expect(outputCell?.querySelector(".bg-surface-output")).toBeNull();},});@@ -327,12 +325,12 @@ export const TestLoadingCellBackgrounds = meta.story({const [inputCell, outputCell] = Array.from(row.cells);await expect(inputCell).toHaveClass("bg-muted/50");- await expect(outputCell).toHaveClass("bg-accent-light-green");+ await expect(outputCell).toHaveClass("bg-surface-output");await expect(inputCell).toHaveClass("[&_[data-slot=skeleton]]:bg-muted-foreground/20",);await expect(outputCell).toHaveClass(- "[&_[data-slot=skeleton]]:bg-accent-dark-green/20",+ "[&_[data-slot=skeleton]]:bg-muted-foreground/20",);},});diff --git a/web/src/components/design-system/table/components/IOTableCell/IOTableCell.stories.tsx b/web/src/components/design-system/table/components/IOTableCell/IOTableCell.stories.tsxindex 2004405ca6..f538e0eab6 100644--- a/web/src/components/design-system/table/components/IOTableCell/IOTableCell.stories.tsx+++ b/web/src/components/design-system/table/components/IOTableCell/IOTableCell.stories.tsx@@ -140,7 +140,7 @@ export const TestOutputVariant = meta.story({},play: async ({ canvasElement }) => {await expect(- canvasElement.querySelector(".bg-accent-light-green"),+ canvasElement.querySelector(".bg-surface-output"),).toBeInTheDocument();},});diff --git a/web/src/components/design-system/table/components/IOTableCell/IOTableCell.tsx b/web/src/components/design-system/table/components/IOTableCell/IOTableCell.tsxindex 28cc670f90..9076b4452f 100644--- a/web/src/components/design-system/table/components/IOTableCell/IOTableCell.tsx+++ b/web/src/components/design-system/table/components/IOTableCell/IOTableCell.tsx@@ -35,7 +35,7 @@ export type IOTableCellMediaRenderer = (const ioTableCellVariantClassNames: Record<IOTableCellVariant, string> = {default: "",input: "bg-muted/50",- output: "bg-accent-light-green",+ output: "bg-surface-output",};const ioTableCellPaddingClassNames: Record<IOTableCellSize, string> = {diff --git a/web/src/components/table/DataTable.stories.tsx b/web/src/components/table/DataTable.stories.tsxindex 7114ffe95e..e87b3a16f8 100644--- a/web/src/components/table/DataTable.stories.tsx+++ b/web/src/components/table/DataTable.stories.tsx@@ -1509,6 +1509,6 @@ export const TestManualIOCellBackground = meta.story({if (!row) throw new globalThis.Error("Row not found");await expect(row.cells[inputIndex]).toHaveClass("bg-muted/50");- await expect(row.cells[outputIndex]).toHaveClass("bg-accent-light-green");+ await expect(row.cells[outputIndex]).toHaveClass("bg-surface-output");},});diff --git a/web/src/components/table/data-table.tsx b/web/src/components/table/data-table.tsxindex f69878bd6f..903ba08390 100644--- a/web/src/components/table/data-table.tsx+++ b/web/src/components/table/data-table.tsx@@ -219,8 +219,7 @@ const getCellPaddingClassName = (padding: DataTableCellPadding) => {const cellBackgroundClassNames = {gray: "bg-muted/50 [&_[data-slot=skeleton]]:bg-muted-foreground/20",- green:- "bg-accent-light-green [&_[data-slot=skeleton]]:bg-accent-dark-green/20",+ green: "bg-surface-output [&_[data-slot=skeleton]]:bg-muted-foreground/20",} satisfies Record<DataTableCellBackground, string>;const getCellBackgroundClassName = (background?: DataTableCellBackground) =>diff --git a/web/src/components/ui/CodeJsonViewer.tsx b/web/src/components/ui/CodeJsonViewer.tsxindex ed05e5f2f8..e7e007ee27 100644--- a/web/src/components/ui/CodeJsonViewer.tsx+++ b/web/src/components/ui/CodeJsonViewer.tsx@@ -101,7 +101,7 @@ export function JSONView(props: {"io-message-content ph-no-capture flex max-w-full min-w-0 gap-2 text-xs wrap-break-word whitespace-pre-wrap",props.borderless ? "" : "p-2",props.title === "assistant" || props.title === "Output"- ? "bg-accent-light-green dark:border-accent-dark-green/30"+ ? "bg-surface-output dark:border-border": "",props.scrollable || props.borderless || props.title? ""diff --git a/web/src/components/ui/MarkdownJsonView.tsx b/web/src/components/ui/MarkdownJsonView.tsxindex 388edf46c1..5c15e70021 100644--- a/web/src/components/ui/MarkdownJsonView.tsx+++ b/web/src/components/ui/MarkdownJsonView.tsx@@ -18,7 +18,6 @@ type MarkdownJsonViewHeaderProps = {titleIcon?: React.ReactNode;handleOnCopy: (event?: React.MouseEvent<HTMLButtonElement>) => void;controlButtons?: React.ReactNode;- inset?: boolean;/** Hosts that render their own copy control (e.g. inside the content box)suppress the header's. */hideCopyButton?: boolean;@@ -32,7 +31,6 @@ export function MarkdownJsonViewHeader({titleIcon,handleOnCopy,controlButtons,- inset = false,hideCopyButton = false,hoverRevealControls = false,}: MarkdownJsonViewHeaderProps) {@@ -46,12 +44,7 @@ export function MarkdownJsonViewHeader({);return (- <div- className={cn(- "io-message-header flex flex-row items-center justify-between py-1 text-sm font-bold capitalize",- inset ? "px-2" : "px-1",- )}- >+ <div className="io-message-header flex flex-row items-center justify-between px-1 py-1 text-base font-bold capitalize">{/* Masked from session recordings: the title can be a customer-providedmessage `name` (or tool name) rather than a fixed role string. */}<div className="ph-no-capture flex items-center gap-2">diff --git a/web/src/components/ui/MarkdownViewer.tsx b/web/src/components/ui/MarkdownViewer.tsxindex 56eb9495a4..ce71e42623 100644--- a/web/src/components/ui/MarkdownViewer.tsx+++ b/web/src/components/ui/MarkdownViewer.tsx@@ -344,7 +344,7 @@ const markdownComponents: NonNullable<Options["components"]> = {return <h4 className="text-base font-bold">{children}</h4>;},h5({ children }) {- return <h5 className="text-sm font-bold">{children}</h5>;+ return <h5 className="text-base font-bold">{children}</h5>;},h6({ children }) {return <h6 className="text-xs font-bold">{children}</h6>;@@ -411,13 +411,13 @@ function MarkdownRenderer({if (tooLargeOrDeep) {return (- <div className={cn("space-y-2 overflow-x-auto text-sm", className)}>+ <div className={cn("space-y-2 overflow-x-auto text-base", className)}><div className="text-muted-foreground flex items-center gap-1 text-xs"><Info className="h-3 w-3" />Content is too large or deeply nested to render as markdown.Displaying as plain text.</div>- <pre className="text-sm break-words whitespace-pre-wrap">+ <pre className="text-base break-words whitespace-pre-wrap">{markdown}</pre></div>@@ -431,7 +431,7 @@ function MarkdownRenderer({return (<divclassName={cn(- "space-y-2 overflow-x-auto text-sm wrap-break-word",+ "space-y-2 overflow-x-auto text-base wrap-break-word",className,)}>@@ -574,61 +574,70 @@ export function MarkdownView({{afterHeader}<divclassName={cn(- "io-message-content ph-no-capture text-foreground-secondary grid grid-flow-row gap-2 px-1 pt-1 pb-2",- title === "assistant" || title === "Output" || title === "Model"- ? "bg-accent-light-green overflow-hidden rounded-md"- : "",+ "io-message-content ph-no-capture text-foreground-secondary px-1 pt-1 pb-2",className,)}>- {typeof markdown === "string" ? (- // plain string- inlineMediaReferenceStrings.length > 0 ? (- inlineMediaReferenceStrings.map((referenceString, index) => (- <LangfuseMediaView- key={`${referenceString}-${index}`}- mediaReferenceString={referenceString}- />- ))+ <div+ className={cn(+ "grid grid-flow-row gap-2",+ (title === "assistant" ||+ title === "Output" ||+ title === "Model") &&+ "bg-surface-output overflow-hidden rounded-md px-3 py-2",+ )}+ >+ {typeof markdown === "string" ? (+ // plain string+ inlineMediaReferenceStrings.length > 0 ? (+ inlineMediaReferenceStrings.map((referenceString, index) => (+ <LangfuseMediaView+ key={`${referenceString}-${index}`}+ mediaReferenceString={referenceString}+ />+ ))+ ) : (+ <>+ <MarkdownRenderer+ markdown={isCollapsed ? truncatedContent : markdown}+ />+ {collapseToggle}+ </>+ )) : (+ // content parts (multi-modal); collapsing hides long TEXT only —+ // attachments are not text, so media parts render either way. That+ // also keeps the shared media strip's dedup honest: it assumes any+ // inline-renderable media did render (LFE-14815).+ <>+ {isCollapsed ? (+ <>+ <MarkdownRenderer markdown={truncatedContent} />+ {(markdown ?? []).map((content, index) =>+ isOpenAITextContentPart(content)+ ? null+ : renderContentPart(content, index),+ )}+ </>+ ) : (+ (markdown ?? []).map(renderContentPart)+ )}+ {collapseToggle}+ </>+ )}+ {audio ? (<><MarkdownRenderer- markdown={isCollapsed ? truncatedContent : markdown}+ markdown={+ audio.transcript ? "[Audio] \n" + audio.transcript : ""+ }+ />+ <LangfuseMediaView+ mediaReferenceString={audio.data.referenceString}/>- {collapseToggle}</>- )- ) : (- // content parts (multi-modal); collapsing hides long TEXT only —- // attachments are not text, so media parts render either way. That- // also keeps the shared media strip's dedup honest: it assumes any- // inline-renderable media did render (LFE-14815).- <>- {isCollapsed ? (- <>- <MarkdownRenderer markdown={truncatedContent} />- {(markdown ?? []).map((content, index) =>- isOpenAITextContentPart(content)- ? null- : renderContentPart(content, index),- )}- </>- ) : (- (markdown ?? []).map(renderContentPart)- )}- {collapseToggle}- </>- )}- {audio ? (- <>- <MarkdownRenderer- markdown={audio.transcript ? "[Audio] \n" + audio.transcript : ""}- />- <LangfuseMediaView- mediaReferenceString={audio.data.referenceString}- />- </>- ) : null}+ ) : null}+ </div></div>{remainingMedia.length > 0 && (<>diff --git a/web/src/components/ui/PrettyJsonView.tsx b/web/src/components/ui/PrettyJsonView.tsxindex f167365e3e..1ca77ba417 100644--- a/web/src/components/ui/PrettyJsonView.tsx+++ b/web/src/components/ui/PrettyJsonView.tsx@@ -92,7 +92,7 @@ const PRETTY_JSON_VIEW_TONE_CLASSES: Record<> = {danger: {container:- "border-dark-red/30 bg-light-red/50 dark:border-dark-red/20 dark:bg-light-red/35",+ "border-red-100 bg-red-50 text-red-900 dark:border-dark-red/20 dark:bg-light-red/35 dark:text-red-300",row: "hover:bg-light-red/50 dark:hover:bg-light-red/35",cell: "border-dark-red/20 dark:border-dark-red/15",},@@ -168,7 +168,7 @@ function getContainerClasses(const toned = ASSISTANT_TITLES.includes(title || "");return cn(baseClasses,- toned ? "bg-accent-light-green dark:border-accent-dark-green/30" : "",+ toned ? "bg-surface-output dark:border-border" : "",borderless? "rounded-md overflow-clip": scrollable@@ -483,7 +483,7 @@ function JsonPrettyTable({: null;return (- <div className="flex w-max max-w-[40cqw] min-w-40 items-start text-xs/5 wrap-break-word">+ <div className="flex w-max max-w-[40cqw] min-w-40 items-start gap-1 text-xs/5 wrap-break-word"><divclassName="flex h-[1lh] shrink-0 items-center justify-end"style={{ width: `${indentationWidth}px` }}@@ -740,7 +740,6 @@ export function PrettyJsonView(props: {stickyTopLevelKey?: boolean;showObservationTypeBadge?: boolean;tone?: PrettyJsonViewTone;- inset?: boolean;/** Content to render between header and main content (e.g., thinking blocks) */afterHeader?: React.ReactNode;/** When set, rows show an actions menu with copy + add-to-filter shortcuts@@ -1206,7 +1205,7 @@ export function PrettyJsonView(props: {const getBackgroundColorClass = () =>ASSISTANT_TITLES.includes(props.title || "")- ? "bg-accent-light-green rounded-md overflow-clip"+ ? "bg-surface-output rounded-md overflow-clip": "";const body = (@@ -1417,7 +1416,6 @@ export function PrettyJsonView(props: {className={cn("flex max-h-full min-h-0 flex-col","group/iosection",- props.inset && "[&_.io-message-content]:px-2",props.className,props.scrollable ? "overflow-hidden" : "",)}@@ -1427,7 +1425,6 @@ export function PrettyJsonView(props: {title={props.title}titleIcon={props.titleIcon}handleOnCopy={handleOnCopy}- inset={props.inset}hoverRevealControlscontrolButtons={<>diff --git a/web/src/features/traces/components/ChatMessageList.tsx b/web/src/features/traces/components/ChatMessageList.tsxindex c40efd7e9f..2f807c545c 100644--- a/web/src/features/traces/components/ChatMessageList.tsx+++ b/web/src/features/traces/components/ChatMessageList.tsx@@ -118,9 +118,9 @@ export function ChatMessageList({return (<div className="flex max-h-full min-h-0 flex-col gap-2"><div className="flex max-h-full min-h-0 flex-col gap-2">- <div className="flex flex-col gap-2">+ <div className="flex flex-col gap-3">{visibleMessages.map(({ message, originalIndex }) => (- <div className="flex flex-col gap-1" key={originalIndex}>+ <div className="flex flex-col" key={originalIndex}><ChatMessagemessage={message}shouldRenderMarkdown={shouldRenderMarkdown}@@ -136,7 +136,7 @@ export function ChatMessageList({variant="ghost"size="xs"onClick={() => setCollapsed((v) => !v)}- className="text-muted-foreground hover:text-foreground w-fit pl-2 underline hover:bg-transparent"+ className="text-muted-foreground hover:text-foreground mt-1 mb-2 w-fit px-0 underline hover:bg-transparent">{isCollapsed? `Show ${messagesToRender.length - COLLAPSE_THRESHOLD} more`diff --git a/web/src/features/traces/components/IOPreview/IOPreview.tsx b/web/src/features/traces/components/IOPreview/IOPreview.tsxindex b9f3d489c0..11c8a3265c 100644--- a/web/src/features/traces/components/IOPreview/IOPreview.tsx+++ b/web/src/features/traces/components/IOPreview/IOPreview.tsx@@ -314,7 +314,7 @@ export function IOPreview({{showEmptyState && (<div className="py-2">- <div className="relative mx-2 flex flex-col items-start gap-2 rounded-lg border border-dashed p-4">+ <div className="relative flex flex-col items-start gap-2 rounded-lg border border-dashed p-4"><Buttonvariant="ghost"size="sm"@@ -337,11 +337,11 @@ export function IOPreview({<div className="bg-accent flex h-8 w-8 items-center justify-center rounded-full"><BookOpen className="text-muted-foreground h-4 w-4" /></div>- <h3 className="text-sm font-bold">+ <h3 className="text-base font-bold">Looks like this trace didn't receive an input or output.</h3></div>- <p className="text-muted-foreground max-w-sm text-sm">+ <p className="text-muted-foreground max-w-sm text-base">Add it in your code to make debugging a lot easier.</p><ActionButtondiff --git a/web/src/features/traces/components/IOPreview/IOPreviewJSON.tsx b/web/src/features/traces/components/IOPreview/IOPreviewJSON.tsxindex 35ee1d20e0..0197001d16 100644--- a/web/src/features/traces/components/IOPreview/IOPreviewJSON.tsx+++ b/web/src/features/traces/components/IOPreview/IOPreviewJSON.tsx@@ -165,7 +165,7 @@ function IOPreviewJSONInner({const { inputBgColor, outputBgColor, metadataBgColor } = useMemo(() => ({inputBgColor: isDark ? "rgb(15, 23, 42)" : "rgb(249, 252, 255)", // Dark slate vs light blue- outputBgColor: isDark ? "rgb(20, 30, 41)" : "rgb(248, 253, 250)", // Dark blue-gray vs light green+ outputBgColor: "hsl(var(--surface-output))",metadataBgColor: isDark ? "rgb(30, 20, 40)" : "rgb(253, 251, 254)", // Dark purple vs light purple}),[isDark],@@ -620,7 +620,7 @@ function IOPreviewJSONInner({return (<div className="flex min-h-0 flex-1 flex-col border-t border-b"><div className="flex h-full items-center justify-center">- <div className="text-muted-foreground text-sm">Parsing data...</div>+ <div className="text-muted-foreground text-base">Parsing data...</div></div></div>);@@ -768,7 +768,7 @@ function IOPreviewJSONInner({</HoverCardTrigger><HoverCardContent className="w-80" side="bottom" align="end"><div className="space-y-2">- <p className="text-sm font-bold">Virtualized View</p>+ <p className="text-base font-bold">Virtualized View</p><p className="text-muted-foreground text-xs">This view is using virtualization due to a large number ofkeys ({rowCounts.input.toLocaleString()} input,{" "}diff --git a/web/src/features/traces/components/IOPreview/IOPreviewJSONSimple.tsx b/web/src/features/traces/components/IOPreview/IOPreviewJSONSimple.tsxindex f3e84b7ed9..023315daed 100644--- a/web/src/features/traces/components/IOPreview/IOPreviewJSONSimple.tsx+++ b/web/src/features/traces/components/IOPreview/IOPreviewJSONSimple.tsx@@ -10,6 +10,8 @@ import {} from "./fns/jsonViewSizeGate";import { StatusMessageSection } from "./components/StatusMessageSection";import type { ObservationStatusMessage } from "./components/statusMessagePresentation";+import { IO_SECTIONS_FLUSH_CLASS } from "../../constants/ioSectionClasses";+import { cn } from "@/src/utils/tailwind";export interface IOPreviewJSONSimpleProps {input?: Prisma.JsonValue;@@ -135,7 +137,7 @@ export function IOPreviewJSONSimple({const downloadName = observationId ?? traceId;return (- <div className="[&_.io-message-content]:px-2 [&_.io-message-header]:px-2">+ <div className={cn("pt-3", IO_SECTIONS_FLUSH_CLASS)}>{status ? (<StatusMessageSection status={status} currentView="json" />) : null}diff --git a/web/src/features/traces/components/IOPreview/IOPreviewPretty.tsx b/web/src/features/traces/components/IOPreview/IOPreviewPretty.tsxindex 54c4e70af9..62c4d08680 100644--- a/web/src/features/traces/components/IOPreview/IOPreviewPretty.tsx+++ b/web/src/features/traces/components/IOPreview/IOPreviewPretty.tsx@@ -1,5 +1,6 @@/* eslint-disable no-nested-ternary */import { useMemo } from "react";+import { cn } from "@/src/utils/tailwind";import { type Prisma, type ScoreDomain, deepParseJson } from "@langfuse/shared";import { PrettyJsonView } from "@/src/components/ui/PrettyJsonView";import { type MetadataFilterActions } from "@/src/components/table/ValueCell";@@ -19,6 +20,7 @@ import {import { CorrectedOutputField } from "./components/CorrectedOutputField";import { StatusMessageSection } from "./components/StatusMessageSection";import type { ObservationStatusMessage } from "./components/statusMessagePresentation";+import { IO_SECTIONS_FLUSH_CLASS } from "../../constants/ioSectionClasses";interface JsonInputOutputViewProps {parsedInput: unknown;@@ -57,7 +59,7 @@ function JsonInputOutputView({const showOutput = !hideOutput && !(hideIfNull && !parsedOutput);return (- <div className="space-y-2 [&_.io-message-content]:px-2 [&_.io-message-header]:px-2">+ <div className="space-y-2">{showInput && (<PrettyJsonViewtitle="Input"@@ -273,7 +275,7 @@ export function IOPreviewPretty({const shouldRenderMessages = hasRenderableChatMessages(parserResult);return (- <div className="space-y-2 pt-1">+ <div className={cn("space-y-3 pt-3", IO_SECTIONS_FLUSH_CLASS)}>{showData && status ? (<StatusMessageSection status={status} currentView="pretty" />) : null}@@ -288,7 +290,7 @@ export function IOPreviewPretty({) : null}{shouldRenderMessages ? (- <div className="[&_.io-message-content]:px-2 [&_.io-message-header]:px-2">+ <div><ChatMessageListmessages={allMessages}shouldRenderMarkdown={shouldRenderMarkdown}@@ -314,36 +316,32 @@ export function IOPreviewPretty({) : showData ? (<div><JsonInputOutputView {...jsonViewProps} />- <div className="[&_.io-message-content]:px-2 [&_.io-message-header]:px-2">- {showCorrections && (- <CorrectedOutputField- actualOutput={parsedOutput}- existingCorrection={outputCorrection}- observationId={observationId}- projectId={projectId}- traceId={traceId}- environment={environment}- />- )}- </div>+ {showCorrections && (+ <CorrectedOutputField+ actualOutput={parsedOutput}+ existingCorrection={outputCorrection}+ observationId={observationId}+ projectId={projectId}+ traceId={traceId}+ environment={environment}+ />+ )}</div>) : null}{/* Metadata Section */}{showData && shouldShowMetadata && (- <div className="[&_.io-message-content]:px-2 [&_.io-message-header]:px-2">- <PrettyJsonView- title="Metadata"- json={parsedMetadata}- isLoading={isLoading}- isParsing={isParsing}- media={media?.filter((m) => m.field === "metadata") ?? []}- currentView="pretty"- externalExpansionState={metadataExpansionState}- onExternalExpansionChange={onMetadataExpansionChange}- metadataActions={metadataActions}- />- </div>+ <PrettyJsonView+ title="Metadata"+ json={parsedMetadata}+ isLoading={isLoading}+ isParsing={isParsing}+ media={media?.filter((m) => m.field === "metadata") ?? []}+ currentView="pretty"+ externalExpansionState={metadataExpansionState}+ onExternalExpansionChange={onMetadataExpansionChange}+ metadataActions={metadataActions}+ />)}</div>);diff --git a/web/src/features/traces/components/IOPreview/components/ChatMessage.tsx b/web/src/features/traces/components/IOPreview/components/ChatMessage.tsxindex d74401a0d0..d9be9bc970 100644--- a/web/src/features/traces/components/IOPreview/components/ChatMessage.tsx+++ b/web/src/features/traces/components/IOPreview/components/ChatMessage.tsx@@ -142,9 +142,10 @@ export function ChatMessage({toolCalls.length > 0) {return (- <div className="transition-colors">+ <div className="group/iosection transition-colors"><MarkdownJsonViewHeadertitle={title}+ hoverRevealControlshandleOnCopy={() => {// Shared stringify (not raw JSON.stringify) so \uXXXX escapes in// string fields are copied as real characters, like the rendereddiff --git a/web/src/features/traces/components/IOPreview/components/CorrectedOutputField.tsx b/web/src/features/traces/components/IOPreview/components/CorrectedOutputField.tsxindex ee7ec9dff0..ea4736bd0a 100644--- a/web/src/features/traces/components/IOPreview/components/CorrectedOutputField.tsx+++ b/web/src/features/traces/components/IOPreview/components/CorrectedOutputField.tsx@@ -164,7 +164,7 @@ export function CorrectedOutputField({if (!isExpanded && !effectiveCorrection) {return (- <div className="px-2 py-2">+ <div className="py-2"><buttontype="button"onClick={() => {@@ -193,15 +193,12 @@ export function CorrectedOutputField({correctedOutput={value}strictJsonMode={strictJsonMode}/>- <div className="px-2">+ <div className="pt-3"><div className="group relative rounded-md"><div className="flex items-center justify-between py-1.5"><div className="flex items-center gap-1"><span- className={cn(- "text-sm font-bold",- compact ? "text-xs" : "text-sm",- )}+ className={cn("font-bold", compact ? "text-xs" : "text-base")}>{compact ? "" : "Corrected Output"}</span>@@ -228,7 +225,7 @@ export function CorrectedOutputField({</HoverCardContent></HoverCard></div>- <div className="-mr-1 flex items-center">+ <div className="flex items-center"><div className="flex items-center -space-x-1 opacity-0 transition-opacity group-hover:opacity-100">{!isValidJson && isEditing && hasContent && (<span className="mr-2 text-xs text-red-500">@@ -316,15 +313,13 @@ export function CorrectedOutputField({mode={strictJsonMode ? "json" : "text"}minHeight={200}placeholder="Enter corrected output..."- className="bg-accent-light-green"/>) : (<CodeMirrorEditorvalue={displayValue}mode={strictJsonMode ? "json" : "text"}- minHeight={200}editable={false}- className="bg-accent-light-green"+ className="bg-surface-output [&_.cm-gutters]:bg-transparent! [&_.cm-scroller]:bg-transparent!"/>)}</div>diff --git a/web/src/features/traces/components/IOPreview/components/SectionMedia.tsx b/web/src/features/traces/components/IOPreview/components/SectionMedia.tsxindex 47bf2d1e72..dded12a424 100644--- a/web/src/features/traces/components/IOPreview/components/SectionMedia.tsx+++ b/web/src/features/traces/components/IOPreview/components/SectionMedia.tsx@@ -12,8 +12,8 @@ export interface SectionMediaProps {export function SectionMedia({ media }: SectionMediaProps) {return (<>- <div className="text-muted-foreground my-1 px-2 py-1 text-xs">Media</div>- <div className="ph-no-capture flex flex-wrap gap-2 px-2 pt-1 pb-4">+ <div className="text-muted-foreground my-1 py-1 text-xs">Media</div>+ <div className="ph-no-capture flex flex-wrap gap-2 pt-1 pb-4">{media.map((m) => (<LangfuseMediaViewmediaAPIReturnValue={m}diff --git a/web/src/features/traces/components/IOPreview/components/SectionToolDefinitions.tsx b/web/src/features/traces/components/IOPreview/components/SectionToolDefinitions.tsxindex 02bf9de71f..717504c3b0 100644--- a/web/src/features/traces/components/IOPreview/components/SectionToolDefinitions.tsx+++ b/web/src/features/traces/components/IOPreview/components/SectionToolDefinitions.tsx@@ -24,21 +24,18 @@ export function SectionToolDefinitions({toolNameToDefinitionNumber,}: SectionToolDefinitionsProps) {return (- <div className="[&_.io-message-content]:px-2 [&_.io-message-header]:px-2">- <div className="border-border mb-4 border-b pb-4">- <div className="io-message-header px-1 py-1 text-sm font-bold capitalize">- Tools- </div>- {tools.length > 0 && (- <ToolCallDefinitionCard- tools={tools}- toolCallCounts={toolCallCounts}- toolCallsByName={toolCallsByName}- toolNameToDefinitionNumber={toolNameToDefinitionNumber}- className="px-2"- />- )}+ <div className="border-border mb-4 border-b pb-4">+ <div className="io-message-header px-1 py-1 text-base font-bold capitalize">+ Tools</div>+ {tools.length > 0 && (+ <ToolCallDefinitionCard+ tools={tools}+ toolCallCounts={toolCallCounts}+ toolCallsByName={toolCallsByName}+ toolNameToDefinitionNumber={toolNameToDefinitionNumber}+ />+ )}</div>);}diff --git a/web/src/features/traces/components/IOPreview/components/StatusMessageSection.tsx b/web/src/features/traces/components/IOPreview/components/StatusMessageSection.tsxindex 915f588eb2..134a491890 100644--- a/web/src/features/traces/components/IOPreview/components/StatusMessageSection.tsx+++ b/web/src/features/traces/components/IOPreview/components/StatusMessageSection.tsx@@ -14,7 +14,7 @@ const STATUS_MESSAGE_CLASS_NAMES: Record<string> = {ERROR:- "border-dark-red/30 bg-light-red/50 dark:border-dark-red/20 dark:bg-light-red/35",+ "border-red-100 bg-red-50 text-red-900 dark:border-dark-red/20 dark:bg-light-red/35 dark:text-red-300",WARNING: "border-dark-yellow/40 bg-light-yellow/80",DEBUG: "border-muted-foreground/15 bg-muted/30 text-muted-foreground",DEFAULT: "bg-card",@@ -41,21 +41,20 @@ export function StatusMessageSection({parsedJson={parsedStatusMessage}currentView={currentView}tone={presentation.tone}- inset/>);}return (- <div>+ <div className="group/iosection"><MarkdownJsonViewHeadertitle={presentation.title}handleOnCopy={() => copyTextToClipboard(status.message)}- inset+ hoverRevealControls/><divclassName={cn(- "ph-no-capture mx-2 rounded-sm border px-2 py-2 text-xs wrap-break-word whitespace-pre-wrap",+ "ph-no-capture rounded-sm border p-3 text-base wrap-break-word whitespace-pre-wrap",STATUS_MESSAGE_CLASS_NAMES[status.level],)}>diff --git a/web/src/features/traces/components/ObservationDetailView/ConnectedObservationDetailView.tsx b/web/src/features/traces/components/ObservationDetailView/ConnectedObservationDetailView.tsxindex 89ea111019..60c31c11ce 100644--- a/web/src/features/traces/components/ObservationDetailView/ConnectedObservationDetailView.tsx+++ b/web/src/features/traces/components/ObservationDetailView/ConnectedObservationDetailView.tsx@@ -432,7 +432,7 @@ export function ConnectedObservationDetailView({selectedTab === "attributes" ||(selectedTab === "preview" && isPrettyViewAvailable)) && (<>- <div className="ml-auto h-fit shrink-0 px-2 py-0.5">+ <div className="ml-auto h-fit shrink-0 py-0.5 pr-4 pl-2"><Tabsvalue={selectedTab === "log" && isLogViewVirtualized@@ -519,7 +519,7 @@ export function ConnectedObservationDetailView({{selectedTab === "messages" && (<TabsBarContentvalue="messages"- className="mt-0 min-h-0 flex-1 overflow-auto"+ className="mt-0 min-h-0 flex-1 overflow-auto px-4"><TraceMessagesView /></TabsBarContent>diff --git a/web/src/features/traces/components/ObservationDetailView/ObservationAttributesTab.tsx b/web/src/features/traces/components/ObservationDetailView/ObservationAttributesTab.tsxindex ebab3e7526..f0f28751af 100644--- a/web/src/features/traces/components/ObservationDetailView/ObservationAttributesTab.tsx+++ b/web/src/features/traces/components/ObservationDetailView/ObservationAttributesTab.tsx@@ -3,6 +3,8 @@import { useMemo } from "react";import { PrettyJsonView } from "@/src/components/ui/PrettyJsonView";+import { cn } from "@/src/utils/tailwind";+import { IO_SECTIONS_FLUSH_CLASS } from "@/src/features/traces/constants/ioSectionClasses";import { type MetadataFilterActions } from "@/src/components/table/ValueCell";import { AttributeRowActions } from "./AttributeRowActions";import { LargeJsonFieldFallback } from "@/src/features/traces/components/IOPreview/components/LargeJsonFieldFallback";@@ -11,9 +13,6 @@ import {probeJsonField,} from "@/src/features/traces/components/IOPreview/fns/jsonViewSizeGate";-const SECTION_CLASS =- "[&_.io-message-content]:px-3 [&_.io-message-header]:px-3";-export function ObservationAttributesTab({attributes,attributesAnchorTime,@@ -48,37 +47,33 @@ export function ObservationAttributesTab({const metadataTooLarge = metadataProbe.size > JSON_VIEW_RENDER_CHAR_LIMIT;return (- <div className="flex min-h-0 w-full flex-1 flex-col overflow-auto pb-4">- <div className="space-y-2 pt-1">+ <div className="flex min-h-0 w-full flex-1 flex-col overflow-auto px-4 pb-4">+ <div className={cn("space-y-3 pt-3", IO_SECTIONS_FLUSH_CLASS)}>{hasAttributes ? (- <div className={SECTION_CLASS}>- <PrettyJsonView- title="Attributes"- json={attributes}- currentView={currentView}- rowActions={(row) => (- <AttributeRowActions- row={row}- projectId={projectId}- filterTarget="observations"- anchorTime={attributesAnchorTime}- analyticsTable="attributes"- />- )}- />- </div>+ <PrettyJsonView+ title="Attributes"+ json={attributes}+ currentView={currentView}+ rowActions={(row) => (+ <AttributeRowActions+ row={row}+ projectId={projectId}+ filterTarget="observations"+ anchorTime={attributesAnchorTime}+ analyticsTable="attributes"+ />+ )}+ />) : null}{modelParameters ? (- <div className={SECTION_CLASS}>- <PrettyJsonView- title="Model parameters"- json={modelParameters}- currentView={currentView}- />- </div>+ <PrettyJsonView+ title="Model parameters"+ json={modelParameters}+ currentView={currentView}+ />) : null}{hasMetadata ? (- <div className={SECTION_CLASS}>+ <div>{metadataTooLarge ? (<LargeJsonFieldFallbacktitle="Metadata"@@ -99,7 +94,7 @@ export function ObservationAttributesTab({</div>) : null}{!hasAttributes && !modelParameters && !hasMetadata ? (- <p className="text-muted-foreground px-3 text-sm">+ <p className="text-muted-foreground text-base">No attributes, model parameters or metadata on this observation.</p>) : null}diff --git a/web/src/features/traces/components/ObservationDetailView/ObservationPreview.tsx b/web/src/features/traces/components/ObservationDetailView/ObservationPreview.tsxindex f436a24628..2eaddf381c 100644--- a/web/src/features/traces/components/ObservationDetailView/ObservationPreview.tsx+++ b/web/src/features/traces/components/ObservationDetailView/ObservationPreview.tsx@@ -1,6 +1,7 @@import { useState, type ComponentProps, type Key } from "react";import { IOPreview } from "@/src/features/traces/components/IOPreview/IOPreview";+import { cn } from "@/src/utils/tailwind";export interface ObservationPreviewProps {currentView?: ComponentProps<typeof IOPreview>["currentView"];@@ -22,11 +23,14 @@ export function ObservationPreview({return (<div- className={`flex min-h-0 w-full flex-1 flex-col ${+ className={cn(+ "flex min-h-0 w-full flex-1 flex-col",currentView === "json-beta" && isJSONBetaVirtualized? "overflow-hidden"- : "overflow-auto pb-4"- }`}+ : "overflow-auto pb-4",+ // The JSON beta viewer runs edge to edge with its own toolbar.+ currentView !== "json-beta" && "px-4",+ )}><IOPreviewkey={previewKey}diff --git a/web/src/features/traces/components/ToolCallInvocationsView.tsx b/web/src/features/traces/components/ToolCallInvocationsView.tsxindex d9c923855d..06436509da 100644--- a/web/src/features/traces/components/ToolCallInvocationsView.tsx+++ b/web/src/features/traces/components/ToolCallInvocationsView.tsx@@ -48,9 +48,12 @@ export function ToolCallInvocationsView({}return (- <div className={cn("flex flex-col gap-2", className)}>+ <div className={cn("flex flex-col gap-1", className)}>{toolCalls.map((toolCall, index) => {const invocationNumber = toolCallNumbers?.[index];+ // Without a paired result the arguments are the whole card and need no label.+ const response = toolCall.response ?? undefined;+ const hasResponse = response !== undefined;// Parse arguments if they're a JSON stringlet parsedArguments = toolCall.arguments;if (typeof toolCall.arguments === "string") {@@ -66,11 +69,12 @@ export function ToolCallInvocationsView({<divkey={`${toolCall.id}-${index}`}className={cn(- "w-full border-t px-2 py-2",- (message.role === "assistant" ||+ "py-2",+ message.role === "assistant" ||message.name === "Output" ||- message.name === "Model") &&- "bg-accent-light-green",+ message.name === "Model"+ ? "bg-surface-output rounded-md px-3"+ : "w-full border-t",)}>{/* Card header */}@@ -78,7 +82,7 @@ export function ToolCallInvocationsView({{/* Left: Tool icon + number + name */}<div className="flex items-center gap-2"><Wrench className="text-muted-foreground h-3.5 w-3.5" />- <span className="text-foreground font-mono text-xs font-bold">+ <span className="text-foreground-secondary text-sm">{invocationNumber !== undefined && (<span className="mr-1">{invocationNumber}.</span>)}@@ -96,9 +100,11 @@ export function ToolCallInvocationsView({{/* Arguments view */}<div className="py-2 [&_.io-message-content]:px-0">- <div className="text-muted-foreground mb-1.5 text-xs font-bold">- Arguments- </div>+ {hasResponse && (+ <div className="text-muted-foreground mb-1.5 text-xs font-bold">+ Arguments+ </div>+ )}<PrettyJsonViewjson={parsedArguments}currentView="pretty"@@ -109,16 +115,16 @@ export function ToolCallInvocationsView({{/* Response view: paired tool result. Only the normalized-parserprojection sets `response`, so this section is beta-only bydata presence — legacy messages never carry the field. */}- {toolCall.response !== undefined && toolCall.response !== null && (+ {response && (<div className="py-2 [&_.io-message-content]:px-0"><div className="text-muted-foreground mb-1.5 text-xs font-bold">Response- {toolCall.response?.isError && (+ {response.isError && (<span className="text-dark-red ml-1">(error)</span>)}</div><PrettyJsonView- json={parseIfJsonString(toolCall.response.output)}+ json={parseIfJsonString(response.output)}currentView="pretty"codeClassName="text-xs"/>diff --git a/web/src/features/traces/components/TraceDetailView/TraceDetailView.tsx b/web/src/features/traces/components/TraceDetailView/TraceDetailView.tsxindex 33138ceb96..286b4e66f9 100644--- a/web/src/features/traces/components/TraceDetailView/TraceDetailView.tsx+++ b/web/src/features/traces/components/TraceDetailView/TraceDetailView.tsx@@ -13,6 +13,7 @@ import {import { Tabs } from "@/src/components/design-system/Tabs/Tabs";import { Switch } from "@/src/components/design-system/Switch/Switch";import { useCallback, useMemo, useState } from "react";+import { cn } from "@/src/utils/tailwind";import {CommentDrawerController,getCommentDrawerInitialStateFromUrl,@@ -334,7 +335,7 @@ export function TraceDetailView({(selectedTab === "log" ||(selectedTab === "preview" && isPrettyViewAvailable)) && (<>- <div className="ml-auto h-fit shrink-0 px-2 py-0.5">+ <div className="ml-auto h-fit shrink-0 py-0.5 pr-4 pl-2"><Tabsvalue={selectedTab === "log" && isLogViewVirtualized@@ -421,7 +422,7 @@ export function TraceDetailView({{selectedTab === "messages" && (<TabsBarContentvalue="messages"- className="mt-0 min-h-0 flex-1 overflow-auto"+ className="mt-0 min-h-0 flex-1 overflow-auto px-4"><TraceMessagesView /></TabsBarContent>@@ -433,14 +434,17 @@ export function TraceDetailView({className="mt-0 flex max-h-full min-h-0 w-full flex-1"><div- className={`flex min-h-0 w-full flex-1 flex-col ${+ className={cn(+ "flex min-h-0 w-full flex-1 flex-col",currentView === "json-beta" && isJSONBetaVirtualized? "overflow-hidden"- : "overflow-auto pb-4"- }`}+ : "overflow-auto pb-4",+ // The JSON beta viewer runs edge to edge with its own toolbar.+ currentView !== "json-beta" && "px-4",+ )}>{isAnnotationMode && trace.tags.length > 0 && (- <div className="space-y-1 px-2 pt-1 pb-2">+ <div className="space-y-1 pt-1 pb-2"><div className="text-sm font-bold">Tags</div><TagList selectedTags={trace.tags} isLoading={false} /></div>diff --git a/web/src/features/traces/components/TraceMessagesView/TraceMessagesView.tsx b/web/src/features/traces/components/TraceMessagesView/TraceMessagesView.tsxindex 2a8018b824..6fabea4375 100644--- a/web/src/features/traces/components/TraceMessagesView/TraceMessagesView.tsx+++ b/web/src/features/traces/components/TraceMessagesView/TraceMessagesView.tsx@@ -18,6 +18,7 @@ import { ChatMessageList } from "@/src/features/traces/components/ChatMessageLisimport { useSelection } from "@/src/features/traces/contexts/SelectionContext";import { useTraceData } from "@/src/features/traces/contexts/TraceDataContext";import { toIOPreview } from "@/src/features/traces/parsers/toIOPreview";+import { IO_SECTIONS_FLUSH_CLASS } from "@/src/features/traces/constants/ioSectionClasses";import { useDesktopLayoutContextOptional } from "../TraceLayoutDesktop";type Transcript = NonNullable<@@ -61,7 +62,7 @@ export function TraceMessagesView() {const { threads } = data.transcript;return (- <div className="flex h-full w-full flex-col gap-6 overflow-y-auto p-3">+ <div className="flex h-full w-full flex-col gap-6 overflow-y-auto py-3">{data.cutoff && <CutoffNotice />}{threads.map((thread, index) => (<ErrorBoundary@@ -184,7 +185,7 @@ function MessageList({);return (- <div className="[&_.io-message-content]:px-2 [&_.io-message-header]:px-2">+ <div className={IO_SECTIONS_FLUSH_CLASS}><ChatMessageListmessages={preview.allMessages}shouldRenderMarkdown={shouldRenderMarkdown}@@ -219,7 +220,7 @@ function CutoffNotice() {function Notice({ children }: { children: React.ReactNode }) {return (- <div className="text-muted-foreground m-3 rounded-md border border-dashed p-3 text-sm">+ <div className="text-muted-foreground my-3 rounded-md border border-dashed p-3 text-sm">{children}</div>);diff --git a/web/src/features/traces/constants/ioSectionClasses.ts b/web/src/features/traces/constants/ioSectionClasses.tsnew file mode 100644index 0000000000..f470f297b5--- /dev/null+++ b/web/src/features/traces/constants/ioSectionClasses.ts@@ -0,0 +1,3 @@+/** IO sections render flush; the hosting panel owns the horizontal inset. */+export const IO_SECTIONS_FLUSH_CLASS =+ "[&_.io-message-content]:px-0 [&_.io-message-header]:px-0";