@steerable/agent-ui 0.14.3 → 0.14.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -78,12 +78,16 @@ export const ToolExecutionCard = ({ payload, className, defaultExpanded = false,
78
78
  const resolvedSummaryTitle = summaryTitle ?? (payload.summary ? payload.summary : undefined);
79
79
  const isQuietSucceeded = quietSuccess && status === 'succeeded';
80
80
  const hideStatusWord = (compactStatus || quietSuccess) && status === 'succeeded';
81
+ const statusLabel = mergedLabels[status];
82
+ const titleText = typeof title === 'string' ? title.trim() : '';
83
+ const titleAlreadyHasStatus = titleText.length > 0 &&
84
+ (titleText.includes(statusLabel) || /\bdone$/i.test(titleText));
81
85
  const hasTrailingMeta = trailingMeta !== undefined && trailingMeta !== null && trailingMeta !== false;
82
86
  const buttonInteractiveClass = isGhost ? `${INTERACTIVE_BUTTON} rounded-md` : INTERACTIVE_BUTTON;
83
87
  const rowHorizontalPad = isGhost ? 'pl-1.5 pr-2' : 'pl-2.5 pr-2.5';
84
88
  const bodyCells = (_jsxs(_Fragment, { children: [lead !== undefined ? (lead) : (_jsx(ZapIcon, { size: 12, className: "shrink-0 text-[var(--agent-muted-foreground,#4b5563)]" })), _jsx("span", { className: `shrink-0 font-medium ${hasSummary
85
89
  ? 'text-[var(--agent-muted-foreground,#4b5563)]'
86
- : 'text-[var(--agent-foreground,#111827)]'}`, children: title }), badge, payload.summary && (_jsx("span", { className: `min-w-0 flex-1 truncate ${summaryClassName ?? 'text-[var(--agent-foreground,#111827)]'}`, title: resolvedSummaryTitle, children: payload.summary })), hasTrailingMeta ? (_jsx("span", { className: `${hasSummary ? '' : 'ml-auto '}inline-flex shrink-0 items-center whitespace-nowrap`, children: trailingMeta })) : null, isQuietSucceeded && !note ? (_jsx("span", { className: "sr-only", children: mergedLabels.succeeded })) : (_jsxs("span", { className: `${hasSummary || hasTrailingMeta ? '' : 'ml-auto '}inline-flex shrink-0 items-center gap-1 whitespace-nowrap`, children: [!isQuietSucceeded && _jsx(StatusIcon, { status: status }), _jsx("span", { className: hideStatusWord ? 'sr-only' : STATUS_TONE[status], children: mergedLabels[status] }), !isQuietSucceeded && duration && (_jsx("span", { className: "tabular-nums text-[var(--agent-muted-foreground,#4b5563)]", children: hideStatusWord ? duration : `· ${duration}` })), note && (_jsx("span", { className: "tabular-nums text-[var(--agent-muted-foreground,#4b5563)]", children: note }))] }))] }));
90
+ : 'text-[var(--agent-foreground,#111827)]'}`, children: title }), badge, payload.summary && (_jsx("span", { className: `min-w-0 flex-1 truncate ${summaryClassName ?? 'text-[var(--agent-foreground,#111827)]'}`, title: resolvedSummaryTitle, children: payload.summary })), hasTrailingMeta ? (_jsx("span", { className: `${hasSummary ? '' : 'ml-auto '}inline-flex shrink-0 items-center whitespace-nowrap`, children: trailingMeta })) : null, isQuietSucceeded && !note ? (titleAlreadyHasStatus ? null : _jsx("span", { className: "sr-only", children: mergedLabels.succeeded })) : (_jsxs("span", { className: `${hasSummary || hasTrailingMeta ? '' : 'ml-auto '}inline-flex shrink-0 items-center gap-1 whitespace-nowrap`, children: [!isQuietSucceeded && _jsx(StatusIcon, { status: status }), !(hideStatusWord && titleAlreadyHasStatus) && (_jsx("span", { className: hideStatusWord ? 'sr-only' : STATUS_TONE[status], children: statusLabel })), !isQuietSucceeded && duration && (_jsx("span", { className: "tabular-nums text-[var(--agent-muted-foreground,#4b5563)]", children: hideStatusWord ? duration : `· ${duration}` })), note && (_jsx("span", { className: "tabular-nums text-[var(--agent-muted-foreground,#4b5563)]", children: note }))] }))] }));
87
91
  const surfaceClass = resolvedVariant === 'ghost'
88
92
  ? ''
89
93
  : resolvedVariant === 'embedded'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steerable/agent-ui",
3
- "version": "0.14.3",
3
+ "version": "0.14.5",
4
4
  "description": "Steerable framework Tier 4 — headless React hooks (useAgentSession, useChatStream, useToolCallStatus) and Tailwind-themed components (ChatPanel, MessageList, OrchestrationPlanCard, ToolCallRenderer, SSEStreamView) for embedding Steerable agents in any React app.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://steerableframework.com/storybook/",
@@ -57,7 +57,7 @@
57
57
  "README.md"
58
58
  ],
59
59
  "dependencies": {
60
- "@steerable/agent-protocol": "0.14.3"
60
+ "@steerable/agent-protocol": "0.14.5"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "react": ">=18.0.0",
@@ -181,6 +181,11 @@ export const ToolExecutionCard: React.FC<ToolExecutionCardProps> = ({
181
181
  const resolvedSummaryTitle = summaryTitle ?? (payload.summary ? payload.summary : undefined);
182
182
  const isQuietSucceeded = quietSuccess && status === 'succeeded';
183
183
  const hideStatusWord = (compactStatus || quietSuccess) && status === 'succeeded';
184
+ const statusLabel = mergedLabels[status];
185
+ const titleText = typeof title === 'string' ? title.trim() : '';
186
+ const titleAlreadyHasStatus =
187
+ titleText.length > 0 &&
188
+ (titleText.includes(statusLabel) || /\bdone$/i.test(titleText));
184
189
  const hasTrailingMeta = trailingMeta !== undefined && trailingMeta !== null && trailingMeta !== false;
185
190
  const buttonInteractiveClass = isGhost ? `${INTERACTIVE_BUTTON} rounded-md` : INTERACTIVE_BUTTON;
186
191
  const rowHorizontalPad = isGhost ? 'pl-1.5 pr-2' : 'pl-2.5 pr-2.5';
@@ -220,7 +225,7 @@ export const ToolExecutionCard: React.FC<ToolExecutionCardProps> = ({
220
225
  </span>
221
226
  ) : null}
222
227
  {isQuietSucceeded && !note ? (
223
- <span className="sr-only">{mergedLabels.succeeded}</span>
228
+ titleAlreadyHasStatus ? null : <span className="sr-only">{mergedLabels.succeeded}</span>
224
229
  ) : (
225
230
  <span
226
231
  className={`${
@@ -228,9 +233,11 @@ export const ToolExecutionCard: React.FC<ToolExecutionCardProps> = ({
228
233
  }inline-flex shrink-0 items-center gap-1 whitespace-nowrap`}
229
234
  >
230
235
  {!isQuietSucceeded && <StatusIcon status={status} />}
231
- <span className={hideStatusWord ? 'sr-only' : STATUS_TONE[status]}>
232
- {mergedLabels[status]}
233
- </span>
236
+ {!(hideStatusWord && titleAlreadyHasStatus) && (
237
+ <span className={hideStatusWord ? 'sr-only' : STATUS_TONE[status]}>
238
+ {statusLabel}
239
+ </span>
240
+ )}
234
241
  {!isQuietSucceeded && duration && (
235
242
  <span className="tabular-nums text-[var(--agent-muted-foreground,#4b5563)]">
236
243
  {hideStatusWord ? duration : `· ${duration}`}
@@ -705,6 +705,49 @@ describe('ToolExecutionCard', () => {
705
705
  expect(screen.getByText('Failed')).toBeTruthy();
706
706
  expect(screen.getByText(/1\.4s/)).toBeTruthy();
707
707
  });
708
+
709
+ it('T-UI-01 omits duplicate sr-only status word when label already includes completion status', () => {
710
+ const { container, rerender } = render(
711
+ <ToolExecutionCard
712
+ variant="ghost"
713
+ quietSuccess
714
+ label="更新待办 · 5/5 已完成"
715
+ labels={{ succeeded: '已完成' }}
716
+ payload={{
717
+ id: 't-todo-zh',
718
+ name: 'todo_write',
719
+ status: 'succeeded',
720
+ summary: '',
721
+ args: null,
722
+ output: null,
723
+ error: null,
724
+ icon: null,
725
+ expandable: true,
726
+ }}
727
+ />,
728
+ );
729
+ expect(container.querySelector('.sr-only')).toBeNull();
730
+
731
+ rerender(
732
+ <ToolExecutionCard
733
+ variant="ghost"
734
+ quietSuccess
735
+ label="Update todos · 5/5 done"
736
+ payload={{
737
+ id: 't-todo-en',
738
+ name: 'todo_write',
739
+ status: 'succeeded',
740
+ summary: '',
741
+ args: null,
742
+ output: null,
743
+ error: null,
744
+ icon: null,
745
+ expandable: true,
746
+ }}
747
+ />,
748
+ );
749
+ expect(container.querySelector('.sr-only')).toBeNull();
750
+ });
708
751
  });
709
752
 
710
753
  describe('ActionSegmentCard', () => {