tfy-web-components 0.0.30 → 0.0.31
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.
- package/dist/components/molecules/agent-chat/AgentStepRow.d.ts +1 -0
- package/dist/components/molecules/agent-chat/ToolCallCard.d.ts +1 -0
- package/dist/components/molecules/agent-chat.es.js +106 -98
- package/dist/components/molecules/agent-chat.es.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -31,34 +31,25 @@ const StatusDot = ({ className, colorClassName = "bg-orange-500" }) => {
|
|
|
31
31
|
};
|
|
32
32
|
const StepIconBox = ({
|
|
33
33
|
icon,
|
|
34
|
-
iconSize = 0.
|
|
34
|
+
iconSize = 0.75,
|
|
35
35
|
variant = "primary",
|
|
36
36
|
className,
|
|
37
37
|
iconClassName
|
|
38
38
|
}) => {
|
|
39
|
-
return /* @__PURE__ */ jsx(
|
|
40
|
-
|
|
39
|
+
return /* @__PURE__ */ jsx("div", { className: classNames("flex items-center justify-center size-5 shrink-0", className), children: /* @__PURE__ */ jsx(
|
|
40
|
+
IconProvider,
|
|
41
41
|
{
|
|
42
|
+
icon,
|
|
43
|
+
size: iconSize,
|
|
42
44
|
className: classNames(
|
|
43
|
-
"flex items-center justify-center size-6 rounded shrink-0 bg-indigo-50 dark:bg-indigo-900",
|
|
44
|
-
className
|
|
45
|
-
),
|
|
46
|
-
children: /* @__PURE__ */ jsx(
|
|
47
|
-
IconProvider,
|
|
48
45
|
{
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"text-indigo-600 dark:text-gray-750": variant === "primary",
|
|
54
|
-
"text-gray-600 dark:text-gray-750": variant === "muted"
|
|
55
|
-
},
|
|
56
|
-
iconClassName
|
|
57
|
-
)
|
|
58
|
-
}
|
|
46
|
+
"text-indigo-600 dark:text-gray-750": variant === "primary",
|
|
47
|
+
"text-gray-600 dark:text-gray-750": variant === "muted"
|
|
48
|
+
},
|
|
49
|
+
iconClassName
|
|
59
50
|
)
|
|
60
51
|
}
|
|
61
|
-
);
|
|
52
|
+
) });
|
|
62
53
|
};
|
|
63
54
|
const AgentStepRow = ({
|
|
64
55
|
icon,
|
|
@@ -82,7 +73,8 @@ const AgentStepRow = ({
|
|
|
82
73
|
persistentChildren,
|
|
83
74
|
dataTestPrefix,
|
|
84
75
|
className,
|
|
85
|
-
titleClassName
|
|
76
|
+
titleClassName,
|
|
77
|
+
align = "center"
|
|
86
78
|
}) => {
|
|
87
79
|
const hasChildren = !!children;
|
|
88
80
|
const hasPersistentChildren = !!persistentChildren;
|
|
@@ -90,24 +82,25 @@ const AgentStepRow = ({
|
|
|
90
82
|
const isRunning = status === "running";
|
|
91
83
|
const isSuccess = status === "success";
|
|
92
84
|
const isError = status === "error";
|
|
85
|
+
const alignStart = align === "start";
|
|
93
86
|
return /* @__PURE__ */ jsxs(
|
|
94
87
|
"div",
|
|
95
88
|
{
|
|
96
89
|
className: classNames("flex flex-col min-w-0", className),
|
|
97
90
|
"data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "step-row"),
|
|
98
91
|
children: [
|
|
99
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-start", children: [
|
|
92
|
+
/* @__PURE__ */ jsxs("div", { className: classNames("flex gap-2", alignStart ? "items-start" : "items-center"), children: [
|
|
100
93
|
showChevronColumn && (showExpandChevron ? /* @__PURE__ */ jsx(
|
|
101
94
|
"div",
|
|
102
95
|
{
|
|
103
|
-
className: "flex items-center justify-center w-5 h-
|
|
96
|
+
className: "flex items-center justify-center w-5 h-5 shrink-0 cursor-pointer",
|
|
104
97
|
onClick: onToggle,
|
|
105
98
|
"data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "chevron"),
|
|
106
99
|
children: /* @__PURE__ */ jsx(
|
|
107
100
|
IconProvider,
|
|
108
101
|
{
|
|
109
102
|
icon: "chevron-right",
|
|
110
|
-
size: 0.
|
|
103
|
+
size: 0.5,
|
|
111
104
|
className: classNames(
|
|
112
105
|
"text-gray-600 transition-transform duration-300 shrink-0",
|
|
113
106
|
expanded && "rotate-90"
|
|
@@ -116,24 +109,33 @@ const AgentStepRow = ({
|
|
|
116
109
|
)
|
|
117
110
|
}
|
|
118
111
|
) : /* @__PURE__ */ jsx("div", { className: "w-5 shrink-0" })),
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
112
|
+
/* @__PURE__ */ jsx(
|
|
113
|
+
"div",
|
|
114
|
+
{
|
|
115
|
+
className: classNames(
|
|
116
|
+
"relative flex flex-col items-center shrink-0",
|
|
117
|
+
alignStart ? "self-start" : "self-center"
|
|
118
|
+
),
|
|
119
|
+
children: /* @__PURE__ */ jsx(StepIconBox, { icon, variant: iconVariant, iconClassName, iconSize })
|
|
120
|
+
}
|
|
121
|
+
),
|
|
123
122
|
/* @__PURE__ */ jsxs(
|
|
124
123
|
"div",
|
|
125
124
|
{
|
|
126
|
-
className: classNames("flex-1 min-w-0 flex flex-col", {
|
|
125
|
+
className: classNames("flex-1 min-w-0 flex flex-col justify-center", {
|
|
127
126
|
"cursor-pointer": showExpandChevron
|
|
128
127
|
}),
|
|
129
128
|
onClick: showExpandChevron ? onToggle : void 0,
|
|
130
129
|
children: [
|
|
131
|
-
label && /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-500 font-sans", children: label }),
|
|
130
|
+
label && /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-500 font-sans leading-none", children: label }),
|
|
132
131
|
title && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 min-w-0", children: [
|
|
133
132
|
/* @__PURE__ */ jsx(
|
|
134
133
|
"span",
|
|
135
134
|
{
|
|
136
|
-
className: classNames(
|
|
135
|
+
className: classNames(
|
|
136
|
+
"text-[0.75rem] font-medium leading-5 text-gray-700 font-sans truncate min-w-0",
|
|
137
|
+
titleClassName
|
|
138
|
+
),
|
|
137
139
|
"data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "title"),
|
|
138
140
|
children: title
|
|
139
141
|
}
|
|
@@ -164,7 +166,7 @@ const AgentStepRow = ({
|
|
|
164
166
|
]
|
|
165
167
|
}
|
|
166
168
|
),
|
|
167
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 shrink-0", children: [
|
|
169
|
+
/* @__PURE__ */ jsxs("div", { className: classNames("flex items-center gap-2 shrink-0", alignStart ? "self-start" : "self-center"), children: [
|
|
168
170
|
statusText && /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", children: [
|
|
169
171
|
isRunning && /* @__PURE__ */ jsx(StatusDot, { colorClassName: "bg-orange-500" }),
|
|
170
172
|
/* @__PURE__ */ jsx("span", { className: "text-gray-750 text-xs font-medium leading-4 font-sans", children: statusText })
|
|
@@ -184,11 +186,11 @@ const AgentStepRow = ({
|
|
|
184
186
|
expanded && hasChildren && /* @__PURE__ */ jsxs(
|
|
185
187
|
"div",
|
|
186
188
|
{
|
|
187
|
-
className: "flex gap-
|
|
189
|
+
className: "flex gap-3 min-w-0 mt-2",
|
|
188
190
|
"data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "expanded-content"),
|
|
189
191
|
children: [
|
|
190
192
|
showChevronColumn && /* @__PURE__ */ jsx("div", { className: "w-5 shrink-0" }),
|
|
191
|
-
showContentConnector && showConnector && /* @__PURE__ */ jsx("div", { className: "flex justify-center shrink-0 w-
|
|
193
|
+
showContentConnector && showConnector && /* @__PURE__ */ jsx("div", { className: "flex justify-center shrink-0 w-3", children: /* @__PURE__ */ jsx("div", { className: "w-px bg-gray-300" }) }),
|
|
192
194
|
/* @__PURE__ */ jsx("div", { className: "flex-1 min-w-0", children })
|
|
193
195
|
]
|
|
194
196
|
}
|
|
@@ -196,11 +198,11 @@ const AgentStepRow = ({
|
|
|
196
198
|
hasPersistentChildren && /* @__PURE__ */ jsxs(
|
|
197
199
|
"div",
|
|
198
200
|
{
|
|
199
|
-
className: "flex gap-
|
|
201
|
+
className: "flex gap-3 min-w-0",
|
|
200
202
|
"data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "persistent-content"),
|
|
201
203
|
children: [
|
|
202
204
|
showChevronColumn && /* @__PURE__ */ jsx("div", { className: "w-5 shrink-0" }),
|
|
203
|
-
showPersistentContentConnector && showConnector && /* @__PURE__ */ jsx("div", { className: "flex justify-center shrink-0 w-
|
|
205
|
+
showPersistentContentConnector && showConnector && /* @__PURE__ */ jsx("div", { className: "flex justify-center shrink-0 w-3", children: /* @__PURE__ */ jsx("div", { className: "w-px bg-gray-300" }) }),
|
|
204
206
|
/* @__PURE__ */ jsx("div", { className: "flex-1 min-w-0", children: persistentChildren })
|
|
205
207
|
]
|
|
206
208
|
}
|
|
@@ -527,52 +529,45 @@ const ReasoningCard = ({
|
|
|
527
529
|
onToggle,
|
|
528
530
|
isMultiLine = false,
|
|
529
531
|
reasoningTimeText,
|
|
530
|
-
previewText = "",
|
|
531
532
|
headingText = "Reasoning",
|
|
532
533
|
contentRef,
|
|
533
534
|
dataTestPrefix,
|
|
534
535
|
className
|
|
535
536
|
}) => {
|
|
536
537
|
const isShortText = !isStreaming && content.length > 0 && !isMultiLine;
|
|
537
|
-
const isExpandable = isMultiLine || isStreaming;
|
|
538
|
+
const isExpandable = isShortText || isMultiLine || isStreaming;
|
|
538
539
|
const status = isStreaming ? "running" : content.length > 0 ? "success" : "idle";
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
icon: "brain-regular",
|
|
544
|
-
iconVariant: "primary",
|
|
545
|
-
label: reasoningTimeText ?? "Reasoning",
|
|
546
|
-
body: /* @__PURE__ */ jsx(
|
|
547
|
-
"div",
|
|
548
|
-
{
|
|
549
|
-
ref: contentRef,
|
|
550
|
-
className: "border-l-4 border-l-blue-500 pl-3 text-gray-600 text-sm font-normal font-sans",
|
|
551
|
-
children: /* @__PURE__ */ jsx(Markdown, { className: "text-gray-600 font-sans text-sm", children: content })
|
|
552
|
-
}
|
|
553
|
-
),
|
|
554
|
-
status,
|
|
555
|
-
expandable: true,
|
|
556
|
-
expanded,
|
|
557
|
-
onToggle,
|
|
558
|
-
dataTestPrefix
|
|
559
|
-
}
|
|
560
|
-
) });
|
|
561
|
-
}
|
|
562
|
-
return /* @__PURE__ */ jsx("div", { className, "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "reasoning-accordion"), children: /* @__PURE__ */ jsx(
|
|
563
|
-
AgentStepRow,
|
|
540
|
+
const title = isStreaming ? headingText : reasoningTimeText ?? headingText;
|
|
541
|
+
const showContent = expanded && content.length > 0;
|
|
542
|
+
return /* @__PURE__ */ jsx(
|
|
543
|
+
"div",
|
|
564
544
|
{
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
545
|
+
className: classNames("flex flex-col min-w-0 mt-2", className),
|
|
546
|
+
"data-test": dataTestPrefix && toDataTestId(dataTestPrefix, isShortText ? "reasoning-inline" : "reasoning-accordion"),
|
|
547
|
+
children: /* @__PURE__ */ jsx(
|
|
548
|
+
AgentStepRow,
|
|
549
|
+
{
|
|
550
|
+
icon: isStreaming ? "brain" : "brain-regular",
|
|
551
|
+
iconVariant: "primary",
|
|
552
|
+
title,
|
|
553
|
+
expandable: isExpandable,
|
|
554
|
+
expanded,
|
|
555
|
+
onToggle,
|
|
556
|
+
status,
|
|
557
|
+
dataTestPrefix,
|
|
558
|
+
children: showContent && /* @__PURE__ */ jsx(
|
|
559
|
+
"div",
|
|
560
|
+
{
|
|
561
|
+
ref: contentRef,
|
|
562
|
+
className: "py-2 pt-0 text-gray-600 text-sm font-normal font-sans",
|
|
563
|
+
"data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "content"),
|
|
564
|
+
children: /* @__PURE__ */ jsx(Markdown, { className: "text-gray-600 font-sans text-sm", children: content })
|
|
565
|
+
}
|
|
566
|
+
)
|
|
567
|
+
}
|
|
568
|
+
)
|
|
574
569
|
}
|
|
575
|
-
)
|
|
570
|
+
);
|
|
576
571
|
};
|
|
577
572
|
const EDITOR_VIEW_TYPES = {
|
|
578
573
|
TERMINAL: {
|
|
@@ -682,32 +677,41 @@ const SandboxToolCall = ({
|
|
|
682
677
|
] })
|
|
683
678
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
684
679
|
command && /* @__PURE__ */ jsxs("div", { className: "break-all border-l-4 border-indigo-400 px-3 my-1", children: [
|
|
685
|
-
/* @__PURE__ */ jsx("
|
|
686
|
-
|
|
687
|
-
|
|
680
|
+
/* @__PURE__ */ jsx("div", { className: "mb-1 text-[12px] font-medium leading-4 font-jetbrains text-gray-600", children: "COMMAND" }),
|
|
681
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
682
|
+
/* @__PURE__ */ jsx("span", { className: "text-teal-500", children: "$" }),
|
|
683
|
+
" ",
|
|
684
|
+
command
|
|
685
|
+
] })
|
|
688
686
|
] }),
|
|
689
687
|
resultText ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
690
688
|
/* @__PURE__ */ jsx("div", { className: "divider my-1 mx-3" }),
|
|
691
|
-
/* @__PURE__ */
|
|
689
|
+
/* @__PURE__ */ jsxs("div", { className: "break-all border-l-4 border-purple-400 px-3 my-1", children: [
|
|
690
|
+
/* @__PURE__ */ jsx("div", { className: "mb-1 text-[12px] font-medium leading-4 font-jetbrains text-gray-600", children: "OUTPUT" }),
|
|
691
|
+
/* @__PURE__ */ jsx("div", { children: resultText })
|
|
692
|
+
] })
|
|
692
693
|
] }) : resultJson && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
693
694
|
/* @__PURE__ */ jsx("div", { className: "divider my-1 mx-3" }),
|
|
694
|
-
/* @__PURE__ */
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
695
|
+
/* @__PURE__ */ jsxs("div", { className: "border-l-4 border-purple-400 px-3 my-1", children: [
|
|
696
|
+
/* @__PURE__ */ jsx("div", { className: "mb-1 text-[12px] font-medium leading-4 font-jetbrains text-gray-600", children: "OUTPUT" }),
|
|
697
|
+
/* @__PURE__ */ jsx(
|
|
698
|
+
SimpleCodeEditor,
|
|
699
|
+
{
|
|
700
|
+
language: "json",
|
|
701
|
+
defaultValue: resultJson,
|
|
702
|
+
value: resultJson,
|
|
703
|
+
readOnly: true,
|
|
704
|
+
maxHeight: 10.5,
|
|
705
|
+
initialLinesCount: 1,
|
|
706
|
+
disableEditorResize: true,
|
|
707
|
+
enableExpand: true,
|
|
708
|
+
autoLayout: true,
|
|
709
|
+
hideLineNumbers: true,
|
|
710
|
+
className: "pl-2",
|
|
711
|
+
isFoldingEnabled: true
|
|
712
|
+
}
|
|
713
|
+
)
|
|
714
|
+
] })
|
|
711
715
|
] })
|
|
712
716
|
] }) }) }) }) })
|
|
713
717
|
]
|
|
@@ -746,7 +750,6 @@ const SubAgentCard = ({
|
|
|
746
750
|
status: agentStatus,
|
|
747
751
|
statusText: durationText,
|
|
748
752
|
dataTestPrefix,
|
|
749
|
-
titleClassName: "mt-0.5",
|
|
750
753
|
children: [
|
|
751
754
|
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: [
|
|
752
755
|
/* @__PURE__ */ jsx("h4", { className: "text-sm font-semibold text-gray-900", children: "Instructions" }),
|
|
@@ -916,6 +919,7 @@ const ToolCallCard = ({
|
|
|
916
919
|
awaiting = false,
|
|
917
920
|
awaitingText = DEFAULT_AWAITING_TEXT,
|
|
918
921
|
status: explicitStatus,
|
|
922
|
+
exitCode,
|
|
919
923
|
showExpandChevron = true,
|
|
920
924
|
showResponseLine = false,
|
|
921
925
|
responseIcon,
|
|
@@ -931,7 +935,12 @@ const ToolCallCard = ({
|
|
|
931
935
|
const hasResponse = !!responseSlot;
|
|
932
936
|
const showConnector = hasApproval || hasRequest || hasResponse;
|
|
933
937
|
const isExpandable = showExpandChevron && (hasRequest || hasResponse);
|
|
934
|
-
|
|
938
|
+
let derivedStatus = "idle";
|
|
939
|
+
if (explicitStatus) derivedStatus = explicitStatus;
|
|
940
|
+
else if (awaiting) derivedStatus = "running";
|
|
941
|
+
else if (exitCode === 0) derivedStatus = "success";
|
|
942
|
+
else if (exitCode != null) derivedStatus = "error";
|
|
943
|
+
else if (showResponseLine) derivedStatus = "success";
|
|
935
944
|
const statusText = awaiting ? awaitingText : void 0;
|
|
936
945
|
const isCubeIcon = icon === "cube";
|
|
937
946
|
const derivedIconVariant = iconVariant || (isCubeIcon ? "primary" : "muted");
|
|
@@ -956,7 +965,6 @@ const ToolCallCard = ({
|
|
|
956
965
|
iconVariant: derivedIconVariant,
|
|
957
966
|
iconSize: derivedIconSize,
|
|
958
967
|
title: toolName,
|
|
959
|
-
titleClassName: "mt-0.5",
|
|
960
968
|
expandable: isExpandable,
|
|
961
969
|
expanded,
|
|
962
970
|
onToggle,
|
|
@@ -968,9 +976,9 @@ const ToolCallCard = ({
|
|
|
968
976
|
dataTestPrefix: dataTestPrefix && toDataTestId(dataTestPrefix, "header"),
|
|
969
977
|
persistentChildren: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
970
978
|
approvalSlot,
|
|
971
|
-
expanded && showResponseLine && responseSlot && /* @__PURE__ */ jsx("div", {
|
|
979
|
+
expanded && showResponseLine && responseSlot && /* @__PURE__ */ jsx("div", { "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "response"), children: responseSlot })
|
|
972
980
|
] }),
|
|
973
|
-
children: requestSlot && /* @__PURE__ */ jsx("div", { className: "
|
|
981
|
+
children: requestSlot && /* @__PURE__ */ jsx("div", { className: "py-2 pt-0", "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "request"), children: requestSlot })
|
|
974
982
|
}
|
|
975
983
|
)
|
|
976
984
|
}
|