tfy-web-components 0.0.29 → 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.
@@ -0,0 +1,10 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Renderer } from "@openuidev/react-lang";
3
+ import { ThemeProvider, openuiLibrary } from "@openuidev/react-ui";
4
+ const OpenUiFenceBlock = ({ isStreaming = false, content, darkTheme = true }) => {
5
+ return /* @__PURE__ */ jsx("div", { className: "mb-2 min-h-32 w-full min-w-0", children: /* @__PURE__ */ jsx(ThemeProvider, { mode: darkTheme ? "dark" : "light", cssSelector: ".markdown-openui-scope", children: /* @__PURE__ */ jsx("div", { className: "markdown-openui-scope min-w-0", children: /* @__PURE__ */ jsx(Renderer, { response: content, library: openuiLibrary, isStreaming }) }) }) });
6
+ };
7
+ export {
8
+ OpenUiFenceBlock as default
9
+ };
10
+ //# sourceMappingURL=OpenUiFenceBlock-WFhmUvXt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenUiFenceBlock-WFhmUvXt.js","sources":["../src/components/molecules/Markdown/OpenUiFenceBlock.tsx"],"sourcesContent":["import React from 'react'\nimport { Renderer } from '@openuidev/react-lang'\nimport { openuiLibrary, ThemeProvider } from '@openuidev/react-ui'\n\nimport type { FencedCodeBlockProps } from './codeFencing'\n\nimport '@openuidev/react-ui/defaults.css'\nimport '@openuidev/react-ui/components.css'\n\n/**\n * Renders ```openui … ``` using the official OpenUI component library and theme.\n * Loaded only via dynamic import (see MarkdownWithOpenUI).\n * @see https://www.openui.com/docs/openui-lang\n */\nconst OpenUiFenceBlock: React.FC<FencedCodeBlockProps> = ({ isStreaming = false, content, darkTheme = true }) => {\n return (\n <div className=\"mb-2 min-h-32 w-full min-w-0\">\n <ThemeProvider mode={darkTheme ? 'dark' : 'light'} cssSelector=\".markdown-openui-scope\">\n <div className=\"markdown-openui-scope min-w-0\">\n <Renderer response={content} library={openuiLibrary} isStreaming={isStreaming} />\n </div>\n </ThemeProvider>\n </div>\n )\n}\n\nexport default OpenUiFenceBlock\n"],"names":[],"mappings":";;;AAcA,MAAM,mBAAmD,CAAC,EAAE,cAAc,OAAO,SAAS,YAAY,WAAW;AAC/G,SACE,oBAAC,OAAA,EAAI,WAAU,gCACb,UAAA,oBAAC,iBAAc,MAAM,YAAY,SAAS,SAAS,aAAY,0BAC7D,8BAAC,OAAA,EAAI,WAAU,iCACb,UAAA,oBAAC,UAAA,EAAS,UAAU,SAAS,SAAS,eAAe,YAAA,CAA0B,EAAA,CACjF,EAAA,CACF,GACF;AAEJ;"}
@@ -314,7 +314,7 @@ const SandboxArtifactsFenceBlock = ({
314
314
  }
315
315
  );
316
316
  };
317
- const preloadMarkdownOpenUI = () => import("../../OpenUiFenceBlock-C4ZpWd0O.js");
317
+ const preloadMarkdownOpenUI = () => import("../../OpenUiFenceBlock-WFhmUvXt.js");
318
318
  const OpenUiFenceBlockLazy = lazy(preloadMarkdownOpenUI);
319
319
  const SuspensedOpenUiFenceBlock = (props) => {
320
320
  return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Spinner, { small: true, center: true }), children: /* @__PURE__ */ jsx(OpenUiFenceBlockLazy, { ...props }) });
@@ -24,6 +24,7 @@ export interface AgentStepRowProps {
24
24
  dataTestPrefix?: string;
25
25
  className?: string;
26
26
  titleClassName?: string;
27
+ align?: 'center' | 'start';
27
28
  }
28
29
  declare const AgentStepRow: React.FC<AgentStepRowProps>;
29
30
  export default AgentStepRow;
@@ -11,6 +11,7 @@ export interface ToolCallCardProps {
11
11
  awaiting?: boolean;
12
12
  awaitingText?: string;
13
13
  status?: AgentStepStatus;
14
+ exitCode?: number | null;
14
15
  showExpandChevron?: boolean;
15
16
  showResponseLine?: boolean;
16
17
  responseIcon?: any;
@@ -31,34 +31,25 @@ const StatusDot = ({ className, colorClassName = "bg-orange-500" }) => {
31
31
  };
32
32
  const StepIconBox = ({
33
33
  icon,
34
- iconSize = 0.875,
34
+ iconSize = 0.75,
35
35
  variant = "primary",
36
36
  className,
37
37
  iconClassName
38
38
  }) => {
39
- return /* @__PURE__ */ jsx(
40
- "div",
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
- icon,
50
- size: iconSize,
51
- className: classNames(
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-6 shrink-0 cursor-pointer",
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.625,
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__ */ jsxs("div", { className: "flex flex-col items-center shrink-0", children: [
120
- /* @__PURE__ */ jsx(StepIconBox, { icon, variant: iconVariant, iconClassName, iconSize }),
121
- showConnector && (expanded && hasChildren || hasPersistentChildren) && /* @__PURE__ */ jsx("div", { className: "w-px flex-1 bg-gray-300 mt-1" })
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("text-sm font-medium text-gray-750 font-sans", titleClassName),
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-2 min-w-0 mt-2",
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-6", children: /* @__PURE__ */ jsx("div", { className: "w-px bg-gray-300" }) }),
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-2 min-w-0",
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-6", children: /* @__PURE__ */ jsx("div", { className: "w-px bg-gray-300" }) }),
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
- if (isShortText) {
540
- return /* @__PURE__ */ jsx("div", { className, "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "reasoning-inline"), children: /* @__PURE__ */ jsx(
541
- AgentStepRow,
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
- icon: isStreaming ? "brain" : "brain-regular",
566
- iconVariant: "primary",
567
- label: headingText,
568
- 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 font-sans text-sm", children: content }) }) : !expanded && previewText ? /* @__PURE__ */ jsx("div", { className: "border-l-4 border-l-blue-500 pl-3 text-gray-600 text-sm font-normal font-sans truncate", children: previewText }) : void 0,
569
- expandable: isExpandable,
570
- expanded,
571
- onToggle,
572
- status,
573
- dataTestPrefix
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("span", { className: "text-teal-500", children: "$" }),
686
- " ",
687
- command
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__ */ jsx("div", { className: "break-all border-l-4 border-purple-400 px-3 my-1", children: resultText })
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__ */ jsx("div", { className: "border-l-4 border-purple-400 px-3 my-1", children: /* @__PURE__ */ jsx(
695
- SimpleCodeEditor,
696
- {
697
- language: "json",
698
- defaultValue: resultJson,
699
- value: resultJson,
700
- readOnly: true,
701
- maxHeight: 10.5,
702
- initialLinesCount: 1,
703
- disableEditorResize: true,
704
- enableExpand: true,
705
- autoLayout: true,
706
- hideLineNumbers: true,
707
- className: "pl-2",
708
- isFoldingEnabled: true
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
- const derivedStatus = explicitStatus || (awaiting ? "running" : showResponseLine ? "success" : "idle");
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", { className: "pt-2", "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "response"), children: responseSlot })
979
+ expanded && showResponseLine && responseSlot && /* @__PURE__ */ jsx("div", { "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "response"), children: responseSlot })
972
980
  ] }),
973
- children: requestSlot && /* @__PURE__ */ jsx("div", { className: "pt-2 pb-2", "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "request"), children: requestSlot })
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
  }