tfy-web-components 0.0.22 → 0.0.23

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.
@@ -1,18 +1,210 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
1
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import { c as classNames } from "../../classNames-Dy-RXSjS.js";
3
3
  import { t as toDataTestId } from "../../Notification-BT4CZ69U.js";
4
+ import IconProvider from "../atoms/IconProvider.es.js";
5
+ import Spinner from "../atoms/Spinner.es.js";
4
6
  import { Button } from "../atoms/Button.es.js";
5
7
  import IconButton from "../atoms/IconButton.es.js";
6
- import IconProvider from "../atoms/IconProvider.es.js";
7
8
  import OutlinedRadio from "../atoms/OutlinedRadio.es.js";
8
9
  import { I as Input, M as Markdown, C as CopyField } from "../../Input-CnGhA18d.js";
9
- import { Accordion, AccordionSummary, AccordionDetails } from "../atoms/Accordion.es.js";
10
- import Spinner from "../atoms/Spinner.es.js";
11
10
  import Badge from "../atoms/Badge.es.js";
12
11
  import SimpleCodeEditor from "./SimpleCodeEditor.es.js";
13
12
  import ToggleButton from "./ToggleButton.es.js";
14
13
  import { default as default2 } from "./agent-chat/UserMessage.es.js";
15
14
  import { default as default3 } from "./agent-chat/UserMessageEdit.es.js";
15
+ const StatusDot = ({ className, colorClassName = "bg-orange-500" }) => {
16
+ return /* @__PURE__ */ jsxs("span", { "aria-hidden": true, className: classNames("relative inline-flex h-2 w-2 shrink-0", className), children: [
17
+ /* @__PURE__ */ jsx(
18
+ "span",
19
+ {
20
+ className: classNames(
21
+ "pointer-events-none absolute inline-flex h-full w-full rounded-full opacity-75 motion-safe:animate-ping motion-reduce:animate-none",
22
+ colorClassName
23
+ )
24
+ }
25
+ ),
26
+ /* @__PURE__ */ jsx("span", { className: classNames("relative inline-flex h-2 w-2 rounded-full", colorClassName) })
27
+ ] });
28
+ };
29
+ const StepIconBox = ({
30
+ icon,
31
+ iconSize = 0.875,
32
+ variant = "primary",
33
+ className,
34
+ iconClassName
35
+ }) => {
36
+ return /* @__PURE__ */ jsx(
37
+ "div",
38
+ {
39
+ className: classNames(
40
+ "flex items-center justify-center size-6 rounded shrink-0 bg-indigo-50 dark:bg-indigo-900",
41
+ className
42
+ ),
43
+ children: /* @__PURE__ */ jsx(
44
+ IconProvider,
45
+ {
46
+ icon,
47
+ size: iconSize,
48
+ className: classNames(
49
+ {
50
+ "text-indigo-600 dark:text-indigo-400": variant === "primary",
51
+ "text-gray-600 dark:text-gray-400": variant === "muted"
52
+ },
53
+ iconClassName
54
+ )
55
+ }
56
+ )
57
+ }
58
+ );
59
+ };
60
+ const AgentStepRow = ({
61
+ icon,
62
+ iconVariant = "primary",
63
+ iconClassName,
64
+ iconSize,
65
+ title,
66
+ label,
67
+ body,
68
+ expandable = false,
69
+ expanded = false,
70
+ onToggle,
71
+ status = "idle",
72
+ statusText,
73
+ showSpinner = false,
74
+ showConnector = false,
75
+ showContentConnector = true,
76
+ showPersistentContentConnector = true,
77
+ showChevronColumn = true,
78
+ children,
79
+ persistentChildren,
80
+ dataTestPrefix,
81
+ className
82
+ }) => {
83
+ const hasChildren = !!children;
84
+ const hasPersistentChildren = !!persistentChildren;
85
+ const showExpandChevron = expandable && onToggle;
86
+ const isRunning = status === "running";
87
+ const isSuccess = status === "success";
88
+ const isError = status === "error";
89
+ return /* @__PURE__ */ jsxs(
90
+ "div",
91
+ {
92
+ className: classNames("flex flex-col min-w-0", className),
93
+ "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "step-row"),
94
+ children: [
95
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-start", children: [
96
+ showChevronColumn && (showExpandChevron ? /* @__PURE__ */ jsx(
97
+ "div",
98
+ {
99
+ className: "flex items-center justify-center w-5 h-6 shrink-0 cursor-pointer",
100
+ onClick: onToggle,
101
+ "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "chevron"),
102
+ children: /* @__PURE__ */ jsx(
103
+ IconProvider,
104
+ {
105
+ icon: "chevron-right",
106
+ size: 0.625,
107
+ className: classNames(
108
+ "text-gray-600 transition-transform duration-300 shrink-0",
109
+ expanded && "rotate-90"
110
+ )
111
+ }
112
+ )
113
+ }
114
+ ) : /* @__PURE__ */ jsx("div", { className: "w-5 shrink-0" })),
115
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center shrink-0", children: [
116
+ /* @__PURE__ */ jsx(StepIconBox, { icon, variant: iconVariant, iconClassName, iconSize }),
117
+ showConnector && (expanded && hasChildren || hasPersistentChildren) && /* @__PURE__ */ jsx("div", { className: "w-px flex-1 bg-gray-300 dark:bg-gray-275 mt-1" })
118
+ ] }),
119
+ /* @__PURE__ */ jsxs(
120
+ "div",
121
+ {
122
+ className: classNames("flex-1 min-w-0 flex flex-col", {
123
+ "cursor-pointer": showExpandChevron
124
+ }),
125
+ onClick: showExpandChevron ? onToggle : void 0,
126
+ children: [
127
+ label && /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-500 font-sans", children: label }),
128
+ title && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 min-w-0", children: [
129
+ /* @__PURE__ */ jsx(
130
+ "span",
131
+ {
132
+ className: "text-sm font-medium text-gray-750 dark:text-gray-200 font-sans",
133
+ "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "title"),
134
+ children: title
135
+ }
136
+ ),
137
+ isSuccess && /* @__PURE__ */ jsx(
138
+ IconProvider,
139
+ {
140
+ icon: ["far", "check-circle"],
141
+ size: 0.875,
142
+ className: "text-green-600 dark:text-green-500 shrink-0",
143
+ "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "success-icon")
144
+ }
145
+ )
146
+ ] }),
147
+ body && /* @__PURE__ */ jsx(
148
+ "div",
149
+ {
150
+ className: "text-sm text-gray-600 dark:text-gray-400 font-sans mt-1",
151
+ onClick: (e) => {
152
+ if (expanded && showExpandChevron) {
153
+ e.stopPropagation();
154
+ }
155
+ },
156
+ "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "body"),
157
+ children: body
158
+ }
159
+ )
160
+ ]
161
+ }
162
+ ),
163
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 shrink-0", children: [
164
+ statusText && /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", children: [
165
+ isRunning && /* @__PURE__ */ jsx(StatusDot, { colorClassName: "bg-orange-500" }),
166
+ /* @__PURE__ */ jsx("span", { className: "text-gray-750 dark:text-gray-300 text-xs font-medium leading-4 font-sans", children: statusText })
167
+ ] }),
168
+ !statusText && isRunning && /* @__PURE__ */ jsx(Fragment, { children: showSpinner ? /* @__PURE__ */ jsx("div", { className: "ml-1", children: /* @__PURE__ */ jsx(Spinner, {}) }) : /* @__PURE__ */ jsx(StatusDot, { colorClassName: "bg-orange-500" }) }),
169
+ isError && /* @__PURE__ */ jsx(
170
+ IconProvider,
171
+ {
172
+ icon: "circle-xmark",
173
+ size: 0.875,
174
+ className: "text-red-500",
175
+ "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "error-icon")
176
+ }
177
+ )
178
+ ] })
179
+ ] }),
180
+ expanded && hasChildren && /* @__PURE__ */ jsxs(
181
+ "div",
182
+ {
183
+ className: "flex gap-2 min-w-0 mt-2",
184
+ "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "expanded-content"),
185
+ children: [
186
+ showChevronColumn && /* @__PURE__ */ jsx("div", { className: "w-5 shrink-0" }),
187
+ showContentConnector && showConnector && /* @__PURE__ */ jsx("div", { className: "flex justify-center shrink-0 w-6", children: /* @__PURE__ */ jsx("div", { className: "w-px bg-gray-300 dark:bg-gray-275" }) }),
188
+ /* @__PURE__ */ jsx("div", { className: "flex-1 min-w-0", children })
189
+ ]
190
+ }
191
+ ),
192
+ hasPersistentChildren && /* @__PURE__ */ jsxs(
193
+ "div",
194
+ {
195
+ className: "flex gap-2 min-w-0",
196
+ "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "persistent-content"),
197
+ children: [
198
+ showChevronColumn && /* @__PURE__ */ jsx("div", { className: "w-5 shrink-0" }),
199
+ showPersistentContentConnector && showConnector && /* @__PURE__ */ jsx("div", { className: "flex justify-center shrink-0 w-6", children: /* @__PURE__ */ jsx("div", { className: "w-px bg-gray-300 dark:bg-gray-275" }) }),
200
+ /* @__PURE__ */ jsx("div", { className: "flex-1 min-w-0", children: persistentChildren })
201
+ ]
202
+ }
203
+ )
204
+ ]
205
+ }
206
+ );
207
+ };
16
208
  const ASK_USER_CUSTOM_OPTION = "__tfy_ask_user_question_custom__";
17
209
  const AskUserQuestionCard = ({
18
210
  questions,
@@ -198,7 +390,7 @@ const AssistantMessage = ({ children, error, actionBar, className }) => {
198
390
  {
199
391
  "data-slot": "aui_assistant-message-content",
200
392
  className: classNames(
201
- "text-foreground flex flex-col gap-3 px-2 leading-relaxed wrap-break-word",
393
+ "text-foreground flex flex-col gap-4 px-2 leading-relaxed wrap-break-word",
202
394
  "[contain-intrinsic-size:auto_24px] [content-visibility:auto]",
203
395
  className
204
396
  ),
@@ -208,14 +400,7 @@ const AssistantMessage = ({ children, error, actionBar, className }) => {
208
400
  ]
209
401
  }
210
402
  ),
211
- actionBar != null ? /* @__PURE__ */ jsx(
212
- "div",
213
- {
214
- "data-slot": "aui_assistant-message-footer",
215
- className: "ms-2 -mb-7.5 min-h-7.5 flex items-center pt-1.5",
216
- children: actionBar
217
- }
218
- ) : null
403
+ actionBar != null ? /* @__PURE__ */ jsx("div", { "data-slot": "aui_assistant-message-footer", className: "ms-2 -mb-7.5 min-h-7.5 flex items-center pt-1.5", children: actionBar }) : null
219
404
  ] });
220
405
  };
221
406
  const DEFAULT_TITLE = "MCP Authentication Required";
@@ -262,29 +447,6 @@ const McpAuthCard = ({
262
447
  }
263
448
  );
264
449
  };
265
- const ACCORDION_SX = {
266
- "& .MuiButtonBase-root": {
267
- cursor: "auto !important"
268
- }
269
- };
270
- const ACCORDION_SUMMARY_SX = {
271
- paddingY: 0,
272
- paddingLeft: 0,
273
- paddingRight: 0,
274
- minHeight: 0,
275
- margin: 0,
276
- justifyContent: "flex-start",
277
- gap: 1,
278
- "& .MuiAccordionSummary-content": {
279
- margin: 0,
280
- flex: "none"
281
- },
282
- alignItems: "center",
283
- "& .MuiAccordionSummary-expandIconWrapper": {
284
- marginTop: 0,
285
- marginRight: "0.5rem"
286
- }
287
- };
288
450
  const ReasoningCard = ({
289
451
  content,
290
452
  isStreaming = false,
@@ -299,68 +461,44 @@ const ReasoningCard = ({
299
461
  className
300
462
  }) => {
301
463
  const isShortText = !isStreaming && content.length > 0 && !isMultiLine;
464
+ const isExpandable = isMultiLine || isStreaming;
465
+ const status = isStreaming ? "running" : content.length > 0 ? "success" : "idle";
302
466
  if (isShortText) {
303
- return /* @__PURE__ */ jsxs("div", { className, "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "reasoning-inline"), children: [
304
- /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-600 font-sans", children: reasoningTimeText ?? "Reasoning" }),
305
- /* @__PURE__ */ jsxs("div", { className: "flex items-stretch gap-1.5 mt-1", children: [
306
- /* @__PURE__ */ jsx("div", { className: "w-px shrink-0 border-l-4 min-h-[1.875rem] border-l-blue-500" }),
307
- /* @__PURE__ */ jsx("div", { ref: contentRef, className: "flex flex-col text-gray-600 text-sm font-normal font-sans", children: /* @__PURE__ */ jsx(Markdown, { className: "flex flex-col text-gray-600 font-sans text-sm", children: content }) })
308
- ] })
309
- ] });
310
- }
311
- return /* @__PURE__ */ jsxs("div", { className, "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "reasoning-accordion"), children: [
312
- /* @__PURE__ */ jsxs(
313
- Accordion,
467
+ return /* @__PURE__ */ jsx("div", { className, "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "reasoning-inline"), children: /* @__PURE__ */ jsx(
468
+ AgentStepRow,
314
469
  {
315
- background: "transparent",
316
- borderColor: "transparent",
317
- expanded,
318
- onChange: () => onToggle == null ? void 0 : onToggle(),
319
- id: "reasoning-content",
320
- className: "!rounded-none !border-0 !m-0 !shadow-none cursor-auto",
321
- sx: ACCORDION_SX,
322
- children: [
323
- /* @__PURE__ */ jsx(AccordionSummary, { hideIcon: true, rightIcon: true, sx: ACCORDION_SUMMARY_SX, children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
324
- /* @__PURE__ */ jsxs("div", { className: classNames("flex items-center gap-2 hover:bg-gray-125 rounded-[1.25rem] -ml-2 p-2"), children: [
325
- /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-600 font-sans", children: headingText }),
326
- /* @__PURE__ */ jsx(IconProvider, { icon: "angles-up-down", className: "text-gray-500", size: 0.75 })
327
- ] }),
328
- isStreaming && !reasoningTimeText && /* @__PURE__ */ jsx("div", { className: "ml-1", children: /* @__PURE__ */ jsx(Spinner, {}) })
329
- ] }) }),
330
- /* @__PURE__ */ jsx(
331
- AccordionDetails,
332
- {
333
- sx: {
334
- padding: "0.5rem 0 0.5rem 0"
335
- },
336
- children: /* @__PURE__ */ jsx(
337
- "div",
338
- {
339
- className: classNames(
340
- "text-gray-15 text-sm border-l-4 pl-3 py-1 border-l-blue-500 font-normal leading-relaxed font-sans"
341
- ),
342
- children: /* @__PURE__ */ jsx(Markdown, { className: "flex flex-col text-gray-600 font-sans text-sm", children: content })
343
- }
344
- )
345
- }
346
- )
347
- ]
348
- }
349
- ),
350
- previewText && /* @__PURE__ */ jsxs(
351
- "div",
352
- {
353
- className: classNames(
354
- "flex items-stretch gap-3 mb-1 text-sm font-normal font-sans mt-1 transition-all duration-100 overflow-hidden",
355
- expanded ? "max-h-0 opacity-0" : "max-h-8 opacity-100"
470
+ icon: "brain-regular",
471
+ iconVariant: "primary",
472
+ label: reasoningTimeText ?? "Reasoning",
473
+ body: /* @__PURE__ */ jsx(
474
+ "div",
475
+ {
476
+ ref: contentRef,
477
+ className: "border-l-4 border-l-blue-500 pl-3 text-gray-600 dark:text-gray-400 text-sm font-normal font-sans",
478
+ children: /* @__PURE__ */ jsx(Markdown, { className: "text-gray-600 dark:text-gray-400 font-sans text-sm", children: content })
479
+ }
356
480
  ),
357
- children: [
358
- /* @__PURE__ */ jsx("div", { className: "w-1 shrink-0 bg-blue-500" }),
359
- /* @__PURE__ */ jsx("div", { className: "text-gray-600 text-sm font-normal font-sans truncate", children: previewText })
360
- ]
481
+ status,
482
+ expandable: false,
483
+ showChevronColumn: false,
484
+ dataTestPrefix
361
485
  }
362
- )
363
- ] });
486
+ ) });
487
+ }
488
+ return /* @__PURE__ */ jsx("div", { className, "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "reasoning-accordion"), children: /* @__PURE__ */ jsx(
489
+ AgentStepRow,
490
+ {
491
+ icon: isStreaming ? "brain" : "brain-regular",
492
+ iconVariant: "primary",
493
+ label: headingText,
494
+ body: expanded && content ? /* @__PURE__ */ jsx("div", { ref: contentRef, className: "border-l-4 border-l-blue-500 pl-3", children: /* @__PURE__ */ jsx(Markdown, { className: "text-gray-600 dark:text-gray-400 font-sans text-sm", children: content }) }) : !expanded && previewText ? /* @__PURE__ */ jsx("div", { className: "border-l-4 border-l-blue-500 pl-3 text-gray-600 dark:text-gray-400 text-sm font-normal font-sans truncate", children: previewText }) : void 0,
495
+ expandable: isExpandable,
496
+ expanded,
497
+ onToggle,
498
+ status,
499
+ dataTestPrefix
500
+ }
501
+ ) });
364
502
  };
365
503
  const EDITOR_VIEW_TYPES = {
366
504
  TERMINAL: {
@@ -502,20 +640,6 @@ const SandboxToolCall = ({
502
640
  }
503
641
  );
504
642
  };
505
- const StatusDot = ({ className, colorClassName = "bg-orange-500" }) => {
506
- return /* @__PURE__ */ jsxs("span", { "aria-hidden": true, className: classNames("relative inline-flex h-2 w-2 shrink-0", className), children: [
507
- /* @__PURE__ */ jsx(
508
- "span",
509
- {
510
- className: classNames(
511
- "pointer-events-none absolute inline-flex h-full w-full rounded-full opacity-75 motion-safe:animate-ping motion-reduce:animate-none",
512
- colorClassName
513
- )
514
- }
515
- ),
516
- /* @__PURE__ */ jsx("span", { className: classNames("relative inline-flex h-2 w-2 rounded-full", colorClassName) })
517
- ] });
518
- };
519
643
  const SubAgentCard = ({
520
644
  agentName,
521
645
  instruction = "",
@@ -529,82 +653,45 @@ const SubAgentCard = ({
529
653
  dataTestPrefix,
530
654
  className
531
655
  }) => {
532
- const messageLabel = `${stepCount} message${stepCount === 1 ? "" : "s"}`;
533
- const instructionContent = instruction.trim().length > 0 ? renderInstruction ? renderInstruction(instruction) : /* @__PURE__ */ jsx(Markdown, { className: "flex flex-col text-gray-600 font-sans text-sm", children: instruction }) : null;
656
+ const agentStatus = status === "running" ? "running" : status === "success" ? "success" : "error";
657
+ const instructionContent = instruction.trim().length > 0 ? renderInstruction ? renderInstruction(instruction) : /* @__PURE__ */ jsx(Markdown, { className: "flex flex-col text-gray-600 dark:text-gray-400 font-sans text-sm", children: instruction }) : null;
534
658
  return /* @__PURE__ */ jsx(
535
659
  "div",
536
660
  {
537
661
  className: classNames("min-w-0", className),
538
662
  "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "sub-agent-card"),
539
663
  children: /* @__PURE__ */ jsxs(
540
- Accordion,
664
+ AgentStepRow,
541
665
  {
542
- background: "transparent",
543
- borderColor: "var(--gateway-card-border, #e2e8f0)",
666
+ icon: "agent-2",
667
+ iconVariant: "primary",
668
+ title: `Sub-agent: ${agentName}`,
669
+ expandable: true,
544
670
  expanded,
545
- onChange: () => onToggle == null ? void 0 : onToggle(),
546
- className: "!m-0 !shadow-none",
547
- sx: {
548
- borderRadius: "0.5rem"
549
- },
671
+ onToggle,
672
+ status: agentStatus,
673
+ statusText: durationText,
674
+ dataTestPrefix,
550
675
  children: [
551
- /* @__PURE__ */ jsx(
552
- AccordionSummary,
553
- {
554
- hideIcon: true,
555
- disableRipple: true,
556
- sx: {
557
- padding: "0.625rem 0.75rem",
558
- minHeight: 0,
559
- "&.Mui-expanded": { minHeight: 0 },
560
- "&:hover": { backgroundColor: "transparent" },
561
- "& .MuiAccordionSummary-content": { margin: 0, width: "100%" }
562
- },
563
- children: /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center gap-2 text-left", children: [
564
- /* @__PURE__ */ jsx(IconProvider, { icon: "agent-2", size: 1, className: "text-indigo-500" }),
565
- /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-sm font-medium text-gray-900", children: agentName }),
566
- /* @__PURE__ */ jsxs("span", { className: "flex shrink-0 items-center gap-2", children: [
567
- durationText && /* @__PURE__ */ jsx("span", { className: "text-xs tabular-nums text-gray-500", children: durationText }),
568
- status === "running" && /* @__PURE__ */ jsx(StatusDot, {}),
569
- status === "success" && /* @__PURE__ */ jsx(IconProvider, { icon: ["far", "check-circle"], size: 0.75, className: "text-emerald-600" }),
570
- status === "error" && /* @__PURE__ */ jsx(IconProvider, { icon: "circle-xmark", size: 0.75, className: "text-red-600" }),
571
- /* @__PURE__ */ jsx("span", { className: "text-xs text-gray-500", children: messageLabel }),
572
- /* @__PURE__ */ jsx(
573
- IconProvider,
574
- {
575
- icon: "chevron-right",
576
- size: 0.625,
577
- className: classNames(
578
- "shrink-0 text-gray-500 transition-transform duration-200",
579
- expanded && "rotate-90"
580
- )
581
- }
582
- )
583
- ] })
584
- ] })
585
- }
586
- ),
587
- /* @__PURE__ */ jsx(AccordionDetails, { sx: { padding: "0 0.75rem 0.75rem" }, children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
588
- instructionContent != null && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 border border-gray-200 dark:border-gray-275 rounded-md p-2", children: [
589
- /* @__PURE__ */ jsx("h4", { className: "text-sm font-semibold text-gray-900", children: "Instructions" }),
590
- /* @__PURE__ */ jsx(
591
- "div",
592
- {
593
- className: "text-sm text-gray-600",
594
- "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "instructions"),
595
- children: instructionContent
596
- }
597
- )
598
- ] }),
599
- children != null && /* @__PURE__ */ jsx(
676
+ instructionContent != null && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 border border-gray-200 dark:border-gray-275 rounded-md p-2 mb-3", children: [
677
+ /* @__PURE__ */ jsx("h4", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100", children: "Instructions" }),
678
+ /* @__PURE__ */ jsx(
600
679
  "div",
601
680
  {
602
- className: "flex min-w-0 flex-col gap-3",
603
- "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "nested-content"),
604
- children
681
+ className: "text-sm text-gray-600 dark:text-gray-400",
682
+ "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "instructions"),
683
+ children: instructionContent
605
684
  }
606
685
  )
607
- ] }) })
686
+ ] }),
687
+ children != null && /* @__PURE__ */ jsx(
688
+ "div",
689
+ {
690
+ className: "flex min-w-0 flex-col gap-3",
691
+ "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "nested-content"),
692
+ children
693
+ }
694
+ )
608
695
  ]
609
696
  }
610
697
  )
@@ -640,23 +727,16 @@ const ToolApprovalBlock = ({
640
727
  const interactionsLocked = disabled && !isDecided;
641
728
  const headingText = isApproved ? "Tool Approved" : isDenied ? "Tool Approval Denied" : "Tool Approval Required for";
642
729
  return /* @__PURE__ */ jsxs("div", { className, "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "approval"), children: [
643
- /* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
644
- /* @__PURE__ */ jsxs("div", { className: classNames("flex flex-col items-center w-4 shrink-0", !showLineBelow && "pb-1"), children: [
730
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
731
+ /* @__PURE__ */ jsxs("div", { className: classNames("flex flex-col items-center shrink-0", !showLineBelow && "pb-1"), children: [
645
732
  /* @__PURE__ */ jsx("div", { className: "w-px flex-1 bg-gray-300 dark:bg-gray-275 min-h-[0.75rem]" }),
646
- /* @__PURE__ */ jsx(
647
- IconProvider,
648
- {
649
- icon: "wrench",
650
- size: 0.875,
651
- className: classNames("text-gray-600 shrink-0 mt-1", showLineBelow && "my-1")
652
- }
653
- ),
733
+ /* @__PURE__ */ jsx(StepIconBox, { icon: "wrench", variant: "muted", iconSize: 0.875, className: classNames("my-1") }),
654
734
  showLineBelow && /* @__PURE__ */ jsx("div", { className: "w-px flex-1 bg-gray-300 dark:bg-gray-275 min-h-[0.75rem]" })
655
735
  ] }),
656
- /* @__PURE__ */ jsxs("div", { className: classNames("flex items-end justify-between flex-1", showLineBelow && "items-center"), children: [
736
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between flex-1 mt-2", children: [
657
737
  /* @__PURE__ */ jsxs("div", { className: "flex items-center w-full justify-between gap-2", children: [
658
738
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
659
- /* @__PURE__ */ jsxs("span", { className: "text-gray-750 text-xs font-medium leading-4 font-sans inline-flex flex-wrap items-center gap-1", children: [
739
+ /* @__PURE__ */ jsxs("span", { className: "text-gray-750 dark:text-gray-200 text-xs font-medium leading-4 font-sans inline-flex flex-wrap items-center gap-1", children: [
660
740
  headingText,
661
741
  /* @__PURE__ */ jsx(Badge, { text: toolName, type: "gray" })
662
742
  ] }),
@@ -664,12 +744,20 @@ const ToolApprovalBlock = ({
664
744
  IconProvider,
665
745
  {
666
746
  icon: isDenied ? "circle-xmark" : "check-circle",
667
- size: 0.75,
668
- className: classNames("shrink-0", isDenied ? "text-red-500" : "text-green-500")
747
+ size: 0.875,
748
+ className: classNames("shrink-0", isDenied ? "text-red-500" : "text-green-600 dark:text-green-500")
669
749
  }
670
750
  )
671
751
  ] }),
672
- !isDecided && !readOnly && selectedDenyOption && /* @__PURE__ */ jsx(Button.Secondary, { text: "Back", size: "small", disabled: interactionsLocked, onClick: () => onDenyOptionChange == null ? void 0 : onDenyOptionChange(null) })
752
+ !isDecided && !readOnly && selectedDenyOption && /* @__PURE__ */ jsx(
753
+ Button.Secondary,
754
+ {
755
+ text: "Back",
756
+ size: "small",
757
+ disabled: interactionsLocked,
758
+ onClick: () => onDenyOptionChange == null ? void 0 : onDenyOptionChange(null)
759
+ }
760
+ )
673
761
  ] }),
674
762
  !isDecided && !readOnly && !selectedDenyOption && /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
675
763
  approveOptions.map((option) => {
@@ -709,13 +797,13 @@ const ToolApprovalBlock = ({
709
797
  ] })
710
798
  ] })
711
799
  ] }),
712
- !isDecided && !readOnly && selectedDenyOption && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 pl-7 pt-3", children: [
800
+ !isDecided && !readOnly && selectedDenyOption && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 pl-8 pt-3", children: [
713
801
  (((_a = selectedDenyOption.confirm) == null ? void 0 : _a.title) || ((_b = selectedDenyOption.confirm) == null ? void 0 : _b.description)) && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5", children: [
714
- selectedDenyOption.confirm.title && /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-750", children: selectedDenyOption.confirm.title }),
715
- selectedDenyOption.confirm.description && /* @__PURE__ */ jsx("span", { className: "text-xs text-gray-600", children: selectedDenyOption.confirm.description })
802
+ selectedDenyOption.confirm.title && /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-750 dark:text-gray-200", children: selectedDenyOption.confirm.title }),
803
+ selectedDenyOption.confirm.description && /* @__PURE__ */ jsx("span", { className: "text-xs text-gray-600 dark:text-gray-400", children: selectedDenyOption.confirm.description })
716
804
  ] }),
717
805
  selectedDenyOption.grants && selectedDenyOption.grants.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-1", children: [
718
- /* @__PURE__ */ jsx("span", { className: "text-xs text-gray-600", children: "Grants:" }),
806
+ /* @__PURE__ */ jsx("span", { className: "text-xs text-gray-600 dark:text-gray-400", children: "Grants:" }),
719
807
  selectedDenyOption.grants.map((grant) => /* @__PURE__ */ jsx(Badge, { text: grant, type: "gray" }, grant))
720
808
  ] }),
721
809
  /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
@@ -736,25 +824,26 @@ const ToolApprovalBlock = ({
736
824
  ] }),
737
825
  showReasonError && /* @__PURE__ */ jsx("span", { className: "text-xs text-rose-500", children: "Reason is required" })
738
826
  ] }),
739
- isDecided && (status == null ? void 0 : status.reason) && /* @__PURE__ */ jsx("div", { className: "pl-7 pt-2", children: /* @__PURE__ */ jsxs("span", { className: "text-xs text-gray-600", children: [
827
+ isDecided && (status == null ? void 0 : status.reason) && /* @__PURE__ */ jsx("div", { className: "pl-8 pt-2", children: /* @__PURE__ */ jsxs("span", { className: "text-xs text-gray-600 dark:text-gray-400", children: [
740
828
  "Reason: ",
741
829
  status.reason
742
830
  ] }) })
743
831
  ] });
744
832
  };
745
833
  const DEFAULT_AWAITING_TEXT = "Awaiting Response...";
746
- const DEFAULT_RESPONSE_ICON = ["far", "check-circle"];
747
834
  const ToolCallCard = ({
748
835
  icon = "mcp-server",
749
836
  iconClassName,
837
+ iconVariant,
750
838
  toolName,
751
839
  expanded = false,
752
840
  onToggle,
753
841
  awaiting = false,
754
842
  awaitingText = DEFAULT_AWAITING_TEXT,
843
+ status: explicitStatus,
755
844
  showExpandChevron = true,
756
845
  showResponseLine = false,
757
- responseIcon = DEFAULT_RESPONSE_ICON,
846
+ responseIcon,
758
847
  approvalSlot,
759
848
  requestSlot,
760
849
  responseSlot,
@@ -763,9 +852,16 @@ const ToolCallCard = ({
763
852
  highlightCard = false
764
853
  }) => {
765
854
  const hasApproval = !!approvalSlot;
766
- const showRequestLine = hasApproval || showResponseLine && expanded;
767
- const isExpandable = showExpandChevron;
768
- return /* @__PURE__ */ jsxs(
855
+ const hasRequest = !!requestSlot;
856
+ const hasResponse = !!responseSlot;
857
+ const showConnector = hasApproval || hasRequest || hasResponse;
858
+ const isExpandable = showExpandChevron && (hasRequest || hasResponse);
859
+ const derivedStatus = explicitStatus || (awaiting ? "running" : showResponseLine ? "success" : "idle");
860
+ const statusText = awaiting ? awaitingText : void 0;
861
+ const isCubeIcon = icon === "cube";
862
+ const derivedIconVariant = iconVariant || (isCubeIcon ? "primary" : "muted");
863
+ const derivedIconSize = isCubeIcon ? 0.75 : void 0;
864
+ return /* @__PURE__ */ jsx(
769
865
  "div",
770
866
  {
771
867
  className: classNames(
@@ -777,63 +873,30 @@ const ToolCallCard = ({
777
873
  className
778
874
  ),
779
875
  "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "tool-call-card"),
780
- children: [
781
- /* @__PURE__ */ jsxs(
782
- "div",
783
- {
784
- className: classNames("flex gap-2 items-start", {
785
- "cursor-pointer": isExpandable
786
- }),
787
- onClick: isExpandable ? onToggle : void 0,
788
- "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "header"),
789
- children: [
790
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center w-4 shrink-0 self-stretch", children: [
791
- /* @__PURE__ */ jsx(IconProvider, { icon, size: 0.875, className: iconClassName }),
792
- showRequestLine && /* @__PURE__ */ jsx("div", { className: "w-px flex-1 bg-gray-300 dark:bg-gray-275 mt-1" })
793
- ] }),
794
- /* @__PURE__ */ jsxs("div", { className: "text-xs font-medium font-sans flex-1 flex items-center gap-2", children: [
795
- /* @__PURE__ */ jsx("span", { "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "name"), className: "text-gray-750", children: toolName }),
796
- showExpandChevron && /* @__PURE__ */ jsx(
797
- IconProvider,
798
- {
799
- icon: "chevron-right",
800
- size: 0.625,
801
- className: classNames(
802
- "text-gray-600 transition-transform duration-300 shrink-0",
803
- expanded && "rotate-90"
804
- )
805
- }
806
- )
807
- ] }),
808
- awaiting && /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", children: [
809
- /* @__PURE__ */ jsx(StatusDot, { colorClassName: "bg-orange-500" }),
810
- /* @__PURE__ */ jsx("span", { className: "text-gray-750 text-xs font-medium leading-4 font-sans", children: awaitingText })
811
- ] })
812
- ]
813
- }
814
- ),
815
- expanded && requestSlot && /* @__PURE__ */ jsxs("div", { className: classNames("flex gap-2"), children: [
816
- showRequestLine && /* @__PURE__ */ jsx("div", { className: "flex justify-center w-4 shrink-0", children: /* @__PURE__ */ jsx("div", { className: "w-px bg-gray-300 dark:bg-gray-275" }) }),
817
- /* @__PURE__ */ jsx(
818
- "div",
819
- {
820
- className: classNames("flex-1 pt-3", {
821
- "pb-3": !hasApproval
822
- }),
823
- "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "request"),
824
- children: requestSlot
825
- }
826
- )
827
- ] }),
828
- approvalSlot,
829
- expanded && showResponseLine && responseSlot && /* @__PURE__ */ jsxs("div", { className: "flex gap-2 min-h-4", children: [
830
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center w-4 shrink-0 self-stretch", children: [
831
- /* @__PURE__ */ jsx("div", { className: "w-px flex-1 bg-gray-300 dark:bg-gray-275" }),
832
- /* @__PURE__ */ jsx(IconProvider, { icon: responseIcon, size: 0.75, className: "text-gray-500 shrink-0 mt-1" })
876
+ children: /* @__PURE__ */ jsx(
877
+ AgentStepRow,
878
+ {
879
+ icon,
880
+ iconClassName,
881
+ iconVariant: derivedIconVariant,
882
+ iconSize: derivedIconSize,
883
+ title: toolName,
884
+ expandable: isExpandable,
885
+ expanded,
886
+ onToggle,
887
+ status: derivedStatus,
888
+ statusText,
889
+ showConnector,
890
+ showContentConnector: true,
891
+ showPersistentContentConnector: !hasApproval,
892
+ dataTestPrefix: dataTestPrefix && toDataTestId(dataTestPrefix, "header"),
893
+ persistentChildren: /* @__PURE__ */ jsxs(Fragment, { children: [
894
+ approvalSlot,
895
+ expanded && showResponseLine && responseSlot && /* @__PURE__ */ jsx("div", { className: "pt-2", "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "response"), children: responseSlot })
833
896
  ] }),
834
- /* @__PURE__ */ jsx("div", { className: "flex-1", "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "response"), children: responseSlot })
835
- ] })
836
- ]
897
+ children: requestSlot && /* @__PURE__ */ jsx("div", { className: "pt-2 pb-2", "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "request"), children: requestSlot })
898
+ }
899
+ )
837
900
  }
838
901
  );
839
902
  };
@@ -920,11 +983,13 @@ const ToolCallContentBlock = ({
920
983
  };
921
984
  export {
922
985
  ASK_USER_CUSTOM_OPTION,
986
+ AgentStepRow,
923
987
  AskUserQuestionCard,
924
988
  AssistantMessage,
925
989
  McpAuthCard,
926
990
  ReasoningCard,
927
991
  SandboxToolCall,
992
+ StepIconBox,
928
993
  SubAgentCard,
929
994
  ToolApprovalBlock,
930
995
  ToolCallCard,