From a332291310036eae97246617f1e2cb1126b00c03 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vega Date: Mon, 15 Jun 2026 22:01:26 +0200 Subject: [PATCH 1/3] feat(frontend): collapse playground tool spec cards by default Tool spec cards rendered expanded and, when collapsed, still showed a 3-line JSON peek. Default them to collapsed and size the collapsed height to the header only (title + optional description), so no JSON shows until expanded. Collapsed height is dynamic since not every tool has a description. --- .../SchemaControls/PromptSchemaControl.tsx | 4 +- .../SchemaControls/ToolItemControl.tsx | 138 ++++++++---------- .../components/ChatMessageList.tsx | 100 +++++++------ 3 files changed, 121 insertions(+), 121 deletions(-) diff --git a/web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/PromptSchemaControl.tsx b/web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/PromptSchemaControl.tsx index e93a523e70..130f580648 100644 --- a/web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/PromptSchemaControl.tsx +++ b/web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/PromptSchemaControl.tsx @@ -494,7 +494,7 @@ export const PromptSchemaControl = memo(function PromptSchemaControl({ } return ( -
+
{/* Messages list */} {toolControl} diff --git a/web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/ToolItemControl.tsx b/web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/ToolItemControl.tsx index 205bb21c85..7d1e3f4b3c 100644 --- a/web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/ToolItemControl.tsx +++ b/web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/ToolItemControl.tsx @@ -19,7 +19,7 @@ import {memo, useCallback, useEffect, useMemo, useRef, useState} from "react" import {safeStringify} from "@agenta/shared/utils" -import {CollapseToggleButton, getCollapseStyle} from "@agenta/ui/components/presentational" +import {CollapseToggleButton} from "@agenta/ui/components/presentational" import {useDrillInUI} from "@agenta/ui/drill-in" import {getProviderIcon} from "@agenta/ui/select-llm-provider" import {CopySimple, MinusCircle} from "@phosphor-icons/react" @@ -256,7 +256,6 @@ interface ToolHeaderProps { builtinToolLabel?: string builtinIcon?: React.ReactNode gatewayHeader?: React.ReactNode - containerRef?: React.RefObject } function GatewayToolHeaderIdentity({ @@ -344,11 +343,10 @@ const ToolHeader = memo(function ToolHeader({ builtinToolLabel, builtinIcon, gatewayHeader, - containerRef, }: ToolHeaderProps) { return (
-
+
{gatewayHeader ? ( gatewayHeader ) : isBuiltinTool ? ( @@ -391,31 +389,33 @@ const ToolHeader = memo(function ToolHeader({ )}
-
- {!isReadOnly && onDuplicate && ( - -
@@ -467,16 +467,8 @@ export const ToolItemControl = memo(function ToolItemControl({ const effectiveRenderProviderIcon = renderProviderIcon ?? defaultRenderProviderIcon const isReadOnly = disabled - const [minimized, setMinimized] = useState(() => { - if (value && typeof value === "object" && !Array.isArray(value)) { - const obj = value as Record - if (obj.agenta_metadata && typeof obj.agenta_metadata === "object") { - const meta = obj.agenta_metadata as Record - return meta.source === "gateway" || meta.source === "builtin" - } - } - return false - }) + // Default collapsed: tool cards open to just their title + description. + const [minimized, setMinimized] = useState(true) const containerRef = useRef(null) // Strip agenta_metadata if present (re-attach on change) @@ -652,7 +644,6 @@ export const ToolItemControl = memo(function ToolItemControl({ builtinToolLabel={toolLabel} builtinIcon={providerIcon} gatewayHeader={gatewayHeader} - containerRef={containerRef} /> {!minimized && (