tfy-web-components 0.0.19 → 0.0.21

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.
Files changed (131) hide show
  1. package/README.md +65 -4
  2. package/dist/..d.ts +46 -0
  3. package/dist/Accordion.d.ts +8 -9
  4. package/dist/Alert.d.ts +73 -0
  5. package/dist/AudioPlayer.d.ts +10 -0
  6. package/dist/Avatar.d.ts +19 -0
  7. package/dist/Badge.d.ts +2 -1
  8. package/dist/CopyField.d.ts +1 -0
  9. package/dist/CustomDrawer.d.ts +8 -1
  10. package/dist/DropdownMenu.d.ts +25 -0
  11. package/dist/IconButton.d.ts +4 -2
  12. package/dist/ImagesPreview.d.ts +12 -0
  13. package/dist/Input-CnGhA18d.js +74283 -0
  14. package/dist/Input-CnGhA18d.js.map +1 -0
  15. package/dist/Markdown.d.ts +103 -0
  16. package/dist/Modal.d.ts +12 -0
  17. package/dist/MonacoEditorCore-xfpJ6z-E.js +113 -0
  18. package/dist/MonacoEditorCore-xfpJ6z-E.js.map +1 -0
  19. package/dist/OpenUiFenceBlock-CsVY6kwA.js +20 -0
  20. package/dist/OpenUiFenceBlock-CsVY6kwA.js.map +1 -0
  21. package/dist/OutlinedRadio.d.ts +9 -0
  22. package/dist/RootFontSizeContext-7vgn7Y_k.js +22 -0
  23. package/dist/RootFontSizeContext-7vgn7Y_k.js.map +1 -0
  24. package/dist/SimpleCodeEditor.d.ts +63 -0
  25. package/dist/Skeleton.d.ts +7 -0
  26. package/dist/ThumbsFeedback.d.ts +18 -0
  27. package/dist/ToggleButton.d.ts +42 -0
  28. package/dist/UserMessage.d.ts +15 -0
  29. package/dist/UserMessageEdit.d.ts +16 -0
  30. package/dist/_commonjsHelpers-DWwsNxpa.js +9 -0
  31. package/dist/_commonjsHelpers-DWwsNxpa.js.map +1 -0
  32. package/dist/agent-chat.d.ts +222 -0
  33. package/dist/classNames-Dy-RXSjS.js +9 -0
  34. package/dist/{classNames-CC5emYUV.js.map → classNames-Dy-RXSjS.js.map} +1 -1
  35. package/dist/components/atoms/Accordion.d.ts +5 -6
  36. package/dist/components/atoms/Accordion.es.js +9 -7
  37. package/dist/components/atoms/Accordion.es.js.map +1 -1
  38. package/dist/components/atoms/AudioPlayer.d.ts +6 -0
  39. package/dist/components/atoms/AudioPlayer.es.js +1424 -0
  40. package/dist/components/atoms/AudioPlayer.es.js.map +1 -0
  41. package/dist/components/atoms/Avatar.d.ts +10 -0
  42. package/dist/components/atoms/Avatar.es.js +62 -0
  43. package/dist/components/atoms/Avatar.es.js.map +1 -0
  44. package/dist/components/atoms/Badge.d.ts +2 -1
  45. package/dist/components/atoms/Badge.es.js +9 -1
  46. package/dist/components/atoms/Badge.es.js.map +1 -1
  47. package/dist/components/atoms/Button.es.js +2 -2
  48. package/dist/components/atoms/IconButton.d.ts +4 -2
  49. package/dist/components/atoms/IconButton.es.js +23 -7
  50. package/dist/components/atoms/IconButton.es.js.map +1 -1
  51. package/dist/components/atoms/IconProvider.es.js +28 -2
  52. package/dist/components/atoms/IconProvider.es.js.map +1 -1
  53. package/dist/components/atoms/Modal.d.ts +8 -0
  54. package/dist/components/atoms/Modal.es.js +19 -0
  55. package/dist/components/atoms/Modal.es.js.map +1 -0
  56. package/dist/components/atoms/OutlinedRadio.d.ts +5 -0
  57. package/dist/components/atoms/OutlinedRadio.es.js +29 -0
  58. package/dist/components/atoms/OutlinedRadio.es.js.map +1 -0
  59. package/dist/components/atoms/Skeleton.d.ts +4 -0
  60. package/dist/components/atoms/Skeleton.es.js +9 -0
  61. package/dist/components/atoms/Skeleton.es.js.map +1 -0
  62. package/dist/components/atoms/Spinner.es.js +1 -1
  63. package/dist/components/atoms/Switch.es.js +1 -18
  64. package/dist/components/atoms/Switch.es.js.map +1 -1
  65. package/dist/components/atoms/TabButton.es.js +1 -1
  66. package/dist/components/atoms/TabPanel.es.js +1 -1
  67. package/dist/components/atoms/Tooltip.es.js +1 -1
  68. package/dist/components/molecules/Alert.d.ts +26 -0
  69. package/dist/components/molecules/Alert.es.js +135 -0
  70. package/dist/components/molecules/Alert.es.js.map +1 -0
  71. package/dist/components/molecules/CopyField.d.ts +1 -0
  72. package/dist/components/molecules/CopyField.es.js +12 -74192
  73. package/dist/components/molecules/CopyField.es.js.map +1 -1
  74. package/dist/components/molecules/CustomDrawer.d.ts +8 -1
  75. package/dist/components/molecules/CustomDrawer.es.js +118 -48
  76. package/dist/components/molecules/CustomDrawer.es.js.map +1 -1
  77. package/dist/components/molecules/Dialog.es.js +2570 -1519
  78. package/dist/components/molecules/Dialog.es.js.map +1 -1
  79. package/dist/components/molecules/DropdownMenu.d.ts +18 -0
  80. package/dist/components/molecules/DropdownMenu.es.js +104 -0
  81. package/dist/components/molecules/DropdownMenu.es.js.map +1 -0
  82. package/dist/components/molecules/ImagesPreview.d.ts +8 -0
  83. package/dist/components/molecules/ImagesPreview.es.js +186 -0
  84. package/dist/components/molecules/ImagesPreview.es.js.map +1 -0
  85. package/dist/components/molecules/Input.es.js +2 -2
  86. package/dist/components/molecules/Markdown.d.ts +1 -0
  87. package/dist/components/molecules/Markdown.es.js +345 -0
  88. package/dist/components/molecules/Markdown.es.js.map +1 -0
  89. package/dist/components/molecules/Notify.es.js +6 -1023
  90. package/dist/components/molecules/Notify.es.js.map +1 -1
  91. package/dist/components/molecules/SimpleCodeEditor.d.ts +56 -0
  92. package/dist/components/molecules/SimpleCodeEditor.es.js +784 -0
  93. package/dist/components/molecules/SimpleCodeEditor.es.js.map +1 -0
  94. package/dist/components/molecules/ThumbsFeedback.d.ts +13 -0
  95. package/dist/components/molecules/ThumbsFeedback.es.js +98 -0
  96. package/dist/components/molecules/ThumbsFeedback.es.js.map +1 -0
  97. package/dist/components/molecules/ToggleButton.d.ts +37 -0
  98. package/dist/components/molecules/ToggleButton.es.js +72 -0
  99. package/dist/components/molecules/ToggleButton.es.js.map +1 -0
  100. package/dist/components/molecules/agent-chat/UserMessage.d.ts +11 -0
  101. package/dist/components/molecules/agent-chat/UserMessage.es.js +40 -0
  102. package/dist/components/molecules/agent-chat/UserMessage.es.js.map +1 -0
  103. package/dist/components/molecules/agent-chat/UserMessageEdit.d.ts +12 -0
  104. package/dist/components/molecules/agent-chat/UserMessageEdit.es.js +33 -0
  105. package/dist/components/molecules/agent-chat/UserMessageEdit.es.js.map +1 -0
  106. package/dist/components/molecules/agent-chat.d.ts +1 -0
  107. package/dist/components/molecules/agent-chat.es.js +935 -0
  108. package/dist/components/molecules/agent-chat.es.js.map +1 -0
  109. package/dist/components/theme/theme.d.ts +1 -0
  110. package/dist/components/theme/theme.es.js +12 -1
  111. package/dist/components/theme/theme.es.js.map +1 -1
  112. package/dist/components/theme/useTheme.d.ts +7 -0
  113. package/dist/components/theme/useTheme.es.js +35 -20
  114. package/dist/components/theme/useTheme.es.js.map +1 -1
  115. package/dist/components/theme/utils.es.js +1 -1
  116. package/dist/index.es.js +12 -4
  117. package/dist/index.es.js.map +1 -1
  118. package/dist/{isTypedArray-CoDTnA8U.js → isTypedArray-CLAk7Q1f.js} +30 -30
  119. package/dist/isTypedArray-CLAk7Q1f.js.map +1 -0
  120. package/dist/style.css +1 -1
  121. package/dist/tailwindPreset.d.ts +140 -0
  122. package/dist/tailwindPreset.es.js +100 -0
  123. package/dist/tailwindPreset.es.js.map +1 -0
  124. package/dist/theme.css +163 -0
  125. package/dist/theme.d.ts +2 -0
  126. package/dist/useTheme.d.ts +7 -0
  127. package/package.json +49 -3
  128. package/dist/_commonjsHelpers-CcAunmGO.js +0 -34
  129. package/dist/_commonjsHelpers-CcAunmGO.js.map +0 -1
  130. package/dist/classNames-CC5emYUV.js +0 -9
  131. package/dist/isTypedArray-CoDTnA8U.js.map +0 -1
@@ -0,0 +1,935 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { c as classNames } from "../../classNames-Dy-RXSjS.js";
3
+ import { t as toDataTestId } from "../../Notification-BT4CZ69U.js";
4
+ import { Button } from "../atoms/Button.es.js";
5
+ import IconButton from "../atoms/IconButton.es.js";
6
+ import IconProvider from "../atoms/IconProvider.es.js";
7
+ import OutlinedRadio from "../atoms/OutlinedRadio.es.js";
8
+ 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
+ import Badge from "../atoms/Badge.es.js";
12
+ import SimpleCodeEditor from "./SimpleCodeEditor.es.js";
13
+ import ToggleButton from "./ToggleButton.es.js";
14
+ import { default as default2 } from "./agent-chat/UserMessage.es.js";
15
+ import { default as default3 } from "./agent-chat/UserMessageEdit.es.js";
16
+ const ASK_USER_CUSTOM_OPTION = "__tfy_ask_user_question_custom__";
17
+ const AskUserQuestionCard = ({
18
+ questions,
19
+ answeredQuestions = [],
20
+ onSubmit,
21
+ currentQuestion,
22
+ currentQuestionIndex = 0,
23
+ currentAnswer = { radioValue: "", custom: "" },
24
+ totalQuestions = questions.length,
25
+ isMultiQuestion: isMultiQuestionProp,
26
+ isLastQuestion: isLastQuestionProp,
27
+ allQuestionsAnswered = false,
28
+ isSubmitDisabled = true,
29
+ isSubmitAllDisabled = true,
30
+ onCurrentQuestionIndexChange,
31
+ onCurrentAnswerChange,
32
+ readOnly = false,
33
+ dataTestPrefix,
34
+ className
35
+ }) => {
36
+ const isMultiQuestion = isMultiQuestionProp ?? totalQuestions > 1;
37
+ const isLastQuestion = isLastQuestionProp ?? currentQuestionIndex === totalQuestions - 1;
38
+ if (questions.length === 0) {
39
+ if (answeredQuestions.length === 0) return null;
40
+ return /* @__PURE__ */ jsx("div", { className: classNames("flex flex-col gap-3", className), children: answeredQuestions.map((q) => /* @__PURE__ */ jsxs("div", { "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, `answered-${q.id}`), children: [
41
+ /* @__PURE__ */ jsxs("div", { className: "bg-indigo-50 dark:bg-gray-250 border rounded-t-lg border-indigo-300 dark:border-gray-275 px-4 py-2 flex items-center justify-between", children: [
42
+ /* @__PURE__ */ jsx("div", { className: "text-xs font-medium font-sans text-indigo-600 dark:text-gray-700", children: q.question }),
43
+ /* @__PURE__ */ jsx("div", { className: "text-[0.6875rem] flex items-center gap-1 font-medium text-gray-600 border border-indigo-400 bg-white dark:bg-gray-200 rounded px-2 py-0.5 shrink-0 h-fit", children: /* @__PURE__ */ jsx("span", { className: "text-[0.6875rem] leading-tight", children: "Answered" }) })
44
+ ] }),
45
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-4 py-3 border border-gray-250 border-t-0 dark:border-gray-275 rounded-b-lg", children: [
46
+ /* @__PURE__ */ jsx(IconProvider, { icon: "check-circle", size: 0.875, className: "text-indigo-600 shrink-0" }),
47
+ /* @__PURE__ */ jsx("span", { className: "text-[0.8125rem] font-medium font-sans text-gray-700", children: q.isCustom ? `Other: ${q.answer}` : q.answer })
48
+ ] })
49
+ ] }, q.id)) });
50
+ }
51
+ if (!currentQuestion) return null;
52
+ return /* @__PURE__ */ jsxs("div", { className, "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "question-card"), children: [
53
+ /* @__PURE__ */ jsxs("div", { className: "bg-indigo-50 dark:bg-gray-250 border rounded-t-lg border-indigo-300 dark:border-gray-275 px-4 py-2 flex items-center justify-between", children: [
54
+ /* @__PURE__ */ jsx("div", { className: "text-sm font-sans font-medium text-indigo-600 dark:text-gray-700", children: totalQuestions > 1 ? "Questions" : currentQuestion.question }),
55
+ readOnly ? /* @__PURE__ */ jsx("div", { className: "text-[0.6875rem] flex items-center gap-1 font-medium text-gray-600 border border-indigo-400 bg-white dark:bg-gray-200 rounded px-2 py-0.5 shrink-0 h-fit", children: /* @__PURE__ */ jsx("span", { className: "text-[0.6875rem] leading-tight", children: "Unanswered" }) }) : null,
56
+ !readOnly && isMultiQuestion && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
57
+ /* @__PURE__ */ jsx(
58
+ IconButton,
59
+ {
60
+ icon: "chevron-left",
61
+ iconSize: 0.75,
62
+ onClick: () => onCurrentQuestionIndexChange == null ? void 0 : onCurrentQuestionIndexChange(Math.max(0, currentQuestionIndex - 1)),
63
+ disabled: currentQuestionIndex === 0,
64
+ tooltip: "Previous question",
65
+ className: "text-gray-750"
66
+ }
67
+ ),
68
+ /* @__PURE__ */ jsx(
69
+ IconButton,
70
+ {
71
+ icon: "chevron-right",
72
+ iconSize: 0.75,
73
+ onClick: () => onCurrentQuestionIndexChange == null ? void 0 : onCurrentQuestionIndexChange(Math.min(totalQuestions - 1, currentQuestionIndex + 1)),
74
+ disabled: currentQuestionIndex === totalQuestions - 1,
75
+ tooltip: "Next question",
76
+ className: "text-gray-750"
77
+ }
78
+ ),
79
+ /* @__PURE__ */ jsxs("div", { className: "text-xs px-2 py-1 ml-1 bg-indigo-200 font-medium font-sans text-gray-800 rounded", children: [
80
+ /* @__PURE__ */ jsxs("span", { children: [
81
+ " ",
82
+ currentQuestionIndex + 1,
83
+ " "
84
+ ] }),
85
+ " ",
86
+ /* @__PURE__ */ jsx("span", { children: " of " }),
87
+ " ",
88
+ /* @__PURE__ */ jsxs("span", { children: [
89
+ " ",
90
+ totalQuestions,
91
+ " "
92
+ ] })
93
+ ] })
94
+ ] })
95
+ ] }),
96
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col px-4 py-3 gap-4 border border-gray-250 border-t-0 dark:border-gray-275 rounded-b-lg", children: [
97
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
98
+ isMultiQuestion && /* @__PURE__ */ jsx("div", { className: "text-xs font-medium font-sans text-gray-750", children: currentQuestion.question || "What would you like to do?" }),
99
+ /* @__PURE__ */ jsxs(
100
+ "div",
101
+ {
102
+ className: "flex flex-col gap-3 overflow-visible",
103
+ role: "radiogroup",
104
+ "aria-label": currentQuestion.question || "Answer options",
105
+ children: [
106
+ currentQuestion.options.map((opt, index) => /* @__PURE__ */ jsxs(
107
+ "label",
108
+ {
109
+ className: classNames(
110
+ "flex items-start gap-x-2 w-fit overflow-visible",
111
+ readOnly ? "cursor-default" : "cursor-pointer"
112
+ ),
113
+ children: [
114
+ /* @__PURE__ */ jsx(
115
+ OutlinedRadio,
116
+ {
117
+ value: opt,
118
+ disabled: readOnly || !currentQuestion.id,
119
+ name: `ask-user-question-option-${currentQuestion.id}`,
120
+ checked: currentAnswer.radioValue === opt,
121
+ onChange: () => onCurrentAnswerChange == null ? void 0 : onCurrentAnswerChange(currentQuestion.id, { radioValue: opt })
122
+ }
123
+ ),
124
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 text-[0.8125rem] font-medium font-sans leading-snug text-gray-700", children: opt })
125
+ ]
126
+ },
127
+ `${index}:${opt}`
128
+ )),
129
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 overflow-visible", children: [
130
+ /* @__PURE__ */ jsx(
131
+ OutlinedRadio,
132
+ {
133
+ disabled: readOnly || !currentQuestion.id,
134
+ value: ASK_USER_CUSTOM_OPTION,
135
+ name: `ask-user-question-option-${currentQuestion.id}`,
136
+ checked: currentAnswer.radioValue === ASK_USER_CUSTOM_OPTION,
137
+ onChange: () => onCurrentAnswerChange == null ? void 0 : onCurrentAnswerChange(currentQuestion.id, { radioValue: ASK_USER_CUSTOM_OPTION })
138
+ }
139
+ ),
140
+ /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx(
141
+ Input,
142
+ {
143
+ value: currentAnswer.custom,
144
+ disabled: readOnly || !currentQuestion.id,
145
+ onFocus: () => onCurrentAnswerChange == null ? void 0 : onCurrentAnswerChange(currentQuestion.id, { radioValue: ASK_USER_CUSTOM_OPTION }),
146
+ onChange: (e) => {
147
+ onCurrentAnswerChange == null ? void 0 : onCurrentAnswerChange(currentQuestion.id, {
148
+ custom: e.target.value,
149
+ radioValue: ASK_USER_CUSTOM_OPTION
150
+ });
151
+ },
152
+ placeholder: "Other",
153
+ className: "h-6 placeholder:text-[0.8125rem] text-[0.8125rem]"
154
+ }
155
+ ) })
156
+ ] })
157
+ ]
158
+ }
159
+ )
160
+ ] }),
161
+ !readOnly && /* @__PURE__ */ jsxs(
162
+ "div",
163
+ {
164
+ className: classNames("flex items-center", {
165
+ "justify-between": isMultiQuestion,
166
+ "justify-start": !isMultiQuestion
167
+ }),
168
+ children: [
169
+ isMultiQuestion && isLastQuestion && !allQuestionsAnswered ? /* @__PURE__ */ jsx("span", { className: "text-xs text-rose-600 font-medium", children: "Answer all questions to submit" }) : /* @__PURE__ */ jsx("span", {}),
170
+ isMultiQuestion && !isLastQuestion ? /* @__PURE__ */ jsx(
171
+ Button.Primary,
172
+ {
173
+ type: "button",
174
+ text: "Next",
175
+ onClick: () => onCurrentQuestionIndexChange == null ? void 0 : onCurrentQuestionIndexChange(currentQuestionIndex + 1),
176
+ disabled: isSubmitDisabled
177
+ }
178
+ ) : /* @__PURE__ */ jsx(
179
+ Button.Primary,
180
+ {
181
+ type: "button",
182
+ text: "Submit",
183
+ size: "small",
184
+ onClick: onSubmit,
185
+ disabled: isSubmitAllDisabled
186
+ }
187
+ )
188
+ ]
189
+ }
190
+ )
191
+ ] })
192
+ ] });
193
+ };
194
+ const AssistantMessage = ({ children, error, actionBar, className }) => {
195
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
196
+ /* @__PURE__ */ jsxs(
197
+ "div",
198
+ {
199
+ "data-slot": "aui_assistant-message-content",
200
+ className: classNames(
201
+ "text-foreground flex flex-col gap-3 px-2 leading-relaxed wrap-break-word",
202
+ "[contain-intrinsic-size:auto_24px] [content-visibility:auto]",
203
+ className
204
+ ),
205
+ children: [
206
+ children,
207
+ error
208
+ ]
209
+ }
210
+ ),
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
219
+ ] });
220
+ };
221
+ const DEFAULT_TITLE = "MCP Authentication Required";
222
+ const McpAuthCard = ({
223
+ servers,
224
+ onConnect,
225
+ onContinue,
226
+ readOnly = false,
227
+ title = DEFAULT_TITLE,
228
+ dataTestPrefix,
229
+ className
230
+ }) => {
231
+ if (servers.length === 0) return null;
232
+ return /* @__PURE__ */ jsxs(
233
+ "div",
234
+ {
235
+ className: classNames("rounded-lg border border-gray-250 dark:border-gray-275 overflow-hidden mt-2", className),
236
+ "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "mcp-auth-card"),
237
+ children: [
238
+ /* @__PURE__ */ jsx("div", { className: "bg-indigo-50 dark:bg-gray-250 border-b border-indigo-300 dark:border-gray-275 px-4 py-2", children: /* @__PURE__ */ jsx("div", { className: "text-sm font-medium font-sans text-indigo-600 dark:text-gray-700", children: title }) }),
239
+ /* @__PURE__ */ jsxs("div", { className: "bg-white dark:bg-gray-200 px-4 py-3 flex flex-col gap-3", children: [
240
+ servers.map((server) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4", children: [
241
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 min-w-0 text-sm", children: [
242
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-gray-600 shrink-0", children: "MCP Server Name" }),
243
+ /* @__PURE__ */ jsx("span", { className: "font-semibold text-xs text-gray-500 shrink-0", children: ":" }),
244
+ /* @__PURE__ */ jsx("span", { className: "font-sans font-medium text-gray-850 truncate", children: server.name })
245
+ ] }),
246
+ /* @__PURE__ */ jsx(
247
+ Button.Primary,
248
+ {
249
+ text: "Connect",
250
+ size: "small",
251
+ icon: "external-link",
252
+ iconToRight: true,
253
+ disabled: readOnly,
254
+ onClick: () => onConnect(server.id),
255
+ className: "shrink-0"
256
+ }
257
+ )
258
+ ] }, server.id)),
259
+ onContinue && /* @__PURE__ */ jsx("div", { className: "flex justify-end pt-2 border-t border-gray-250", children: /* @__PURE__ */ jsx(Button.Primary, { text: "Continue", size: "small", disabled: readOnly, onClick: onContinue }) })
260
+ ] })
261
+ ]
262
+ }
263
+ );
264
+ };
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
+ const ReasoningCard = ({
289
+ content,
290
+ isStreaming = false,
291
+ expanded = false,
292
+ onToggle,
293
+ isMultiLine = false,
294
+ reasoningTimeText,
295
+ previewText = "",
296
+ headingText = "Show Reasoning",
297
+ contentRef,
298
+ dataTestPrefix,
299
+ className
300
+ }) => {
301
+ const isShortText = !isStreaming && content.length > 0 && !isMultiLine;
302
+ 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,
314
+ {
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"
356
+ ),
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
+ ]
361
+ }
362
+ )
363
+ ] });
364
+ };
365
+ const EDITOR_VIEW_TYPES = {
366
+ TERMINAL: {
367
+ text: "",
368
+ value: "terminal",
369
+ icon: "terminal",
370
+ tooltip: "Terminal View"
371
+ },
372
+ CODE: {
373
+ text: "",
374
+ value: "code",
375
+ icon: "code",
376
+ tooltip: "Code View"
377
+ }
378
+ };
379
+ const SandboxToolCall = ({
380
+ command,
381
+ exitCode = null,
382
+ argsJson,
383
+ resultText,
384
+ resultJson,
385
+ viewMode = "terminal",
386
+ hasContent = false,
387
+ onViewModeChange,
388
+ dataTestPrefix,
389
+ className
390
+ }) => {
391
+ return /* @__PURE__ */ jsxs(
392
+ "div",
393
+ {
394
+ className: classNames("rounded-lg border-gray-200 dark:border-gray-250 bg-white dark:bg-gray-150", className),
395
+ "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "sandbox"),
396
+ children: [
397
+ /* @__PURE__ */ jsx("div", { className: "bg-indigo-50 dark:bg-gray-200 rounded-t-md border border-indigo-300 dark:border-gray-275", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-3 py-1 w-full min-w-0", children: [
398
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col-reverse min-w-0 gap-0", children: /* @__PURE__ */ jsx("p", { className: "text-xs font-medium font-sans text-indigo-600 dark:text-gray-700", children: "sandbox" }) }),
399
+ /* @__PURE__ */ jsxs(
400
+ "div",
401
+ {
402
+ className: "flex ml-auto items-center self-baseline gap-1 shrink-0",
403
+ onClick: (e) => e.stopPropagation(),
404
+ onKeyDown: (e) => e.stopPropagation(),
405
+ children: [
406
+ exitCode !== null && /* @__PURE__ */ jsx(
407
+ Badge,
408
+ {
409
+ type: exitCode === 0 ? "success" : "danger",
410
+ text: `exit: ${exitCode}`,
411
+ icon: exitCode === 0 ? "check-circle" : "circle-xmark",
412
+ textClasses: "lowercase",
413
+ dataTestPrefix: dataTestPrefix && toDataTestId(dataTestPrefix, "exit-code")
414
+ }
415
+ ),
416
+ /* @__PURE__ */ jsx(
417
+ ToggleButton,
418
+ {
419
+ buttonList: Object.values(EDITOR_VIEW_TYPES),
420
+ value: viewMode,
421
+ onChange: (value) => onViewModeChange == null ? void 0 : onViewModeChange(value),
422
+ className: classNames("p-[0.1875rem] border-gray-250 dark:border-gray-275"),
423
+ size: "small"
424
+ }
425
+ )
426
+ ]
427
+ }
428
+ )
429
+ ] }) }),
430
+ /* @__PURE__ */ jsx("div", { className: "p-3 border rounded-b-lg border-t-0 border-gray-250", children: /* @__PURE__ */ jsx("div", { className: "flex bg-white dark:bg-gray-150 overflow-hidden", children: hasContent && /* @__PURE__ */ jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsx("div", { className: "text-xs font-mono max-h-80 h-full text-gray-800 overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words", children: viewMode === "code" ? /* @__PURE__ */ jsxs(Fragment, { children: [
431
+ argsJson && /* @__PURE__ */ jsxs("div", { className: "border-l-4 border-indigo-400 px-3 my-1", children: [
432
+ /* @__PURE__ */ jsx("div", { className: "mb-1 text-xs font-medium leading-4 font-sans", children: "Arguments" }),
433
+ /* @__PURE__ */ jsx(
434
+ SimpleCodeEditor,
435
+ {
436
+ language: "json",
437
+ defaultValue: argsJson,
438
+ value: argsJson,
439
+ readOnly: true,
440
+ maxHeight: 10.5,
441
+ initialLinesCount: 1,
442
+ disableEditorResize: true,
443
+ enableExpand: true,
444
+ autoLayout: true,
445
+ hideLineNumbers: true,
446
+ className: "pl-2",
447
+ isFoldingEnabled: true
448
+ }
449
+ )
450
+ ] }),
451
+ resultJson && /* @__PURE__ */ jsxs("div", { className: "border-l-4 border-purple-400 px-3 my-1", children: [
452
+ /* @__PURE__ */ jsx("div", { className: "mt-2 mb-1 text-xs font-medium leading-4 font-sans", children: "Result" }),
453
+ /* @__PURE__ */ jsx(
454
+ SimpleCodeEditor,
455
+ {
456
+ language: "json",
457
+ defaultValue: resultJson,
458
+ value: resultJson,
459
+ readOnly: true,
460
+ maxHeight: 10.5,
461
+ initialLinesCount: 1,
462
+ disableEditorResize: true,
463
+ enableExpand: true,
464
+ autoLayout: true,
465
+ hideLineNumbers: true,
466
+ className: "pl-2",
467
+ isFoldingEnabled: true
468
+ }
469
+ )
470
+ ] })
471
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
472
+ command && /* @__PURE__ */ jsxs("div", { className: "break-all border-l-4 border-indigo-400 px-3 my-1", children: [
473
+ /* @__PURE__ */ jsx("span", { className: "text-teal-500", children: "$" }),
474
+ " ",
475
+ command
476
+ ] }),
477
+ resultText ? /* @__PURE__ */ jsxs(Fragment, { children: [
478
+ /* @__PURE__ */ jsx("div", { className: "divider my-1 mx-3" }),
479
+ /* @__PURE__ */ jsx("div", { className: "break-all border-l-4 border-purple-400 px-3 my-1", children: resultText })
480
+ ] }) : resultJson && /* @__PURE__ */ jsxs(Fragment, { children: [
481
+ /* @__PURE__ */ jsx("div", { className: "divider my-1 mx-3" }),
482
+ /* @__PURE__ */ jsx("div", { className: "border-l-4 border-purple-400 px-3 my-1", children: /* @__PURE__ */ jsx(
483
+ SimpleCodeEditor,
484
+ {
485
+ language: "json",
486
+ defaultValue: resultJson,
487
+ value: resultJson,
488
+ readOnly: true,
489
+ maxHeight: 10.5,
490
+ initialLinesCount: 1,
491
+ disableEditorResize: true,
492
+ enableExpand: true,
493
+ autoLayout: true,
494
+ hideLineNumbers: true,
495
+ className: "pl-2",
496
+ isFoldingEnabled: true
497
+ }
498
+ ) })
499
+ ] })
500
+ ] }) }) }) }) })
501
+ ]
502
+ }
503
+ );
504
+ };
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
+ const SubAgentCard = ({
520
+ agentName,
521
+ instruction = "",
522
+ stepCount = 0,
523
+ status = "running",
524
+ expanded = false,
525
+ onToggle,
526
+ durationText,
527
+ children,
528
+ renderInstruction,
529
+ dataTestPrefix,
530
+ className
531
+ }) => {
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;
534
+ return /* @__PURE__ */ jsx(
535
+ "div",
536
+ {
537
+ className: classNames("min-w-0", className),
538
+ "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "sub-agent-card"),
539
+ children: /* @__PURE__ */ jsxs(
540
+ Accordion,
541
+ {
542
+ background: "transparent",
543
+ borderColor: "var(--gateway-card-border, #e2e8f0)",
544
+ expanded,
545
+ onChange: () => onToggle == null ? void 0 : onToggle(),
546
+ className: "!m-0 !shadow-none",
547
+ sx: {
548
+ borderRadius: "0.5rem"
549
+ },
550
+ 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(
600
+ "div",
601
+ {
602
+ className: "flex min-w-0 flex-col gap-3",
603
+ "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "nested-content"),
604
+ children
605
+ }
606
+ )
607
+ ] }) })
608
+ ]
609
+ }
610
+ )
611
+ }
612
+ );
613
+ };
614
+ const DEFAULT_APPROVE_OPTIONS = [{ id: "approve", label: "Approve", variant: "primary" }];
615
+ const DEFAULT_DENY_OPTIONS = [
616
+ { id: "deny", label: "Deny", variant: "secondary", requiresReason: true }
617
+ ];
618
+ const ToolApprovalBlock = ({
619
+ toolName,
620
+ approveOptions = DEFAULT_APPROVE_OPTIONS,
621
+ denyOptions = DEFAULT_DENY_OPTIONS,
622
+ onSelect,
623
+ status,
624
+ selectedDenyOption,
625
+ denialReason = "",
626
+ showReasonError = false,
627
+ onDenyOptionChange,
628
+ onDenialReasonChange,
629
+ onReasonSubmit,
630
+ disabled = false,
631
+ readOnly = false,
632
+ showLineBelow = false,
633
+ dataTestPrefix,
634
+ className
635
+ }) => {
636
+ var _a, _b;
637
+ const isDecided = !!status;
638
+ const isApproved = (status == null ? void 0 : status.type) === "approved";
639
+ const isDenied = (status == null ? void 0 : status.type) === "denied";
640
+ const interactionsLocked = disabled && !isDecided;
641
+ const headingText = isApproved ? "Tool Approved" : isDenied ? "Tool Approval Denied" : "Tool Approval Required for";
642
+ 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: [
645
+ /* @__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
+ ),
654
+ showLineBelow && /* @__PURE__ */ jsx("div", { className: "w-px flex-1 bg-gray-300 dark:bg-gray-275 min-h-[0.75rem]" })
655
+ ] }),
656
+ /* @__PURE__ */ jsxs("div", { className: classNames("flex items-end justify-between flex-1", showLineBelow && "items-center"), children: [
657
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center w-full justify-between gap-2", children: [
658
+ /* @__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: [
660
+ headingText,
661
+ /* @__PURE__ */ jsx(Badge, { text: toolName, type: "gray" })
662
+ ] }),
663
+ isDecided && /* @__PURE__ */ jsx(
664
+ IconProvider,
665
+ {
666
+ icon: isDenied ? "circle-xmark" : "check-circle",
667
+ size: 0.75,
668
+ className: classNames("shrink-0", isDenied ? "text-red-500" : "text-green-500")
669
+ }
670
+ )
671
+ ] }),
672
+ !isDecided && !readOnly && selectedDenyOption && /* @__PURE__ */ jsx(Button.Secondary, { text: "Back", size: "small", disabled: interactionsLocked, onClick: () => onDenyOptionChange == null ? void 0 : onDenyOptionChange(null) })
673
+ ] }),
674
+ !isDecided && !readOnly && !selectedDenyOption && /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
675
+ approveOptions.map((option) => {
676
+ const ButtonComponent = option.variant === "destructive" ? Button.Destructive : option.variant === "secondary" ? Button.Secondary : Button.Primary;
677
+ return /* @__PURE__ */ jsx(
678
+ ButtonComponent,
679
+ {
680
+ text: option.label,
681
+ iconToRight: option.variant === "primary",
682
+ icon: option.variant === "primary" ? "check" : void 0,
683
+ size: "small",
684
+ disabled: interactionsLocked,
685
+ onClick: () => onSelect(option.id)
686
+ },
687
+ option.id
688
+ );
689
+ }),
690
+ denyOptions.map((option) => {
691
+ const ButtonComponent = option.variant === "destructive" ? Button.Destructive : option.variant === "primary" ? Button.Primary : Button.Secondary;
692
+ return /* @__PURE__ */ jsx(
693
+ ButtonComponent,
694
+ {
695
+ text: option.label,
696
+ size: "small",
697
+ disabled: interactionsLocked,
698
+ onClick: () => {
699
+ if (option.requiresReason) {
700
+ onDenyOptionChange == null ? void 0 : onDenyOptionChange(option.id);
701
+ } else {
702
+ onSelect(option.id);
703
+ }
704
+ }
705
+ },
706
+ option.id
707
+ );
708
+ })
709
+ ] })
710
+ ] })
711
+ ] }),
712
+ !isDecided && !readOnly && selectedDenyOption && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 pl-7 pt-3", children: [
713
+ (((_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 })
716
+ ] }),
717
+ 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:" }),
719
+ selectedDenyOption.grants.map((grant) => /* @__PURE__ */ jsx(Badge, { text: grant, type: "gray" }, grant))
720
+ ] }),
721
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
722
+ /* @__PURE__ */ jsx(
723
+ Input,
724
+ {
725
+ placeholder: "Enter reason for denial",
726
+ value: denialReason,
727
+ disabled: interactionsLocked,
728
+ onChange: (e) => {
729
+ onDenialReasonChange == null ? void 0 : onDenialReasonChange(e.target.value);
730
+ },
731
+ className: "flex-1 h-6 input-xs",
732
+ wrapperClasses: "w-full input-xs p-0"
733
+ }
734
+ ),
735
+ /* @__PURE__ */ jsx(Button.Primary, { text: "Submit", size: "small", disabled: interactionsLocked, onClick: onReasonSubmit })
736
+ ] }),
737
+ showReasonError && /* @__PURE__ */ jsx("span", { className: "text-xs text-rose-500", children: "Reason is required" })
738
+ ] }),
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: [
740
+ "Reason: ",
741
+ status.reason
742
+ ] }) })
743
+ ] });
744
+ };
745
+ const DEFAULT_AWAITING_TEXT = "Awaiting Response...";
746
+ const DEFAULT_RESPONSE_ICON = ["far", "check-circle"];
747
+ const ToolCallCard = ({
748
+ icon = "mcp-server",
749
+ iconClassName,
750
+ toolName,
751
+ expanded = false,
752
+ onToggle,
753
+ awaiting = false,
754
+ awaitingText = DEFAULT_AWAITING_TEXT,
755
+ showExpandChevron = true,
756
+ showResponseLine = false,
757
+ responseIcon = DEFAULT_RESPONSE_ICON,
758
+ approvalSlot,
759
+ requestSlot,
760
+ responseSlot,
761
+ dataTestPrefix,
762
+ className,
763
+ highlightCard = false
764
+ }) => {
765
+ const hasApproval = !!approvalSlot;
766
+ const showRequestLine = hasApproval || showResponseLine && expanded;
767
+ const isExpandable = showExpandChevron;
768
+ return /* @__PURE__ */ jsxs(
769
+ "div",
770
+ {
771
+ className: classNames(
772
+ "flex flex-col min-w-0",
773
+ {
774
+ "rounded-md p-1 -mx-1": highlightCard,
775
+ "p-0 mx-0": !highlightCard
776
+ },
777
+ className
778
+ ),
779
+ "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" })
833
+ ] }),
834
+ /* @__PURE__ */ jsx("div", { className: "flex-1", "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "response"), children: responseSlot })
835
+ ] })
836
+ ]
837
+ }
838
+ );
839
+ };
840
+ const ToolCallContentBlock = ({
841
+ title,
842
+ content,
843
+ isJson = true,
844
+ copyValue,
845
+ maxHeight = "10.5rem",
846
+ resizable = false,
847
+ fullscreen = false,
848
+ onFullscreenChange,
849
+ contentHeightRem = 1.5,
850
+ contentRef,
851
+ dataTestPrefix,
852
+ className
853
+ }) => {
854
+ return /* @__PURE__ */ jsxs(
855
+ "div",
856
+ {
857
+ className: classNames("flex flex-col text-gray-950 text-xs font-medium leading-4 font-sans", className),
858
+ "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "content-block"),
859
+ children: [
860
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between bg-indigo-50 dark:bg-gray-250 border border-indigo-300 dark:border-gray-275 py-2 px-3 rounded-t-lg", children: [
861
+ /* @__PURE__ */ jsx("div", { className: "text-xs font-medium font-sans text-indigo-600 dark:text-gray-700", children: title }),
862
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
863
+ /* @__PURE__ */ jsx(
864
+ CopyField,
865
+ {
866
+ rawValue: copyValue ?? content,
867
+ icon: ["far", "clone"],
868
+ isIconButton: true,
869
+ dataTestPrefix: dataTestPrefix && toDataTestId(dataTestPrefix, "copy")
870
+ }
871
+ ),
872
+ /* @__PURE__ */ jsx(
873
+ IconButton,
874
+ {
875
+ icon: "expand-alt",
876
+ iconSize: 1.25,
877
+ onClick: () => onFullscreenChange == null ? void 0 : onFullscreenChange(true),
878
+ tooltip: "Expand",
879
+ className: "text-gray-500"
880
+ }
881
+ )
882
+ ] })
883
+ ] }),
884
+ /* @__PURE__ */ jsx(
885
+ "div",
886
+ {
887
+ ref: resizable ? contentRef : void 0,
888
+ className: "overflow-y-auto relative min-h-[1.875rem] rounded-b-lg bg-white dark:bg-gray-200 border border-gray-250 border-t-0",
889
+ style: resizable ? {
890
+ height: `${Math.min(contentHeightRem, 10)}rem`,
891
+ resize: "vertical",
892
+ padding: "0.5rem"
893
+ } : {
894
+ maxHeight,
895
+ padding: "0.5rem"
896
+ },
897
+ children: isJson ? /* @__PURE__ */ jsx(
898
+ SimpleCodeEditor,
899
+ {
900
+ language: "json",
901
+ defaultValue: content,
902
+ value: content,
903
+ readOnly: true,
904
+ isFoldingEnabled: true,
905
+ maxHeight: 10.5,
906
+ initialLinesCount: 1,
907
+ openAsFullscreen: fullscreen,
908
+ onMinimise: () => onFullscreenChange == null ? void 0 : onFullscreenChange(false),
909
+ showExpandOnlyInFullscreen: true,
910
+ className: "border-none !p-1",
911
+ autoLayout: true,
912
+ enableLineNumbersForText: true
913
+ }
914
+ ) : /* @__PURE__ */ jsx(Markdown, { className: "text-gray-600 text-xs", children: content })
915
+ }
916
+ )
917
+ ]
918
+ }
919
+ );
920
+ };
921
+ export {
922
+ ASK_USER_CUSTOM_OPTION,
923
+ AskUserQuestionCard,
924
+ AssistantMessage,
925
+ McpAuthCard,
926
+ ReasoningCard,
927
+ SandboxToolCall,
928
+ SubAgentCard,
929
+ ToolApprovalBlock,
930
+ ToolCallCard,
931
+ ToolCallContentBlock,
932
+ default2 as UserMessage,
933
+ default3 as UserMessageEdit
934
+ };
935
+ //# sourceMappingURL=agent-chat.es.js.map