mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-20 15:02:02 +00:00
🎨 style: Quiet Failed Tool Activity (#16949)
* style: Reduce noise in failed tool activity * fix: Keep thought previews inside visible reasoning rows * style: Sort activity phase imports * style: Unify system events with tool disclosures * fix: Preserve system footer alignment and partial summaries * fix: Preserve partial phases without surviving tool outcomes * fix: Honor partial markers over surviving failed rows * fix: Retain partial status when failed outcomes are missing * fix: Preserve partial status in sparse tool groups * fix: Preserve failed batch markers without tool rows * fix: Exclude system events from assistant code shortcuts * fix: Identify system events in message navigation * test: Align bash failure mock with specific verdict labels
This commit is contained in:
parent
b2bcbf9380
commit
8b46f3b3e1
31 changed files with 516 additions and 189 deletions
|
|
@ -2,7 +2,7 @@ import { memo, useId, useCallback, useEffect, useMemo, useRef, useState, useCont
|
|||
import { useAtomValue } from 'jotai';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { ContentTypes } from 'librechat-data-provider';
|
||||
import { Check, Lightbulb, ChevronDown, TriangleAlert } from 'lucide-react';
|
||||
import { Check, CircleX, Lightbulb, ChevronDown, TriangleAlert } from 'lucide-react';
|
||||
import type { TAttachment, TMessageContentParts } from 'librechat-data-provider';
|
||||
import type { CSSProperties, ReactNode } from 'react';
|
||||
import type { RailHover } from './rail';
|
||||
|
|
@ -30,12 +30,11 @@ import {
|
|||
} from './rail';
|
||||
import { FailedRevealContext, FailedRevealPill, useFailedRevealTrigger } from './reveal';
|
||||
import { FOLD_RAIL_CLASSES, ROW_GLYPH_SLOT, TOOL_ROW_CLASSES } from './rows';
|
||||
import { getOutcomeStatus, isSpanFailed, summarizeSpan } from './outcome';
|
||||
import useSmoothStreaming from '~/hooks/Messages/useSmoothStreaming';
|
||||
import useThrottledValue from '~/hooks/Messages/useThrottledValue';
|
||||
import { AttachmentGroup, StreamingThoughtPeek } from './Parts';
|
||||
import { useMCPIconMap, useMCPServerNames } from '~/hooks/MCP';
|
||||
import { getActivityLabelText } from '~/utils/activityLabels';
|
||||
import { getOutcomeStatus, summarizeSpan } from './outcome';
|
||||
import { MCPAppViews } from '~/components/MCPUIResource';
|
||||
import { sandboxStartingByToolCallId } from '~/store';
|
||||
import { MessageSurfaceContext } from '../ui/surface';
|
||||
|
|
@ -45,6 +44,7 @@ import { StackedToolIcons } from './ToolOutput';
|
|||
import useTimeTick from '~/hooks/useTimeTick';
|
||||
import { getSourceDomains } from './sources';
|
||||
import { mapAttachments } from '~/utils/map';
|
||||
import { AttachmentGroup } from './Parts';
|
||||
import SearchVerticals from './verticals';
|
||||
|
||||
/** Matches `EXPAND_TRANSITION` so the panel and the label ticker resolve on
|
||||
|
|
@ -92,13 +92,18 @@ function schedulePostPaint(callback: () => void): () => void {
|
|||
* rendered without one sits to the left of the rows it replaces — the fold
|
||||
* then moves its own text sideways at the moment the reader is trying to
|
||||
* follow it. */
|
||||
function PhaseGlyph({ failed }: { failed: boolean }) {
|
||||
const Icon = failed ? TriangleAlert : Check;
|
||||
function PhaseGlyph({ failed, partial = false }: { failed: boolean; partial?: boolean }) {
|
||||
let Icon = Check;
|
||||
let tone = 'text-text-secondary';
|
||||
if (failed) {
|
||||
Icon = CircleX;
|
||||
tone = 'text-status-error';
|
||||
} else if (partial) {
|
||||
Icon = TriangleAlert;
|
||||
tone = 'text-status-warning';
|
||||
}
|
||||
return (
|
||||
<span
|
||||
className={cn(ROW_GLYPH_SLOT, failed ? 'text-text-warning' : 'text-text-secondary')}
|
||||
aria-hidden="true"
|
||||
>
|
||||
<span className={cn(ROW_GLYPH_SLOT, tone)} aria-hidden="true">
|
||||
<Icon size={14} />
|
||||
</span>
|
||||
);
|
||||
|
|
@ -127,7 +132,6 @@ function LiveLine({ text }: { text: string }) {
|
|||
const PhaseLabel = memo(function PhaseLabel({
|
||||
text,
|
||||
animate,
|
||||
failed,
|
||||
source,
|
||||
live = false,
|
||||
grow = true,
|
||||
|
|
@ -135,10 +139,9 @@ const PhaseLabel = memo(function PhaseLabel({
|
|||
}: {
|
||||
text: string;
|
||||
animate: boolean;
|
||||
failed: boolean;
|
||||
/** Identity of what produced `text`. A streamed sentence keeps its source
|
||||
* while it grows, and sliding a line out to bring a longer copy of itself
|
||||
* in would read as flicker — so an unchanged source extends in place. */
|
||||
* in would read as flicker, so an unchanged source extends in place. */
|
||||
source?: string;
|
||||
live?: boolean;
|
||||
/** Claim the row's free space, the default. Cleared when something has to
|
||||
|
|
@ -194,7 +197,6 @@ const PhaseLabel = memo(function PhaseLabel({
|
|||
'absolute inset-x-0 top-0 block truncate',
|
||||
'animate-out fade-out-0 slide-out-to-top-5 [animation-fill-mode:forwards]',
|
||||
FOLD_EASING,
|
||||
failed && 'text-text-warning',
|
||||
)}
|
||||
/** The sweep on the inner span loops forever and its `animationend`
|
||||
* never comes; only this element's own slide may clear the line. */
|
||||
|
|
@ -212,7 +214,6 @@ const PhaseLabel = memo(function PhaseLabel({
|
|||
className={cn(
|
||||
'block truncate',
|
||||
lines.entered && `animate-in fade-in-0 slide-in-from-bottom-5 ${FOLD_EASING}`,
|
||||
failed && 'text-text-warning',
|
||||
)}
|
||||
>
|
||||
{live ? <LiveLine text={lines.current} /> : lines.current}
|
||||
|
|
@ -229,10 +230,11 @@ const SPAN_SITES = 3;
|
|||
/**
|
||||
* The settled header's glyph: what the span USED, not a bare check. A header
|
||||
* stands for the rows it hides, so it carries the most specific glyphs they
|
||||
* show — tool and MCP server icons, and the sites a web search read — and the
|
||||
* show (tool and MCP server icons, and the sites a web search read), and the
|
||||
* row keeps the icons it had while live instead of trading them for a tick.
|
||||
* Its own component so only a card that was handed its parts pays for the MCP
|
||||
* lookup. A failed phase keeps the warning glyph: status outranks identity.
|
||||
* lookup. A phase whose every call failed shows the failure glyph instead:
|
||||
* status outranks identity only when nothing in the span succeeded.
|
||||
*/
|
||||
function SpanGlyph({
|
||||
parts,
|
||||
|
|
@ -388,7 +390,7 @@ function LivePhaseHeader({
|
|||
mcpIconMap={mcpIconMap}
|
||||
maxIcons={SPAN_ICONS}
|
||||
sourceDomains={sourceDomains}
|
||||
status={getOutcomeStatus(activity.outcome)}
|
||||
status={getOutcomeStatus({ ...activity.outcome, total: activity.total })}
|
||||
isAnimating
|
||||
/>
|
||||
</span>
|
||||
|
|
@ -405,7 +407,6 @@ function LivePhaseHeader({
|
|||
<PhaseLabel
|
||||
text={painted.text}
|
||||
source={painted.source}
|
||||
failed={false}
|
||||
animate={animate}
|
||||
live
|
||||
grow={combo === ''}
|
||||
|
|
@ -479,11 +480,13 @@ function FailedPeek({
|
|||
parts,
|
||||
attachmentsById,
|
||||
count,
|
||||
total,
|
||||
onReveal,
|
||||
}: {
|
||||
parts: ReadonlyArray<TMessageContentParts | undefined>;
|
||||
attachmentsById: Record<string, TAttachment[] | undefined>;
|
||||
count: number;
|
||||
total: number;
|
||||
onReveal: () => void;
|
||||
}) {
|
||||
const localize = useLocalize();
|
||||
|
|
@ -506,10 +509,15 @@ function FailedPeek({
|
|||
data-testid="activity-phase-failed-peek"
|
||||
>
|
||||
<span className={cn(ROW_GLYPH_SLOT, 'text-status-error')} aria-hidden="true">
|
||||
<TriangleAlert size={14} />
|
||||
<CircleX size={14} />
|
||||
</span>
|
||||
<span className="tool-status-text flex min-w-0 items-center gap-2">
|
||||
<span className="text-status-error max-w-full min-w-0 shrink-0 truncate font-medium">
|
||||
<span
|
||||
className={cn(
|
||||
'max-w-full min-w-0 shrink-0 truncate',
|
||||
isSpanFailed(count, total) ? 'text-status-error font-medium' : 'text-text-primary',
|
||||
)}
|
||||
>
|
||||
{first.text}
|
||||
</span>
|
||||
{first.detail !== '' && (
|
||||
|
|
@ -565,7 +573,10 @@ export default function ActivityPhaseGroup({
|
|||
const messageSurface = useContext(MessageSurfaceContext);
|
||||
const isLive = liveParts != null;
|
||||
const label = getActivityLabelText(labelPart);
|
||||
const hasFailure = labelPart.status === 'failed' || labelPart.status === 'partial';
|
||||
/** Only a phase in which every call failed reads as failed in its header.
|
||||
* A partial phase contains a mixture of outcomes; the count beside it and the failed
|
||||
* rows inside say what went wrong without restyling the title. */
|
||||
const allFailed = labelPart.status === 'failed';
|
||||
const outcomeParts = spanParts ?? liveParts;
|
||||
const attachmentsById = useMemo(() => mapAttachments(attachments ?? []), [attachments]);
|
||||
/** The span's failed calls, for the peek under a collapsed header and the
|
||||
|
|
@ -577,6 +588,10 @@ export default function ActivityPhaseGroup({
|
|||
[outcomeParts, attachmentsById],
|
||||
);
|
||||
|
||||
const partialMarkerFallback =
|
||||
labelPart.status === 'partial' &&
|
||||
(!hasContent || failedCount === 0 || isSpanFailed(failedCount, toolCount));
|
||||
|
||||
/** Already `smoothStreaming && !reducedMotion` — it owns the media query, so
|
||||
* a second subscription here would install one `matchMedia` listener per
|
||||
* phase card without changing the answer. */
|
||||
|
|
@ -717,6 +732,7 @@ export default function ActivityPhaseGroup({
|
|||
parts={outcomeParts}
|
||||
attachmentsById={attachmentsById}
|
||||
count={failedCount}
|
||||
total={toolCount}
|
||||
onReveal={handleRevealFailed}
|
||||
/>
|
||||
) : null;
|
||||
|
|
@ -747,37 +763,13 @@ export default function ActivityPhaseGroup({
|
|||
* right for the streaming-markdown cursor, wrong here — so `after:!static`
|
||||
* puts that one pseudo-element back in flow for the slot to center; the
|
||||
* `!` is what outranks the dot rule's three-class selector. */
|
||||
/** The thought streaming at the tail of a collapsed live card, shown the
|
||||
* way an unfolded thought shows it: the trailing sentences in a short
|
||||
* fading window under the header (#14546). The fold had swallowed that
|
||||
* peek with the rows, leaving one throttled sentence on the header to
|
||||
* stand for a paragraph of live reasoning. It takes the cursor's place:
|
||||
* moving text is its own sign the run is alive. Only a card that is still
|
||||
* just thinking shows it: once tool calls fold in with the thought, the
|
||||
* header names the mix and the cursor stands in for the reasoning (#16680). */
|
||||
const streamingThought = useMemo(() => {
|
||||
if (!isLive || isExpanded || liveParts == null) {
|
||||
return '';
|
||||
}
|
||||
const tail = liveParts[liveParts.length - 1];
|
||||
if (tail?.type !== ContentTypes.THINK) {
|
||||
return '';
|
||||
}
|
||||
if (liveParts.some((part) => part?.type === ContentTypes.TOOL_CALL)) {
|
||||
return '';
|
||||
}
|
||||
return typeof tail.think === 'string' ? tail.think : (tail.think?.value ?? '');
|
||||
}, [isLive, isExpanded, liveParts]);
|
||||
const thoughtPeek =
|
||||
streamingThought.trim() !== '' ? <StreamingThoughtPeek text={streamingThought} /> : null;
|
||||
const cursor =
|
||||
showCursor && thoughtPeek == null ? (
|
||||
<div className={TOOL_ROW_CLASSES} data-testid="activity-phase-cursor">
|
||||
<span className={cn(ROW_GLYPH_SLOT, 'submitting')} aria-hidden="true">
|
||||
<span className="result-thinking block after:!static" />
|
||||
</span>
|
||||
</div>
|
||||
) : null;
|
||||
const cursor = showCursor ? (
|
||||
<div className={TOOL_ROW_CLASSES} data-testid="activity-phase-cursor">
|
||||
<span className={cn(ROW_GLYPH_SLOT, 'submitting')} aria-hidden="true">
|
||||
<span className="result-thinking block after:!static" />
|
||||
</span>
|
||||
</div>
|
||||
) : null;
|
||||
/** `AttachmentGroup` drops `web_search` attachments, and the nested segment
|
||||
* renders with `hideAttachments` so its own `WebSearch` row stands down
|
||||
* for this hoist — so without `SearchVerticals` here a phase containing a
|
||||
|
|
@ -807,12 +799,9 @@ export default function ActivityPhaseGroup({
|
|||
)}
|
||||
data-testid="activity-phase-card"
|
||||
>
|
||||
<PhaseGlyph failed={hasFailure} />
|
||||
<PhaseGlyph failed={allFailed} partial={partialMarkerFallback} />
|
||||
<span
|
||||
className={cn(
|
||||
'tool-status-text min-w-0 flex-1 truncate text-left font-medium',
|
||||
hasFailure && 'text-text-warning',
|
||||
)}
|
||||
className="tool-status-text min-w-0 flex-1 truncate text-left font-medium"
|
||||
role="status"
|
||||
title={label}
|
||||
>
|
||||
|
|
@ -884,13 +873,13 @@ export default function ActivityPhaseGroup({
|
|||
) : (
|
||||
<>
|
||||
<RailGlyph hover={railHover}>
|
||||
{outcomeParts != null && !hasFailure ? (
|
||||
{outcomeParts != null && !allFailed && !partialMarkerFallback ? (
|
||||
<SpanGlyph parts={outcomeParts} attachments={attachments} />
|
||||
) : (
|
||||
<PhaseGlyph failed={hasFailure} />
|
||||
<PhaseGlyph failed={allFailed} partial={partialMarkerFallback} />
|
||||
)}
|
||||
</RailGlyph>
|
||||
<PhaseLabel text={label} failed={hasFailure} animate={smoothStreaming} />
|
||||
<PhaseLabel text={label} animate={smoothStreaming} />
|
||||
</>
|
||||
)}
|
||||
<ChevronDown
|
||||
|
|
@ -932,7 +921,6 @@ export default function ActivityPhaseGroup({
|
|||
return (
|
||||
<>
|
||||
{group}
|
||||
{thoughtPeek}
|
||||
{media}
|
||||
{cursor}
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -82,12 +82,9 @@ export default function BackgroundTaskCard({
|
|||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className="border-border-light bg-surface-secondary/50 min-w-0 rounded-lg border p-3"
|
||||
data-testid="background-task-card"
|
||||
>
|
||||
<div className="min-w-0" data-testid="background-task-card">
|
||||
<div className="flex min-w-0 items-start gap-2.5">
|
||||
<span className="bg-surface-tertiary flex size-8 shrink-0 items-center justify-center rounded-md">
|
||||
<span className="text-text-secondary flex size-5 shrink-0 items-center justify-center">
|
||||
<ToolIcon type={iconType} iconUrl={iconUrl} />
|
||||
</span>
|
||||
<div className="min-w-0 flex-1 pt-0.5">
|
||||
|
|
@ -108,7 +105,7 @@ export default function BackgroundTaskCard({
|
|||
</div>
|
||||
<span
|
||||
className={cn(
|
||||
'bg-surface-tertiary text-text-secondary inline-flex shrink-0 items-center gap-1.5 rounded-full px-2 py-1 text-xs',
|
||||
'text-text-secondary inline-flex shrink-0 items-center gap-1.5 text-xs',
|
||||
failed && 'text-status-error',
|
||||
)}
|
||||
>
|
||||
|
|
@ -135,7 +132,7 @@ export default function BackgroundTaskCard({
|
|||
</div>
|
||||
)}
|
||||
{result && (
|
||||
<div className="border-border-inset mt-3 border-t pt-2.5">
|
||||
<div className="mt-3">
|
||||
<div
|
||||
className={cn(
|
||||
'mb-1.5 text-xs font-medium',
|
||||
|
|
@ -144,7 +141,7 @@ export default function BackgroundTaskCard({
|
|||
>
|
||||
{localize(failed && !error ? 'com_ui_error' : 'com_ui_output')}
|
||||
</div>
|
||||
<div className="bg-surface-primary min-w-0 rounded-md p-2.5">
|
||||
<div className="border-border-light bg-surface-code min-w-0 rounded-lg border p-3">
|
||||
<OutputRenderer
|
||||
text={isCode ? formatBackgroundCodeOutput(result) : result}
|
||||
copyText={result}
|
||||
|
|
@ -153,11 +150,11 @@ export default function BackgroundTaskCard({
|
|||
</div>
|
||||
)}
|
||||
{error && (
|
||||
<div className="border-border-inset mt-3 border-t pt-2.5">
|
||||
<div className="mt-3">
|
||||
<div className="text-status-error mb-1.5 text-xs font-medium">
|
||||
{localize('com_ui_error')}
|
||||
</div>
|
||||
<div className="bg-surface-primary min-w-0 rounded-md p-2.5">
|
||||
<div className="border-border-light bg-surface-code min-w-0 rounded-lg border p-3">
|
||||
<OutputRenderer
|
||||
text={isCode ? formatBackgroundCodeOutput(error) : error}
|
||||
copyText={error}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { useMemo, useRef, useState, useCallback, useEffect } from 'react';
|
||||
import copy from 'copy-to-clipboard';
|
||||
import { Button } from '@librechat/client';
|
||||
import type { TAttachment, PartMetadata } from 'librechat-data-provider';
|
||||
import { toolPanelSpacingClassName, useToolContentPending } from '../disclosure';
|
||||
import { parseBackgroundHandle, splitBackgroundAttachments } from './handle';
|
||||
|
|
@ -57,6 +58,7 @@ export default function BashCall({
|
|||
toolCallId?: string;
|
||||
}) {
|
||||
const localize = useLocalize();
|
||||
const [showTimeoutDetails, setShowTimeoutDetails] = useState(false);
|
||||
const command = useMemo(() => parseJsonField(args, commandField), [args, commandField]);
|
||||
const isWritingCommand = !command || !areToolCallArgsComplete(args);
|
||||
const { useSandboxStarting } = useMessagePartsHost();
|
||||
|
|
@ -93,9 +95,11 @@ export default function BashCall({
|
|||
text: result.stderr,
|
||||
className: result.failed ? 'text-status-error' : 'text-text-secondary',
|
||||
},
|
||||
{ text: result.trailer, className: 'text-text-tertiary' },
|
||||
...(!result.timedOut || showTimeoutDetails
|
||||
? [{ text: result.trailer, className: 'text-text-tertiary' }]
|
||||
: []),
|
||||
],
|
||||
[result],
|
||||
[result, showTimeoutDetails],
|
||||
);
|
||||
/** A backgrounded call's persisted output stays the dispatch handle until
|
||||
* the detached run settles and patches it; render a background state
|
||||
|
|
@ -276,6 +280,22 @@ export default function BashCall({
|
|||
variant="terminal"
|
||||
/>
|
||||
)}
|
||||
{result?.timedOut === true && (
|
||||
<div className="mt-2 flex items-center justify-between gap-2 text-xs">
|
||||
<span className="text-text-secondary">
|
||||
{localize('com_ui_command_timeout_note')}
|
||||
</span>
|
||||
<Button
|
||||
type="button"
|
||||
variant="inline-link"
|
||||
size="bare"
|
||||
aria-expanded={showTimeoutDetails}
|
||||
onClick={() => setShowTimeoutDetails((previous) => !previous)}
|
||||
>
|
||||
{localize(showTimeoutDetails ? 'com_ui_hide' : 'com_ui_details')}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -59,8 +59,7 @@ jest.mock('~/components/Chat/Messages/Content/ProgressText', () => ({
|
|||
}) => (
|
||||
<div data-testid="progress-text" onClick={onClick}>
|
||||
{phase === 'running' ? inProgressText : finishedText}
|
||||
{phase === 'failed' ? ' — tool failed' : ''}
|
||||
{phase === 'failed' && verdict ? ` · ${verdict}` : ''}
|
||||
{phase === 'failed' ? ` · ${verdict || 'tool failed'}` : ''}
|
||||
</div>
|
||||
),
|
||||
}));
|
||||
|
|
@ -425,7 +424,7 @@ describe('BashCall sole tool disclosure', () => {
|
|||
</SoleToolContext.Provider>
|
||||
</RecoilRoot>,
|
||||
);
|
||||
expect(screen.getByTestId('progress-text')).toHaveTextContent('tool failed');
|
||||
expect(screen.getByTestId('progress-text')).toHaveTextContent('exit code 1');
|
||||
});
|
||||
|
||||
it('keeps its row for a detached task whose dispatch step has closed', () => {
|
||||
|
|
@ -661,6 +660,21 @@ describe('BashCall exit status', () => {
|
|||
</RecoilRoot>,
|
||||
);
|
||||
|
||||
it('hides timeout executor guidance until details are opened', () => {
|
||||
renderSettled(
|
||||
'stdout:\nsleeping\n\n[terminated by SIGKILL][timed out]\nCommand reached timeoutMs: 30000. Before retrying, check for partial side effects.',
|
||||
);
|
||||
expect(screen.queryByText(/Before retrying/)).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('reveals the complete timeout trailer through details', () => {
|
||||
renderSettled(
|
||||
'stdout:\nsleeping\n\n[terminated by SIGKILL][timed out]\nCommand reached timeoutMs: 30000. Before retrying, check for partial side effects.',
|
||||
);
|
||||
fireEvent.click(screen.getByRole('button', { name: 'com_ui_details' }));
|
||||
expect(screen.getByText(/Before retrying/)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('does not read a trailer the sandbox command printed itself', () => {
|
||||
const { container } = renderSettled('stdout:\n[exit code: 1]', false);
|
||||
expect(screen.getByTestId('progress-text')).toHaveTextContent('Ran command');
|
||||
|
|
@ -670,12 +684,12 @@ describe('BashCall exit status', () => {
|
|||
|
||||
it('fails the same output when the server marked it attached-workspace', () => {
|
||||
renderSettled('stdout:\n[exit code: 1]');
|
||||
expect(screen.getByTestId('progress-text')).toHaveTextContent(/tool failed · exit code 1$/);
|
||||
expect(screen.getByTestId('progress-text')).toHaveTextContent(/Ran command · exit code 1$/);
|
||||
});
|
||||
|
||||
it('fails a non-zero exit even when the output matches no error pattern', () => {
|
||||
renderSettled('stdout:\n1 test failed\n\n[exit code: 2]');
|
||||
expect(screen.getByTestId('progress-text')).toHaveTextContent(/tool failed · exit code 2$/);
|
||||
expect(screen.getByTestId('progress-text')).toHaveTextContent(/Ran command · exit code 2$/);
|
||||
});
|
||||
|
||||
it('keeps a zero exit successful even when stderr reads like an error', () => {
|
||||
|
|
@ -700,7 +714,7 @@ describe('BashCall exit status', () => {
|
|||
['Command completed with no output.\n[terminated by SIGTERM]', 'terminated by SIGTERM'],
|
||||
])('names the reason for a stopped command: %s', (output, reason) => {
|
||||
renderSettled(output);
|
||||
expect(screen.getByTestId('progress-text')).toHaveTextContent(`tool failed · ${reason}`);
|
||||
expect(screen.getByTestId('progress-text')).toHaveTextContent(`Ran command · ${reason}`);
|
||||
});
|
||||
|
||||
it('keeps the text heuristic for sandbox output without an exit trailer', () => {
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ export default function ProgressText({
|
|||
hasInput?: boolean;
|
||||
popover?: boolean;
|
||||
isExpanded?: boolean;
|
||||
/** Why a failed card failed ("exit code 2"), shown after the failure
|
||||
/** Why a failed card failed ("exit code 2"), shown in place of the generic failure
|
||||
* suffix. Plain text inside the button, so it is part of its name. */
|
||||
verdict?: string;
|
||||
}) {
|
||||
|
|
@ -236,11 +236,10 @@ export default function ProgressText({
|
|||
</span>
|
||||
)}
|
||||
</span>
|
||||
{/* A reason ("timed out", "exit code 2") already says the call failed,
|
||||
so it replaces the generic word instead of following it. */}
|
||||
{errorSuffix && (
|
||||
<span className="text-status-error shrink-0 font-normal">· {errorSuffix}</span>
|
||||
)}
|
||||
{errorSuffix && verdict && (
|
||||
<span className="text-text-secondary shrink-0 font-normal">· {verdict}</span>
|
||||
<span className="text-status-error shrink-0 font-normal">· {verdict || errorSuffix}</span>
|
||||
)}
|
||||
{isRunning && phaseStartAt != null && localPhaseStart != null && (
|
||||
<ElapsedTimer start={localPhaseStart} />
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { useState, useRef, useMemo, useEffect, useContext, useCallback } from 'react';
|
||||
import { Tools, Constants, ContentTypes } from 'librechat-data-provider';
|
||||
import { ChevronDown, ListChecks, MessageCircleQuestion, Users } from 'lucide-react';
|
||||
import { ChevronDown, ListChecks, MessageCircleQuestion, TriangleAlert, Users } from 'lucide-react';
|
||||
import type { TAttachment, TMessageContentParts } from 'librechat-data-provider';
|
||||
import type { PartWithIndex } from './ParallelContent';
|
||||
import type { ToolMeta } from './outcome';
|
||||
|
|
@ -133,7 +133,9 @@ export default function ToolCallGroup({
|
|||
);
|
||||
const activityLabel = getBatchActivityLabelPart(labelPart?.part);
|
||||
const activityLabelText = getActivityLabelText(activityLabel);
|
||||
const activityFailed = activityLabel?.status === 'failed' || activityLabel?.status === 'partial';
|
||||
/** The label's verdict outranks the calls' only when the whole batch failed;
|
||||
* a partial batch has mixed outcomes, and its failed rows say what went wrong. */
|
||||
const activityFailed = activityLabel?.status === 'failed';
|
||||
/** A settled, filled label is itself a completion proof: the PostToolBatch
|
||||
* claim only happens after every output in the batch returned. Without
|
||||
* it, a tool that legitimately returns an empty string reads as
|
||||
|
|
@ -605,10 +607,16 @@ export default function ToolCallGroup({
|
|||
} else if (allAskQuestions) {
|
||||
CategoryIcon = MessageCircleQuestion;
|
||||
}
|
||||
const iconStatus = getOutcomeStatus({
|
||||
failed: activityFailed ? 1 : activitySummary.failedCount,
|
||||
cancelled: activitySummary.cancelledCount,
|
||||
});
|
||||
const partialMarkerFallback =
|
||||
activityLabel?.status === 'partial' &&
|
||||
(activitySummary.failedCount === 0 || activitySummary.failedCount >= count);
|
||||
const iconStatus = activityFailed
|
||||
? 'failed'
|
||||
: getOutcomeStatus({
|
||||
failed: activitySummary.failedCount,
|
||||
cancelled: activitySummary.cancelledCount,
|
||||
total: count,
|
||||
});
|
||||
|
||||
const hasActiveToolCall = useMemo(
|
||||
() => isSubmitting && toolMetadata.some((m) => m && !m.hasOutput),
|
||||
|
|
@ -642,37 +650,38 @@ export default function ToolCallGroup({
|
|||
aria-label={groupAriaLabel}
|
||||
>
|
||||
<RailGlyph hover={railHover}>
|
||||
{iconStatus == null && (allSubagents || allAskQuestions || allTaskChecks) ? (
|
||||
/** Homogeneous categories keep the same glyph as their individual
|
||||
* cards instead of stacking identical tool icons. */
|
||||
<div
|
||||
className={cn(
|
||||
ROW_GLYPH_SLOT,
|
||||
'text-text-secondary',
|
||||
isGroupLive && 'text-text-primary animate-pulse',
|
||||
)}
|
||||
aria-hidden="true"
|
||||
>
|
||||
<CategoryIcon size={14} />
|
||||
</div>
|
||||
) : (
|
||||
<div className={ROW_GLYPH_SLOT} aria-hidden="true">
|
||||
<StackedToolIcons
|
||||
toolNames={iconToolNames}
|
||||
mcpIconMap={mcpIconMap}
|
||||
maxIcons={4}
|
||||
sourceDomains={sourceDomains}
|
||||
status={iconStatus}
|
||||
isAnimating={isGroupLive}
|
||||
/>
|
||||
</div>
|
||||
{partialMarkerFallback && (
|
||||
<TriangleAlert className="text-status-warning size-4 shrink-0" aria-hidden="true" />
|
||||
)}
|
||||
{!partialMarkerFallback &&
|
||||
(iconStatus == null && (allSubagents || allAskQuestions || allTaskChecks) ? (
|
||||
/** Homogeneous categories keep the same glyph as their individual
|
||||
* cards instead of stacking identical tool icons. */
|
||||
<div
|
||||
className={cn(
|
||||
ROW_GLYPH_SLOT,
|
||||
'text-text-secondary',
|
||||
isGroupLive && 'text-text-primary animate-pulse',
|
||||
)}
|
||||
aria-hidden="true"
|
||||
>
|
||||
<CategoryIcon size={14} />
|
||||
</div>
|
||||
) : (
|
||||
<div className={ROW_GLYPH_SLOT} aria-hidden="true">
|
||||
<StackedToolIcons
|
||||
toolNames={iconToolNames}
|
||||
mcpIconMap={mcpIconMap}
|
||||
maxIcons={4}
|
||||
sourceDomains={sourceDomains}
|
||||
status={iconStatus}
|
||||
isAnimating={isGroupLive}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</RailGlyph>
|
||||
<span
|
||||
className={cn(
|
||||
'tool-status-text min-w-0 truncate font-medium',
|
||||
activityFailed && 'text-text-warning',
|
||||
)}
|
||||
className="tool-status-text min-w-0 truncate font-medium"
|
||||
role="status"
|
||||
title={groupLabel}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { useMemo } from 'react';
|
||||
import { TriangleAlert, X } from 'lucide-react';
|
||||
import { CircleX, X } from 'lucide-react';
|
||||
import type { ToolIconType } from './ToolIcon';
|
||||
import ToolIcon, { getToolIconType, getMCPServerName } from './ToolIcon';
|
||||
import { FaviconImage } from '~/components/Web/SourceHovercard';
|
||||
|
|
@ -61,9 +61,11 @@ export default function StackedToolIcons({
|
|||
return result;
|
||||
}, [toolNames, mcpIconMap, mcpServerNames, sourceDomains]);
|
||||
|
||||
if (status != null) {
|
||||
const StatusIcon = status === 'failed' ? TriangleAlert : X;
|
||||
return <StatusIcon className="text-text-warning size-4 shrink-0" aria-hidden="true" />;
|
||||
if (status === 'failed') {
|
||||
return <CircleX className="text-status-error size-4 shrink-0" aria-hidden="true" />;
|
||||
}
|
||||
if (status === 'cancelled') {
|
||||
return <X className="text-text-warning size-4 shrink-0" aria-hidden="true" />;
|
||||
}
|
||||
|
||||
const visibleIcons = uniqueIcons.slice(0, maxIcons);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ function WakeupTaskCard({
|
|||
const hasResult = task.result.trim() !== '';
|
||||
|
||||
return (
|
||||
<div className="border-border-light bg-surface-secondary/40 my-1.5 rounded-lg border p-3">
|
||||
<div className="my-1.5 min-w-0">
|
||||
<div className="text-text-secondary flex min-h-6 items-center gap-1.5 text-xs">
|
||||
<StatusIcon
|
||||
size={13}
|
||||
|
|
@ -165,7 +165,7 @@ const Wakeup = memo(function Wakeup({
|
|||
return (
|
||||
<div className={cn('max-w-full', shouldRenderBody && 'w-[36rem]')}>
|
||||
<Button
|
||||
variant="ghost"
|
||||
variant="disclosure"
|
||||
type="button"
|
||||
className={systemEventHeaderClasses}
|
||||
onClick={handleToggle}
|
||||
|
|
@ -203,7 +203,7 @@ const Wakeup = memo(function Wakeup({
|
|||
)}
|
||||
{display.tasks.map((task) =>
|
||||
display.kind === 'background_tool' ? (
|
||||
<div key={task.taskId} className="my-2">
|
||||
<div key={task.taskId} className="my-2 pl-7">
|
||||
<BackgroundTaskCard
|
||||
task={{
|
||||
taskId: task.taskId,
|
||||
|
|
|
|||
|
|
@ -533,7 +533,7 @@ describe('ActivityPhaseGroup failure fast path', () => {
|
|||
</ActivityPhaseGroup>,
|
||||
);
|
||||
|
||||
expect(screen.getByTestId('failed-reveal-pill')).toHaveTextContent('1/3 failed');
|
||||
expect(screen.getByTestId('failed-reveal-pill')).toHaveTextContent('com_ui_n_actions_failed');
|
||||
expect(screen.getByRole('button', { name: 'com_ui_show_failed_one_of_n' })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
|
|
@ -601,7 +601,7 @@ describe('ActivityPhaseGroup failure fast path', () => {
|
|||
);
|
||||
fireEvent.click(screen.getByRole('button', { name: LABEL }));
|
||||
const pill = screen.getByRole('button', { name: 'com_ui_show_failed_n_of_n' });
|
||||
expect(pill).toHaveTextContent('2/2 failed');
|
||||
expect(pill).toHaveTextContent('com_ui_n_actions_failed');
|
||||
fireEvent.click(pill);
|
||||
expect(onReveal).toHaveBeenCalledTimes(1);
|
||||
expect(screen.getByRole('button', { name: LABEL })).toHaveAttribute('aria-expanded', 'true');
|
||||
|
|
@ -613,10 +613,34 @@ describe('ActivityPhaseGroup failure fast path', () => {
|
|||
<div />
|
||||
</ActivityPhaseGroup>,
|
||||
);
|
||||
expect(screen.getByTestId('failed-reveal-pill')).toHaveTextContent('1/2 failed');
|
||||
expect(screen.getByTestId('failed-reveal-pill')).toHaveTextContent('com_ui_n_actions_failed');
|
||||
expect(screen.getByTestId('live-phase-outcome')).toHaveTextContent('1/2 failed');
|
||||
});
|
||||
|
||||
test('does not tint the title of a partially failed phase', () => {
|
||||
render(
|
||||
<ActivityPhaseGroup
|
||||
labelPart={{ ...labelPart, status: 'partial' }}
|
||||
hasContent
|
||||
spanParts={[okCall, failedCall]}
|
||||
>
|
||||
<div />
|
||||
</ActivityPhaseGroup>,
|
||||
);
|
||||
expect(screen.getByText(LABEL)).not.toHaveClass('text-text-warning');
|
||||
});
|
||||
|
||||
test('keeps the pill quiet when the phase contains both successful and failed calls', () => {
|
||||
render(
|
||||
<ActivityPhaseGroup labelPart={labelPart} hasContent spanParts={[okCall, failedCall]}>
|
||||
<div />
|
||||
</ActivityPhaseGroup>,
|
||||
);
|
||||
expect(screen.getByTestId('failed-reveal-pill').querySelector('span')).toHaveClass(
|
||||
'text-text-secondary',
|
||||
);
|
||||
});
|
||||
|
||||
test('a card with no failure shows neither pill nor peek', () => {
|
||||
render(
|
||||
<ActivityPhaseGroup labelPart={labelPart} hasContent spanParts={[okCall]}>
|
||||
|
|
@ -837,6 +861,88 @@ describe('ActivityPhaseGroup open live header', () => {
|
|||
});
|
||||
});
|
||||
|
||||
test('retains a warning when a partial phase has no child rows', () => {
|
||||
render(
|
||||
<ActivityPhaseGroup labelPart={{ ...labelPart, status: 'partial' }} hasContent={false}>
|
||||
<div />
|
||||
</ActivityPhaseGroup>,
|
||||
);
|
||||
expect(
|
||||
screen.getByTestId('activity-phase-card').querySelector('.lucide-triangle-alert'),
|
||||
).not.toBeNull();
|
||||
});
|
||||
|
||||
test.each([
|
||||
{ type: ContentTypes.THINK, think: 'Remaining reasoning' },
|
||||
{ type: ContentTypes.TEXT, text: 'Remaining text' },
|
||||
makeLabelPart('Remaining child summary'),
|
||||
])('retains partial status with only a $type row remaining', (part) => {
|
||||
render(
|
||||
<ActivityPhaseGroup
|
||||
labelPart={{ ...labelPart, status: 'partial' }}
|
||||
hasContent
|
||||
spanParts={[part as TMessageContentParts]}
|
||||
>
|
||||
<div />
|
||||
</ActivityPhaseGroup>,
|
||||
);
|
||||
expect(
|
||||
screen.getByRole('button', { name: LABEL }).querySelector('.lucide-triangle-alert'),
|
||||
).not.toBeNull();
|
||||
});
|
||||
|
||||
test('honors the partial marker when only failed tool rows survive', () => {
|
||||
const part: TMessageContentParts = {
|
||||
type: ContentTypes.TOOL_CALL,
|
||||
tool_call: {
|
||||
id: 'remaining',
|
||||
name: 'read_file',
|
||||
args: '{}',
|
||||
output: 'Error processing tool: unavailable',
|
||||
progress: 1,
|
||||
runStepStatus: 'failed',
|
||||
},
|
||||
} as TMessageContentParts;
|
||||
render(
|
||||
<ActivityPhaseGroup
|
||||
labelPart={{ ...labelPart, status: 'partial' }}
|
||||
hasContent
|
||||
spanParts={[part]}
|
||||
>
|
||||
<div />
|
||||
</ActivityPhaseGroup>,
|
||||
);
|
||||
expect(
|
||||
screen.getByRole('button', { name: LABEL }).querySelector('.lucide-triangle-alert'),
|
||||
).not.toBeNull();
|
||||
});
|
||||
|
||||
test('retains partial status when only successful tool rows survive', () => {
|
||||
const part = {
|
||||
type: ContentTypes.TOOL_CALL,
|
||||
tool_call: {
|
||||
id: 'success',
|
||||
name: 'read_file',
|
||||
args: '{}',
|
||||
output: 'done',
|
||||
progress: 1,
|
||||
runStepStatus: 'completed',
|
||||
},
|
||||
} as TMessageContentParts;
|
||||
render(
|
||||
<ActivityPhaseGroup
|
||||
labelPart={{ ...labelPart, status: 'partial' }}
|
||||
hasContent
|
||||
spanParts={[part]}
|
||||
>
|
||||
<div />
|
||||
</ActivityPhaseGroup>,
|
||||
);
|
||||
expect(
|
||||
screen.getByRole('button', { name: LABEL }).querySelector('.lucide-triangle-alert'),
|
||||
).not.toBeNull();
|
||||
});
|
||||
|
||||
describe('ActivityPhaseGroup streaming thought peek', () => {
|
||||
const thought: TMessageContentParts = {
|
||||
type: ContentTypes.THINK,
|
||||
|
|
@ -853,19 +959,13 @@ describe('ActivityPhaseGroup streaming thought peek', () => {
|
|||
},
|
||||
} as unknown as TMessageContentParts;
|
||||
|
||||
test("shows the streaming thought under a collapsed live card, in the cursor's place", () => {
|
||||
test('hides the streaming thought when its Thoughts header is inside a collapsed phase', () => {
|
||||
render(
|
||||
<ActivityPhaseGroup labelPart={makeLabelPart('')} hasContent liveParts={[thought]} showCursor>
|
||||
<div data-testid="phase-content" />
|
||||
</ActivityPhaseGroup>,
|
||||
);
|
||||
const peek = screen.getByTestId('streaming-thought-peek');
|
||||
expect(peek).toHaveTextContent('Next I check the ordering. Then the tags.');
|
||||
/** Straight from the stream, the thought still carries its opening tag. */
|
||||
expect(peek).not.toHaveTextContent('<think>');
|
||||
expect(screen.queryByTestId('activity-phase-cursor')).toBeNull();
|
||||
/** Under the header, not inside the fold that would unmount it. */
|
||||
expect(screen.getByTestId('activity-phase-panel')).not.toContainElement(peek);
|
||||
expect(screen.queryByTestId('streaming-thought-peek')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('gives way to the rows once the card is open', () => {
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ jest.mock('lucide-react', () => ({
|
|||
...jest.requireActual('lucide-react'),
|
||||
ChevronDown: () => <span>{'chevron'}</span>,
|
||||
TriangleAlert: () => <span>{'alert'}</span>,
|
||||
CircleX: () => <span>{'failed'}</span>,
|
||||
Users: () => <span>{'users'}</span>,
|
||||
}));
|
||||
|
||||
|
|
@ -1064,7 +1065,7 @@ describe('ContentParts integration: MCP image hoist and grouping', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('ContentParts — synthesized activity folds', () => {
|
||||
describe('ContentParts: synthesized activity folds', () => {
|
||||
/** Settled by default: the fold is content-derived, so history and a live
|
||||
* run partition identically. The streaming case gets its own test below. */
|
||||
const baseProps = {
|
||||
|
|
@ -1134,7 +1135,9 @@ describe('ContentParts — synthesized activity folds', () => {
|
|||
const { rerender } = renderContentParts(props);
|
||||
|
||||
const phase = screen.getByTestId('activity-phase-card');
|
||||
expect(within(phase).getByTestId('failed-reveal-pill')).toHaveTextContent('1/2 failed');
|
||||
expect(within(phase).getByTestId('failed-reveal-pill')).toHaveTextContent(
|
||||
'com_ui_n_actions_failed',
|
||||
);
|
||||
fireEvent.click(within(phase).getAllByRole('button')[0]);
|
||||
|
||||
const group = screen.getByRole('button', { name: /Running 2 actions.*1\/2 failed/ });
|
||||
|
|
|
|||
|
|
@ -776,7 +776,7 @@ describe('live fold parity with the cards it hides', () => {
|
|||
expect(header.querySelector('.lucide-file-text')).not.toBeNull();
|
||||
});
|
||||
|
||||
it.each([true, false])('puts failure ahead of site identity (fold=%s)', (fold) => {
|
||||
it.each([true, false])('keeps identity for mixed outcomes (fold=%s)', (fold) => {
|
||||
const failed = toPart({ name: Tools.web_search, output: 'results', runStepStatus: 'failed' });
|
||||
const view = mount(
|
||||
[failed, toPart({ name: 'lookup', output: 'ok' }, 't2')],
|
||||
|
|
@ -784,8 +784,8 @@ describe('live fold parity with the cards it hides', () => {
|
|||
fold,
|
||||
);
|
||||
const header = within(view.container).getAllByRole('button')[0];
|
||||
expect(header.querySelector('.lucide-triangle-alert')).not.toBeNull();
|
||||
expect(sites(header)).toEqual([]);
|
||||
expect(header.querySelector('.lucide-circle-x')).toBeNull();
|
||||
expect(sites(header)).toEqual(['youtube.com', 'cnbc.com']);
|
||||
});
|
||||
|
||||
it.each([true, false])('puts cancellation ahead of tool identity (fold=%s)', (fold) => {
|
||||
|
|
@ -807,7 +807,7 @@ describe('live fold parity with the cards it hides', () => {
|
|||
);
|
||||
const header = screen.getByRole('button', { name: 'Reviewed the work' });
|
||||
expect(
|
||||
header.querySelector(status === 'failed' ? '.lucide-triangle-alert' : '.lucide-x'),
|
||||
header.querySelector(status === 'failed' ? '.lucide-circle-x' : '.lucide-x'),
|
||||
).not.toBeNull();
|
||||
});
|
||||
|
||||
|
|
@ -824,7 +824,7 @@ describe('live fold parity with the cards it hides', () => {
|
|||
fireEvent.click(screen.getByRole('button', { name: 'Reviewed the work' }));
|
||||
const group = screen.getByRole('button', { name: /Ran 2 actions.*1\/2 failed/ });
|
||||
expect(group).toHaveAccessibleName(/1\/2 failed/);
|
||||
expect(group.querySelector('.lucide-triangle-alert')).not.toBeNull();
|
||||
expect(group.querySelector('.lucide-circle-x')).toBeNull();
|
||||
});
|
||||
|
||||
it('shows the sites a search read on the live row, one per domain, with no card mounted', () => {
|
||||
|
|
@ -874,7 +874,7 @@ describe('live fold parity with the cards it hides', () => {
|
|||
const button = screen.getByRole('button', { name: 'Could not reach the site' });
|
||||
|
||||
expect(sites(button)).toEqual([]);
|
||||
expect(button.querySelector('.lucide-triangle-alert')).not.toBeNull();
|
||||
expect(button.querySelector('.lucide-circle-x')).not.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -281,7 +281,12 @@ describe('ProgressText fixed siblings', () => {
|
|||
describe('ProgressText verdict', () => {
|
||||
it('names the failure reason inside the button on a failed card', () => {
|
||||
renderProgressText({ phase: 'failed', verdict: 'exit code 2' });
|
||||
expect(screen.getByRole('button')).toHaveTextContent('· com_ui_tool_failed· exit code 2');
|
||||
expect(screen.getByRole('button')).toHaveTextContent('Completed foo· exit code 2');
|
||||
});
|
||||
|
||||
it('states the reason in place of the generic failure word', () => {
|
||||
renderProgressText({ phase: 'failed', verdict: 'timed out' });
|
||||
expect(screen.queryByText(/com_ui_tool_failed/)).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('keeps the failure verdict but hides preparation, call, total, and live timers', () => {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ describe('shared header glyphs', () => {
|
|||
expect(container.querySelector('img')).toBeNull();
|
||||
expect(container.querySelector('.animate-pulse')).toBeNull();
|
||||
expect(
|
||||
container.querySelector(status === 'failed' ? '.lucide-triangle-alert' : '.lucide-x'),
|
||||
container.querySelector(status === 'failed' ? '.lucide-circle-x' : '.lucide-x'),
|
||||
).not.toBeNull();
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ jest.mock('lucide-react', () => ({
|
|||
ChevronDown: () => <span>{'ChevronDown'}</span>,
|
||||
ChevronUp: () => <span>{'ChevronUp'}</span>,
|
||||
TriangleAlert: () => <span>{'TriangleAlert'}</span>,
|
||||
CircleX: () => <span>{'CircleX'}</span>,
|
||||
}));
|
||||
|
||||
jest.mock('~/utils', () => ({
|
||||
|
|
|
|||
|
|
@ -119,8 +119,8 @@ jest.mock('~/components/MCPUIResource', () => ({
|
|||
}));
|
||||
|
||||
jest.mock('../ToolOutput', () => ({
|
||||
StackedToolIcons: ({ toolNames }: { toolNames: string[] }) => (
|
||||
<span data-testid="stacked-icons" data-tool-names={toolNames.join(',')} />
|
||||
StackedToolIcons: ({ toolNames, status }: { toolNames: string[]; status?: string }) => (
|
||||
<span data-testid="stacked-icons" data-tool-names={toolNames.join(',')} data-status={status} />
|
||||
),
|
||||
getMCPServerName: () => '',
|
||||
isError: (output: string) => output.startsWith('Error processing tool'),
|
||||
|
|
@ -136,6 +136,7 @@ jest.mock('lucide-react', () => ({
|
|||
MessageCircleQuestion: () => <span data-testid="question-icon">{'question'}</span>,
|
||||
ListChecks: () => <span data-testid="task-check-icon">{'checks'}</span>,
|
||||
TriangleAlert: () => <span>{'warning'}</span>,
|
||||
CircleX: () => <span>{'failed'}</span>,
|
||||
CircleMinus: () => <span>{'collapse'}</span>,
|
||||
}));
|
||||
|
||||
|
|
@ -1754,11 +1755,91 @@ describe('ToolCallGroup failure fast path', () => {
|
|||
expect(onReveal).toHaveBeenCalledTimes(failedParts.length);
|
||||
});
|
||||
|
||||
it('keeps the count quiet when the group contains both successful and failed calls', () => {
|
||||
renderGroup(props(jest.fn()));
|
||||
expect(
|
||||
screen
|
||||
.getByTestId('failed-reveal-pill')
|
||||
.querySelector('span.text-text-secondary, span.text-status-error'),
|
||||
).toHaveClass('text-text-secondary');
|
||||
});
|
||||
|
||||
it('keeps the count in the error tone when every call failed', () => {
|
||||
renderGroup({
|
||||
...props(jest.fn()),
|
||||
parts: [
|
||||
failedParts[1],
|
||||
{ part: makePart('c3', 'Error processing tool: gone', 'create_file'), idx: 1 },
|
||||
],
|
||||
});
|
||||
expect(
|
||||
screen
|
||||
.getByTestId('failed-reveal-pill')
|
||||
.querySelector('span.text-text-secondary, span.text-status-error'),
|
||||
).toHaveClass('text-status-error');
|
||||
});
|
||||
|
||||
it.each(['created', 'Error processing tool: unavailable'])(
|
||||
'preserves a sparse partial batch with output %s',
|
||||
(output) => {
|
||||
renderGroup({
|
||||
...props(jest.fn()),
|
||||
parts: [{ part: makePart('remaining', output, 'create_file'), idx: 0 }],
|
||||
labelPart: {
|
||||
part: {
|
||||
type: ContentTypes.ACTIVITY_LABEL,
|
||||
activity_label: 'Created the config files',
|
||||
pending: false,
|
||||
status: 'partial',
|
||||
} as TMessageContentParts,
|
||||
idx: 1,
|
||||
},
|
||||
});
|
||||
expect(screen.getByText('warning')).toBeInTheDocument();
|
||||
},
|
||||
);
|
||||
|
||||
it.each([
|
||||
{ type: ContentTypes.THINK, think: 'Remaining thought' },
|
||||
{ type: ContentTypes.TEXT, text: 'Remaining commentary' },
|
||||
])('preserves a failed batch marker with only a $type row', (part) => {
|
||||
renderGroup({
|
||||
...props(jest.fn()),
|
||||
parts: [{ part: part as TMessageContentParts, idx: 0 }],
|
||||
labelPart: {
|
||||
part: {
|
||||
type: ContentTypes.ACTIVITY_LABEL,
|
||||
activity_label: 'Could not finish',
|
||||
pending: false,
|
||||
status: 'failed',
|
||||
} as TMessageContentParts,
|
||||
idx: 1,
|
||||
},
|
||||
});
|
||||
expect(screen.getByTestId('stacked-icons')).toHaveAttribute('data-status', 'failed');
|
||||
});
|
||||
|
||||
it('does not tint the title of a partially failed labeled group', () => {
|
||||
renderGroup({
|
||||
...props(jest.fn()),
|
||||
labelPart: {
|
||||
part: {
|
||||
type: ContentTypes.ACTIVITY_LABEL,
|
||||
[ContentTypes.ACTIVITY_LABEL]: 'Created the config files',
|
||||
pending: false,
|
||||
status: 'partial',
|
||||
} as unknown as TMessageContentParts,
|
||||
idx: 2,
|
||||
},
|
||||
});
|
||||
expect(screen.getByText('Created the config files')).not.toHaveClass('text-text-warning');
|
||||
});
|
||||
|
||||
it('shows the failure count once, on the pill, when it stands alone', () => {
|
||||
renderGroup(props(jest.fn()));
|
||||
const header = screen.getByRole('button', { name: /· 1\/2 failed$/ });
|
||||
expect(header).not.toHaveTextContent('1/2 failed');
|
||||
expect(screen.getByTestId('failed-reveal-pill')).toHaveTextContent('1/2 failed');
|
||||
expect(screen.getByTestId('failed-reveal-pill')).toHaveTextContent('com_ui_n_actions_failed');
|
||||
});
|
||||
|
||||
it("keeps the count in text inside a phase, where the pill is the phase's", () => {
|
||||
|
|
|
|||
|
|
@ -95,6 +95,19 @@ const subagentDisplay = {
|
|||
};
|
||||
|
||||
describe('Wakeup', () => {
|
||||
it('uses a transparent disclosure for the System header', () => {
|
||||
render(
|
||||
<ChatSurfaceHarness>
|
||||
<RecoilRoot>
|
||||
<Wakeup display={subagentDisplay} />
|
||||
</RecoilRoot>
|
||||
</ChatSurfaceHarness>,
|
||||
);
|
||||
expect(
|
||||
screen.getByRole('button', { name: 'com_ui_wakeup_subagent_completed' }),
|
||||
).toHaveAttribute('variant', 'disclosure');
|
||||
});
|
||||
|
||||
it.each([
|
||||
['subagent', subagentDisplay, 'com_ui_wakeup_subagent_completed'],
|
||||
[
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { Tools, ContentTypes } from 'librechat-data-provider';
|
||||
import type { TMessageContentParts } from 'librechat-data-provider';
|
||||
import { summarizeSpan } from '../outcome';
|
||||
import { getOutcomeStatus, summarizeSpan } from '../outcome';
|
||||
|
||||
const bashPart = (
|
||||
id: string,
|
||||
|
|
@ -21,6 +21,20 @@ const bashPart = (
|
|||
},
|
||||
}) as unknown as TMessageContentParts;
|
||||
|
||||
describe('getOutcomeStatus', () => {
|
||||
it('keeps identity glyphs for a span that contains both successful and failed calls', () => {
|
||||
expect(getOutcomeStatus({ failed: 1, cancelled: 0, total: 3 })).toBeUndefined();
|
||||
});
|
||||
|
||||
it('reports failure when every call in the span failed', () => {
|
||||
expect(getOutcomeStatus({ failed: 2, cancelled: 0, total: 2 })).toBe('failed');
|
||||
});
|
||||
|
||||
it('still reports a stop in a span with a mixed outcome', () => {
|
||||
expect(getOutcomeStatus({ failed: 1, cancelled: 1, total: 3 })).toBe('cancelled');
|
||||
});
|
||||
});
|
||||
|
||||
describe('summarizeSpan command exit status', () => {
|
||||
it('counts a bash call that exited non-zero as failed, like its card', () => {
|
||||
const summary = summarizeSpan([
|
||||
|
|
|
|||
|
|
@ -232,12 +232,20 @@ export function getToolMeta(
|
|||
|
||||
export type SpanOutcome = { failed: number; cancelled: number };
|
||||
|
||||
/** The most severe terminal outcome replaces identity glyphs on every summary. */
|
||||
/** True when every call a summary stands for failed: the one case where the
|
||||
* summary itself, not only the failed rows and the count, reads as failed. */
|
||||
export function isSpanFailed(failed: number, total: number): boolean {
|
||||
return failed > 0 && failed >= total;
|
||||
}
|
||||
|
||||
/** Mixed outcomes keep tool identity. The count still exposes every failed
|
||||
* call, without turning the whole summary into an error indicator. */
|
||||
export function getOutcomeStatus({
|
||||
failed,
|
||||
cancelled,
|
||||
}: SpanOutcome): 'failed' | 'cancelled' | undefined {
|
||||
if (failed > 0) {
|
||||
total,
|
||||
}: SpanOutcome & { total: number }): 'failed' | 'cancelled' | undefined {
|
||||
if (isSpanFailed(failed, total)) {
|
||||
return 'failed';
|
||||
}
|
||||
if (cancelled > 0) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ import {
|
|||
useRef,
|
||||
useState,
|
||||
} from 'react';
|
||||
import { TriangleAlert } from 'lucide-react';
|
||||
import { CircleX } from 'lucide-react';
|
||||
import { Button } from '@librechat/client';
|
||||
import type { TranslationKeys } from '~/hooks';
|
||||
import { useLocalize } from '~/hooks';
|
||||
import { cn } from '~/utils';
|
||||
|
|
@ -113,6 +114,7 @@ export function FailedRevealPill({
|
|||
onReveal: () => void;
|
||||
className?: string;
|
||||
}) {
|
||||
const severe = count > 0 && count >= total;
|
||||
const localize = useLocalize();
|
||||
if (count === 0) {
|
||||
return null;
|
||||
|
|
@ -124,19 +126,20 @@ export function FailedRevealPill({
|
|||
showFailedKey = 'com_ui_show_failed_one_of_n';
|
||||
}
|
||||
return (
|
||||
<button
|
||||
<Button
|
||||
type="button"
|
||||
className={cn(
|
||||
'bg-status-error-subtle text-status-error inline-flex h-5 shrink-0 items-center gap-1 rounded-full border border-transparent px-2 text-xs leading-none font-semibold',
|
||||
'hover:border-status-error-border focus-visible:border-status-error focus-visible:outline-none',
|
||||
className,
|
||||
)}
|
||||
variant="inline-link"
|
||||
size="xs"
|
||||
className={cn('shrink-0', className)}
|
||||
onClick={onReveal}
|
||||
aria-label={localize(showFailedKey, { 0: String(count), 1: String(total) })}
|
||||
data-severity={severe ? 'failed' : 'mixed'}
|
||||
data-testid="failed-reveal-pill"
|
||||
>
|
||||
<TriangleAlert size={12} aria-hidden="true" />
|
||||
{localize('com_ui_n_of_n_actions_failed', { 0: String(count), 1: String(total) })}
|
||||
</button>
|
||||
<CircleX size={12} className="text-status-error" aria-hidden="true" />
|
||||
<span className={severe ? 'text-status-error' : 'text-text-secondary'}>
|
||||
{localize('com_ui_n_actions_failed', { 0: String(count) })}
|
||||
</span>
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ import { ChevronUp, ChevronDown } from 'lucide-react';
|
|||
import { ContentTypes } from 'librechat-data-provider';
|
||||
import { pxToRem, useRemScale } from '@librechat/client';
|
||||
import type { TMessage, TMessageContentParts } from 'librechat-data-provider';
|
||||
import type { TranslationKeys } from '~/hooks';
|
||||
import { useMessagesConversation, useMessagesSubmission } from '~/Providers';
|
||||
import { parseWakeupMessage } from './Content/Parts/wakeup';
|
||||
import { useGetMessagesByConvoId } from '~/data-provider';
|
||||
import { useLocalize } from '~/hooks';
|
||||
import { cn } from '~/utils';
|
||||
|
|
@ -12,6 +14,7 @@ import { cn } from '~/utils';
|
|||
type MessageEntry = {
|
||||
id: string;
|
||||
isUser: boolean;
|
||||
isSystem?: boolean;
|
||||
preview: string;
|
||||
isEnd?: boolean;
|
||||
isStart?: boolean;
|
||||
|
|
@ -65,6 +68,9 @@ function rowText(node: HTMLElement): string {
|
|||
}
|
||||
|
||||
export function buildEntry(id: string, msg: TMessage, node?: HTMLElement): MessageEntry {
|
||||
const isSystem =
|
||||
node?.querySelector('[data-system-turn]') != null ||
|
||||
parseWakeupMessage(msg)?.kind === 'background_tool';
|
||||
const raw = msg.text?.trim() ? msg.text : extractPreviewFromContent(msg.content);
|
||||
const trimmed = raw.trim();
|
||||
/** Image-, tool-call- and reasoning-only messages carry no text part at all,
|
||||
|
|
@ -74,7 +80,8 @@ export function buildEntry(id: string, msg: TMessage, node?: HTMLElement): Messa
|
|||
const preview = trimmed === '' && node ? rowText(node) : trimmed;
|
||||
return {
|
||||
id,
|
||||
isUser: !!msg.isCreatedByUser,
|
||||
isUser: !!msg.isCreatedByUser && !isSystem,
|
||||
...(isSystem && { isSystem: true }),
|
||||
preview: truncatePreview(preview),
|
||||
};
|
||||
}
|
||||
|
|
@ -106,6 +113,7 @@ export function buildFallbackEntry(node: HTMLElement, id: string): MessageEntry
|
|||
return {
|
||||
id,
|
||||
isUser,
|
||||
...(node.querySelector('[data-system-turn]') != null && { isSystem: true }),
|
||||
preview: truncatePreview(rowText(node)),
|
||||
};
|
||||
}
|
||||
|
|
@ -1654,10 +1662,15 @@ function MessageNav({ scrollableRef }: { scrollableRef: React.RefObject<HTMLDivE
|
|||
className="hide-scrollbar relative flex min-h-0 w-14 cursor-pointer touch-none flex-col items-stretch gap-1.5 overflow-y-auto select-none [&::-webkit-scrollbar]:hidden"
|
||||
>
|
||||
{messageEntries.map((entry) => {
|
||||
const label = localize(
|
||||
entry.isUser ? 'com_ui_message_nav_go_to_user' : 'com_ui_message_nav_go_to_assistant',
|
||||
{ 0: previewTextFor(entry, localize, entry.id === pendingId).slice(0, 30) },
|
||||
);
|
||||
let labelKey: TranslationKeys = entry.isUser
|
||||
? 'com_ui_message_nav_go_to_user'
|
||||
: 'com_ui_message_nav_go_to_assistant';
|
||||
if (entry.isSystem) {
|
||||
labelKey = 'com_ui_message_nav_go_to_system';
|
||||
}
|
||||
const label = localize(labelKey, {
|
||||
0: previewTextFor(entry, localize, entry.id === pendingId).slice(0, 30),
|
||||
});
|
||||
return (
|
||||
<MessageIndicator
|
||||
key={entry.id}
|
||||
|
|
|
|||
|
|
@ -2517,3 +2517,26 @@ describe('MessageNav', () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('classifies a host-authored background wake-up as System navigation', () => {
|
||||
const text =
|
||||
'A background tool task has finished. Continue using its durable result below.\n' +
|
||||
JSON.stringify([
|
||||
{
|
||||
background_task_id: 'task',
|
||||
tool_call_id: 'call',
|
||||
tool: 'bash_tool',
|
||||
status: 'completed',
|
||||
result: 'done',
|
||||
},
|
||||
]);
|
||||
const entry = buildEntry('system', asTMessage(buildMessage({ text, isCreatedByUser: true })));
|
||||
expect(entry).toMatchObject({ isUser: false, isSystem: true });
|
||||
});
|
||||
|
||||
it('classifies a DOM-only System row separately from assistant navigation', () => {
|
||||
const node = document.createElement('div');
|
||||
node.innerHTML =
|
||||
'<div data-system-turn="true"><div data-testid="message-body">Task finished</div></div>';
|
||||
expect(buildFallbackEntry(node, 'system')).toMatchObject({ isSystem: true });
|
||||
});
|
||||
|
|
|
|||
|
|
@ -161,6 +161,8 @@ const MessageRender = memo(function MessageRender({
|
|||
const subagentWakeup =
|
||||
!edit && wakeupDisplay?.kind === 'subagent' ? wakeupDisplay.tasks[0] : undefined;
|
||||
const Row = subagentWakeup == null ? MessageRow : WakeupRow;
|
||||
const isUserSide =
|
||||
msg.isCreatedByUser === true && (edit || wakeupDisplay == null || subagentWakeup != null);
|
||||
|
||||
return (
|
||||
<Row
|
||||
|
|
@ -189,7 +191,7 @@ const MessageRender = memo(function MessageRender({
|
|||
: undefined
|
||||
}
|
||||
footer={
|
||||
<SubRow classes={cn(messageFooterClasses, msg.isCreatedByUser && 'justify-end')}>
|
||||
<SubRow classes={cn(messageFooterClasses, isUserSide && 'justify-end')}>
|
||||
{/* The reading holds the column start: it takes over the slot the streaming
|
||||
dot vacates, so the retry navigation beside it — whose width the footer
|
||||
reserves whether or not hover has revealed it — must never push the
|
||||
|
|
@ -212,7 +214,7 @@ const MessageRender = memo(function MessageRender({
|
|||
siblingCount={siblingCount}
|
||||
setSiblingIdx={setSiblingIdx}
|
||||
className={cn(
|
||||
msg.isCreatedByUser === true && 'order-last',
|
||||
isUserSide && 'order-last',
|
||||
isSubmitting && isLatestMessage && revealOnRowHoverClasses,
|
||||
)}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ type MessageRowProps = {
|
|||
fullWidth?: boolean;
|
||||
isEditing?: boolean;
|
||||
/** Marks a host-authored turn with no author to name (background-tool
|
||||
* wake-ups, external events): it keeps the user's position and bubble shape,
|
||||
* outlined instead of filled, under this visible heading. */
|
||||
* wake-ups, external events): it uses the transcript side without a bubble,
|
||||
* under this visible heading. */
|
||||
systemLabel?: string;
|
||||
/** A user-side turn written by someone other than the reader — a parent agent
|
||||
* briefing its subagent, a subagent reporting back. It keeps the user's
|
||||
|
|
@ -28,7 +28,7 @@ type MessageRowProps = {
|
|||
* carries. */
|
||||
showAuthor?: boolean;
|
||||
/** Outline the user-side bubble instead of filling it: content the host
|
||||
* delivered rather than words someone typed. Implied by `systemLabel`. */
|
||||
* delivered rather than words someone typed. */
|
||||
outlined?: boolean;
|
||||
className?: string;
|
||||
};
|
||||
|
|
@ -109,7 +109,7 @@ export default function MessageRow({
|
|||
// up with the composer surface rather than the form's outer box.
|
||||
const widthClass = getMessageRowWidthClass({ fullWidth, hasParallelContent });
|
||||
const isSystem = systemLabel != null && systemLabel !== '';
|
||||
const isUserSide = isCreatedByUser || isSystem;
|
||||
const isUserSide = isCreatedByUser && !isSystem;
|
||||
|
||||
return (
|
||||
<div
|
||||
|
|
@ -125,9 +125,11 @@ export default function MessageRow({
|
|||
)}
|
||||
>
|
||||
<div
|
||||
data-system-turn={isSystem || undefined}
|
||||
className={cn(
|
||||
'relative flex min-w-0 flex-col',
|
||||
isUserSide ? 'user-turn' : 'agent-turn',
|
||||
isUserSide && 'user-turn',
|
||||
!isUserSide && !isSystem && 'agent-turn',
|
||||
(hasParallelContent || isEditing) && 'w-full',
|
||||
!hasParallelContent &&
|
||||
isUserSide &&
|
||||
|
|
@ -136,7 +138,7 @@ export default function MessageRow({
|
|||
)}
|
||||
>
|
||||
{isSystem && (
|
||||
<h2 className="text-text-secondary mb-1 flex items-center gap-1.5 pr-1.5 text-xs font-medium tracking-wide uppercase select-none">
|
||||
<h2 className="text-text-secondary mb-1 flex items-center gap-1.5 pr-1.5 text-xs font-medium select-none">
|
||||
<Zap size={12} aria-hidden="true" />
|
||||
{systemLabel}
|
||||
<span className="sr-only">
|
||||
|
|
|
|||
|
|
@ -65,7 +65,9 @@ jest.mock('~/components/Chat/Messages/HoverButtons', () => ({
|
|||
}));
|
||||
jest.mock('~/components/Chat/Messages/SiblingSwitch', () => ({
|
||||
__esModule: true,
|
||||
default: () => null,
|
||||
default: ({ className }: { className?: string }) => (
|
||||
<span data-testid="sibling-footer" className={className} />
|
||||
),
|
||||
}));
|
||||
jest.mock('~/components/Chat/Messages/ui/MessageTimestamp', () => ({
|
||||
__esModule: true,
|
||||
|
|
@ -363,3 +365,12 @@ it('uses the validated spawning lane for a private self wake-up', () => {
|
|||
expect(screen.getByRole('heading', { name: 'Code Reviewer' })).toBeInTheDocument();
|
||||
expect(screen.getByTestId('author-face')).toHaveAttribute('data-agent', 'Code Reviewer');
|
||||
});
|
||||
|
||||
it('aligns a System event footer with its transcript body', () => {
|
||||
renderMessage(backgroundWakeup);
|
||||
expect(screen.getByTestId('sibling-footer').parentElement).not.toHaveClass('justify-end');
|
||||
});
|
||||
it('does not reorder System sibling controls to the user edge', () => {
|
||||
renderMessage(backgroundWakeup);
|
||||
expect(screen.getByTestId('sibling-footer')).not.toHaveClass('order-last');
|
||||
});
|
||||
|
|
|
|||
|
|
@ -49,22 +49,37 @@ const renderRow = ({
|
|||
);
|
||||
|
||||
describe('MessageRow', () => {
|
||||
it('renders a system row on the user side as an outlined bubble under a visible heading', () => {
|
||||
it('renders a system row in the transcript under a visible heading', () => {
|
||||
renderRow({ isCreatedByUser: true, systemLabel: 'System' });
|
||||
|
||||
const row = screen.getByLabelText('User message');
|
||||
const messageSurface = screen.getByText(MESSAGE_BODY).parentElement;
|
||||
const heading = screen.getByRole('heading', { name: 'System' });
|
||||
|
||||
expect(row).toHaveClass('justify-end');
|
||||
expect(row.querySelector('.user-turn')).toHaveClass('items-end');
|
||||
expect(messageSurface).toHaveClass('border', 'border-border-medium', 'rounded-theme-surface');
|
||||
expect(row).toHaveClass('items-start');
|
||||
expect(row.querySelector('[data-system-turn]')).not.toHaveClass('items-end');
|
||||
expect(messageSurface).toHaveClass('w-full');
|
||||
expect(messageSurface).not.toHaveClass('bg-surface-user-message');
|
||||
expect(heading).not.toHaveClass('sr-only');
|
||||
expect(screen.queryByText('You')).not.toBeInTheDocument();
|
||||
expect(screen.getByTestId('message-actions')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('excludes System output from the assistant code shortcut selector', () => {
|
||||
renderRow({ isCreatedByUser: true, systemLabel: 'System' });
|
||||
expect(screen.getByLabelText('User message').querySelector('.agent-turn')).toBeNull();
|
||||
});
|
||||
|
||||
it('keeps System events on the transcript side', () => {
|
||||
renderRow({ isCreatedByUser: true, systemLabel: 'System' });
|
||||
expect(screen.getByLabelText('User message')).not.toHaveClass('justify-end');
|
||||
});
|
||||
|
||||
it('does not wrap System content in a user bubble', () => {
|
||||
renderRow({ isCreatedByUser: true, systemLabel: 'System' });
|
||||
expect(screen.getByTestId('message-body')).not.toHaveClass('border');
|
||||
});
|
||||
|
||||
it('names another author of a user-side turn with the agent header, mirrored', () => {
|
||||
renderRow({ isCreatedByUser: true, showAuthor: true });
|
||||
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ describe('SubagentConversation', () => {
|
|||
expect(screen.getAllByTestId('child-face')).toHaveLength(2);
|
||||
expect(screen.getByTestId('thinking-cursor')).toHaveAttribute('data-under-header-icon', 'true');
|
||||
expect(container.querySelectorAll('.message-render')).toHaveLength(4);
|
||||
expect(container.querySelectorAll('.user-turn')).toHaveLength(2);
|
||||
expect(container.querySelectorAll('.user-turn')).toHaveLength(1);
|
||||
expect(container.querySelectorAll('.agent-turn')).toHaveLength(2);
|
||||
expect(container.querySelector('[data-subagent-conversation]')).toBeInTheDocument();
|
||||
expect(screen.queryByText('com_ui_prompt')).not.toBeInTheDocument();
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ function ExternalEventTrigger({
|
|||
body = (
|
||||
<Collapsible open={expanded} onOpenChange={setExpanded}>
|
||||
<CollapsibleTrigger asChild>
|
||||
<Button type="button" variant="ghost" className={systemEventHeaderClasses}>
|
||||
<Button type="button" variant="disclosure" className={systemEventHeaderClasses}>
|
||||
<SystemEventHeader
|
||||
icon={<ExternalEventIcon />}
|
||||
label={label}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ export default function Message(props: TMessageProps) {
|
|||
const messageLabel = isCreatedByUser ? localize('com_ui_user') : (message.sender ?? '');
|
||||
const subagentWakeup = wakeupDisplay?.kind === 'subagent' ? wakeupDisplay.tasks[0] : undefined;
|
||||
const Row = subagentWakeup == null ? MessageRow : WakeupRow;
|
||||
const isUserSide = isCreatedByUser && (wakeupDisplay == null || subagentWakeup != null);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
@ -81,7 +82,7 @@ export default function Message(props: TMessageProps) {
|
|||
}
|
||||
className="final-completion"
|
||||
footer={
|
||||
<SubRow classes={isCreatedByUser ? 'justify-end text-xs' : 'text-xs'}>
|
||||
<SubRow classes={isUserSide ? 'justify-end text-xs' : 'text-xs'}>
|
||||
<SiblingSwitch
|
||||
siblingIdx={siblingIdx}
|
||||
siblingCount={siblingCount}
|
||||
|
|
|
|||
|
|
@ -1409,6 +1409,7 @@
|
|||
"com_ui_command_placeholder": "Optional: Enter a command for the prompt or name will be used",
|
||||
"com_ui_command_terminated": "terminated by {{0}}",
|
||||
"com_ui_command_timed_out": "timed out",
|
||||
"com_ui_command_timeout_note": "Time limit reached. Output may be incomplete.",
|
||||
"com_ui_command_usage_placeholder": "Select a Prompt by command or name",
|
||||
"com_ui_complete": "Complete!",
|
||||
"com_ui_complete_setup": "Complete Setup",
|
||||
|
|
@ -2285,6 +2286,7 @@
|
|||
"com_ui_message_model": "Model: {{0}}",
|
||||
"com_ui_message_nav": "Message navigation",
|
||||
"com_ui_message_nav_go_to_assistant": "Go to assistant message: {{0}}",
|
||||
"com_ui_message_nav_go_to_system": "Go to System event: {{0}}",
|
||||
"com_ui_message_nav_go_to_user": "Go to user message: {{0}}",
|
||||
"com_ui_message_nav_next": "Navigate to next message",
|
||||
"com_ui_message_nav_no_preview": "No preview",
|
||||
|
|
@ -2308,6 +2310,7 @@
|
|||
"com_ui_my_prompts": "My Prompts",
|
||||
"com_ui_my_skills": "My Skills",
|
||||
"com_ui_n_actions_cancelled": "{{0}} cancelled",
|
||||
"com_ui_n_actions_failed": "{{0}} failed",
|
||||
"com_ui_n_of_n_actions_failed": "{{0}}/{{1}} failed",
|
||||
"com_ui_n_files": "{{0}} files",
|
||||
"com_ui_n_files_changed": "{{0}} files changed",
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ async function headerLine(page: Page): Promise<string | null> {
|
|||
}
|
||||
|
||||
test.describe('live reasoning', () => {
|
||||
test('previews finished sentences and the thought peek, then titles the open card', async ({
|
||||
test('previews finished sentences without exposing a hidden Thoughts preview', async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(120000);
|
||||
|
|
@ -68,7 +68,7 @@ test.describe('live reasoning', () => {
|
|||
for (const line of lines) {
|
||||
expect(line, `header line "${line}"`).toMatch(/^(Thinking\.\.\.|Thinking…|.+[.!?])$/);
|
||||
}
|
||||
expect(peekSeen, 'thought peek under the collapsed card').toBe(true);
|
||||
expect(peekSeen, 'no thought peek without the visible Thoughts header').toBe(false);
|
||||
|
||||
await expect(messagesView(page).getByText(finalText)).toBeVisible({ timeout: 60000 });
|
||||
/** The settled thought's header sits at the shared row scale. */
|
||||
|
|
|
|||
|
|
@ -37,19 +37,19 @@ async function peekSamples(page: Page, finalText: string) {
|
|||
}
|
||||
|
||||
test.describe('streaming thought peek', () => {
|
||||
test('the peek shows only while pure reasoning streams @scenario:thought-peek-only-while-thinking', async ({
|
||||
test('the peek stays hidden when the Thoughts row is folded @scenario:thought-peek-only-while-thinking', async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(180000);
|
||||
|
||||
/** Pure reasoning: the peek sits under the collapsed card. */
|
||||
/** Pure reasoning: the Thoughts row is inside the collapsed card. */
|
||||
const reasoning = uniqueLabel();
|
||||
await page.goto(NEW_CHAT_PATH, { timeout: 10000 });
|
||||
await selectMockEndpoint(page, ENDPOINT);
|
||||
const first = await sendMessage(page, `E2E_SLOW_THINK_REPLY:${reasoning}`);
|
||||
expect(first.ok()).toBeTruthy();
|
||||
const pure = await peekSamples(page, `E2E slow think reply done ${reasoning}`);
|
||||
expect(pure.visible, 'peek during pure reasoning').toBeGreaterThan(0);
|
||||
expect(pure.visible, 'no peek under a collapsed phase').toBe(0);
|
||||
await expect(
|
||||
messagesView(page).getByText(`E2E slow think reply done ${reasoning}`),
|
||||
).toBeVisible({ timeout: 60000 });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue