@uipath/apollo-react 4.5.1 → 4.5.3

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 (39) hide show
  1. package/dist/canvas/styles/tailwind.canvas.css +1 -1
  2. package/dist/material/components/ap-chat/components/message/suggestions/chat-suggestions.cjs +1 -0
  3. package/dist/material/components/ap-chat/components/message/suggestions/chat-suggestions.d.ts.map +1 -1
  4. package/dist/material/components/ap-chat/components/message/suggestions/chat-suggestions.js +1 -0
  5. package/dist/material/components/ap-tool-call/ApToolCall.cjs +127 -41
  6. package/dist/material/components/ap-tool-call/ApToolCall.d.ts.map +1 -1
  7. package/dist/material/components/ap-tool-call/ApToolCall.js +123 -38
  8. package/dist/material/components/ap-tool-call/ApToolCall.types.cjs +23 -1
  9. package/dist/material/components/ap-tool-call/ApToolCall.types.d.ts +9 -1
  10. package/dist/material/components/ap-tool-call/ApToolCall.types.d.ts.map +1 -1
  11. package/dist/material/components/ap-tool-call/ApToolCall.types.js +6 -0
  12. package/dist/material/components/ap-tool-call/assets/spanIcons.cjs +221 -0
  13. package/dist/material/components/ap-tool-call/assets/spanIcons.d.ts +2 -0
  14. package/dist/material/components/ap-tool-call/assets/spanIcons.d.ts.map +1 -0
  15. package/dist/material/components/ap-tool-call/assets/spanIcons.js +187 -0
  16. package/dist/material/components/ap-tool-call/components/NestedValue.d.ts +4 -0
  17. package/dist/material/components/ap-tool-call/components/NestedValue.d.ts.map +1 -0
  18. package/dist/material/components/ap-tool-call/{ToolCallSection.cjs → components/ToolCallSection.cjs} +5 -1
  19. package/dist/material/components/ap-tool-call/components/ToolCallSection.d.ts +4 -0
  20. package/dist/material/components/ap-tool-call/components/ToolCallSection.d.ts.map +1 -0
  21. package/dist/material/components/ap-tool-call/{ToolCallSection.js → components/ToolCallSection.js} +5 -1
  22. package/dist/material/components/ap-tool-call/index.cjs +8 -4
  23. package/dist/material/components/ap-tool-call/index.d.ts +4 -3
  24. package/dist/material/components/ap-tool-call/index.d.ts.map +1 -1
  25. package/dist/material/components/ap-tool-call/index.js +4 -3
  26. package/dist/material/components/ap-tool-call/locales/en.cjs +1 -1
  27. package/dist/material/components/ap-tool-call/locales/en.d.ts.map +1 -1
  28. package/dist/material/components/ap-tool-call/locales/en.js +1 -1
  29. package/dist/material/components/ap-tool-call/utils/traceIconUtils.cjs +254 -0
  30. package/dist/material/components/ap-tool-call/utils/traceIconUtils.d.ts +3 -0
  31. package/dist/material/components/ap-tool-call/utils/traceIconUtils.d.ts.map +1 -0
  32. package/dist/material/components/ap-tool-call/utils/traceIconUtils.js +220 -0
  33. package/package.json +2 -2
  34. package/dist/material/components/ap-tool-call/NestedValue.d.ts +0 -4
  35. package/dist/material/components/ap-tool-call/NestedValue.d.ts.map +0 -1
  36. package/dist/material/components/ap-tool-call/ToolCallSection.d.ts +0 -4
  37. package/dist/material/components/ap-tool-call/ToolCallSection.d.ts.map +0 -1
  38. /package/dist/material/components/ap-tool-call/{NestedValue.cjs → components/NestedValue.cjs} +0 -0
  39. /package/dist/material/components/ap-tool-call/{NestedValue.js → components/NestedValue.js} +0 -0
@@ -68,6 +68,7 @@ const Suggestion = (0, material_namespaceObject.styled)('button')(({ padding })=
68
68
  outlineColor: 'var(--color-focus-indicator)',
69
69
  display: 'flex',
70
70
  alignItems: 'center',
71
+ textAlign: 'left',
71
72
  width: 'fit-content',
72
73
  gap: apollo_core_default().Spacing.SpacingXs,
73
74
  padding,
@@ -1 +1 @@
1
- {"version":3,"file":"chat-suggestions.d.ts","sourceRoot":"","sources":["../../../../../../../src/material/components/ap-chat/components/message/suggestions/chat-suggestions.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAA8B,KAAK,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AA2C5F,UAAU,6BAA6B;IACrC,WAAW,EAAE,uBAAuB,EAAE,CAAC;IACvC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,iBAAS,iCAAiC,CAAC,EACzC,YAAY,EACZ,WAAW,EACX,WAAW,EACX,gBAAgB,GACjB,EAAE,6BAA6B,2CA2D/B;AAED,eAAO,MAAM,wBAAwB,qEAAgD,CAAC"}
1
+ {"version":3,"file":"chat-suggestions.d.ts","sourceRoot":"","sources":["../../../../../../../src/material/components/ap-chat/components/message/suggestions/chat-suggestions.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAA8B,KAAK,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AA4C5F,UAAU,6BAA6B;IACrC,WAAW,EAAE,uBAAuB,EAAE,CAAC;IACvC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,iBAAS,iCAAiC,CAAC,EACzC,YAAY,EACZ,WAAW,EACX,WAAW,EACX,gBAAgB,GACjB,EAAE,6BAA6B,2CA2D/B;AAED,eAAO,MAAM,wBAAwB,qEAAgD,CAAC"}
@@ -29,6 +29,7 @@ const Suggestion = styled('button')(({ padding })=>({
29
29
  outlineColor: 'var(--color-focus-indicator)',
30
30
  display: 'flex',
31
31
  alignItems: 'center',
32
+ textAlign: 'left',
32
33
  width: 'fit-content',
33
34
  gap: apollo_core.Spacing.SpacingXs,
34
35
  padding,
@@ -43,12 +43,16 @@ const Error_namespaceObject = require("@mui/icons-material/Error");
43
43
  var Error_default = /*#__PURE__*/ __webpack_require__.n(Error_namespaceObject);
44
44
  const KeyboardArrowDown_namespaceObject = require("@mui/icons-material/KeyboardArrowDown");
45
45
  var KeyboardArrowDown_default = /*#__PURE__*/ __webpack_require__.n(KeyboardArrowDown_namespaceObject);
46
+ const KeyboardArrowRight_namespaceObject = require("@mui/icons-material/KeyboardArrowRight");
47
+ var KeyboardArrowRight_default = /*#__PURE__*/ __webpack_require__.n(KeyboardArrowRight_namespaceObject);
46
48
  const material_namespaceObject = require("@mui/material");
47
49
  const apollo_core_namespaceObject = require("@uipath/apollo-core");
48
50
  var apollo_core_default = /*#__PURE__*/ __webpack_require__.n(apollo_core_namespaceObject);
49
51
  const external_react_namespaceObject = require("react");
50
52
  var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
51
- const external_ToolCallSection_cjs_namespaceObject = require("./ToolCallSection.cjs");
53
+ const external_ApToolCall_types_cjs_namespaceObject = require("./ApToolCall.types.cjs");
54
+ const ToolCallSection_cjs_namespaceObject = require("./components/ToolCallSection.cjs");
55
+ const traceIconUtils_cjs_namespaceObject = require("./utils/traceIconUtils.cjs");
52
56
  const Container = (0, material_namespaceObject.styled)('div')({
53
57
  fontSize: apollo_core_default().FontFamily.FontMSize,
54
58
  padding: apollo_core_default().Spacing.SpacingS,
@@ -94,13 +98,20 @@ const ArrowIcon = (0, material_namespaceObject.styled)(KeyboardArrowDown_default
94
98
  marginLeft: apollo_core_default().Spacing.SpacingXs,
95
99
  transform: expanded ? 'rotate(180deg)' : 'none'
96
100
  }));
101
+ const TraceArrowIcon = (0, material_namespaceObject.styled)(KeyboardArrowRight_default(), {
102
+ shouldForwardProp: (prop)=>'expanded' !== prop
103
+ })(({ expanded })=>({
104
+ transition: 'transform 0.2s ease',
105
+ transform: expanded ? 'rotate(90deg)' : 'none',
106
+ flexShrink: 0
107
+ }));
97
108
  const SectionsContainer = (0, material_namespaceObject.styled)('div', {
98
109
  shouldForwardProp: (prop)=>'expanded' !== prop
99
110
  })(({ expanded })=>({
100
111
  marginLeft: apollo_core_default().Spacing.SpacingS,
101
112
  paddingLeft: apollo_core_default().Spacing.SpacingS,
102
113
  borderLeft: `${apollo_core_default().Border.BorderThickS} solid var(--color-border)`,
103
- maxHeight: expanded ? '500px' : '0',
114
+ maxHeight: expanded ? 'fit-content' : '0',
104
115
  overflow: 'hidden',
105
116
  transition: 'max-height 0.2s ease',
106
117
  maxWidth: `calc(100% - ${apollo_core_default().Spacing.SpacingBase})`,
@@ -110,47 +121,107 @@ const SectionsContainer = (0, material_namespaceObject.styled)('div', {
110
121
  outlineOffset: '-1px'
111
122
  }
112
123
  }));
113
- const ExecutionItemsContainer = (0, material_namespaceObject.styled)('div')({
124
+ const TraceItemsContainer = (0, material_namespaceObject.styled)('div')({
114
125
  marginTop: apollo_core_default().Spacing.SpacingMicro,
115
126
  paddingLeft: apollo_core_default().Spacing.SpacingMicro
116
127
  });
117
- const ExecutionItemContainer = (0, material_namespaceObject.styled)('div')({
118
- display: 'flex',
119
- alignItems: 'center',
120
- gap: apollo_core_default().Spacing.SpacingS,
121
- marginBottom: apollo_core_default().Spacing.SpacingS
128
+ const TraceItemContainer = (0, material_namespaceObject.styled)('div', {
129
+ shouldForwardProp: (prop)=>'clickable' !== prop
130
+ })(({ clickable })=>({
131
+ display: 'flex',
132
+ alignItems: 'center',
133
+ gap: apollo_core_default().Spacing.SpacingXs,
134
+ marginBottom: apollo_core_default().Spacing.SpacingS,
135
+ ...clickable && {
136
+ cursor: 'pointer',
137
+ borderRadius: apollo_core_default().Spacing.SpacingMicro,
138
+ '&:hover': {
139
+ backgroundColor: 'var(--color-background-hover)'
140
+ }
141
+ }
142
+ }));
143
+ const TraceName = (0, material_namespaceObject.styled)('span')({
144
+ display: 'inline-block',
145
+ flex: 1
122
146
  });
123
- const ExecutionIcon = (0, material_namespaceObject.styled)('span')({
147
+ const ArrowPlaceholder = (0, material_namespaceObject.styled)('span')({
148
+ width: '20px',
149
+ flexShrink: 0,
150
+ display: 'inline-block'
151
+ });
152
+ const TraceIcon = (0, material_namespaceObject.styled)('span')({
124
153
  display: 'inline-flex',
125
154
  alignItems: 'center',
126
- width: apollo_core_default().Spacing.SpacingM,
127
- height: apollo_core_default().Spacing.SpacingM
128
- });
129
- const ExecutionName = (0, material_namespaceObject.styled)('span')({
130
- display: 'inline-block',
131
- flex: 1
155
+ flexShrink: 0,
156
+ width: '16px',
157
+ height: '16px',
158
+ '& svg': {
159
+ width: '100%',
160
+ height: '100%'
161
+ }
132
162
  });
133
- const ExecutionItem = ({ child })=>{
134
- const icon = (0, external_react_namespaceObject.useMemo)(()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ExecutionIcon, {}), [
163
+ function getVisibleChildren(node) {
164
+ const result = [];
165
+ for (const child of node.children ?? [])if ('llmCall' !== child.data.type && 'agentOutput' !== child.data.type) result.push(child);
166
+ return result;
167
+ }
168
+ const TraceItem = ({ child, depth = 0 })=>{
169
+ const visibleChildren = (0, external_react_namespaceObject.useMemo)(()=>getVisibleChildren(child), [
170
+ child
171
+ ]);
172
+ const hasChildren = visibleChildren.length > 0;
173
+ const [itemExpanded, setItemExpanded] = (0, external_react_namespaceObject.useState)(false);
174
+ const iconSvg = (0, external_react_namespaceObject.useMemo)(()=>(0, traceIconUtils_cjs_namespaceObject.getSpanIconSvg)(child.data), [
135
175
  child.data
136
176
  ]);
137
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(ExecutionItemContainer, {
177
+ const handleKeyDown = (event)=>{
178
+ if ('Enter' === event.key || ' ' === event.key) {
179
+ event.preventDefault();
180
+ setItemExpanded((prev)=>!prev);
181
+ }
182
+ };
183
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
138
184
  children: [
139
- icon,
140
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ExecutionName, {
141
- children: child.name
142
- })
185
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(TraceItemContainer, {
186
+ clickable: hasChildren,
187
+ style: {
188
+ paddingLeft: depth > 0 ? `calc(${depth} * ${apollo_core_default().Spacing.SpacingM})` : void 0
189
+ },
190
+ onClick: hasChildren ? ()=>setItemExpanded((prev)=>!prev) : void 0,
191
+ role: hasChildren ? 'button' : void 0,
192
+ tabIndex: hasChildren ? 0 : void 0,
193
+ onKeyDown: hasChildren ? handleKeyDown : void 0,
194
+ "aria-expanded": hasChildren ? itemExpanded : void 0,
195
+ children: [
196
+ hasChildren ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TraceArrowIcon, {
197
+ fontSize: "small",
198
+ expanded: itemExpanded
199
+ }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ArrowPlaceholder, {}),
200
+ iconSvg && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TraceIcon, {
201
+ dangerouslySetInnerHTML: {
202
+ __html: iconSvg
203
+ }
204
+ }),
205
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TraceName, {
206
+ children: child.name.replace('_', ' ')
207
+ })
208
+ ]
209
+ }),
210
+ hasChildren && itemExpanded && visibleChildren.map((c)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TraceItemContent, {
211
+ child: c,
212
+ depth: depth + 1
213
+ }, c.key))
143
214
  ]
144
215
  });
145
216
  };
146
- const ExecutionItemContent = /*#__PURE__*/ external_react_default().memo(ExecutionItem);
217
+ const TraceItemContent = /*#__PURE__*/ external_react_default().memo(TraceItem);
147
218
  const ApToolCall = /*#__PURE__*/ external_react_default().forwardRef((props, ref)=>{
148
- const { span, toolName, input, output, isError, startTime, endTime } = props;
219
+ const { span, toolName, input, output, isError, startTime, endTime, displayMode } = props;
149
220
  const { _ } = (0, react_namespaceObject.useLingui)();
150
221
  const [toolCallExpanded, setToolCallExpanded] = (0, external_react_namespaceObject.useState)(false);
151
222
  const [expandedSections, setExpandedSections] = (0, external_react_namespaceObject.useState)({
152
223
  input: false,
153
- execution: false,
224
+ traces: false,
154
225
  escalation: true,
155
226
  output: false,
156
227
  errors: false
@@ -278,6 +349,16 @@ const ApToolCall = /*#__PURE__*/ external_react_default().forwardRef((props, ref
278
349
  }, [
279
350
  toolCallExpanded
280
351
  ]);
352
+ if (displayMode === external_ApToolCall_types_cjs_namespaceObject.ConversationalDisplayModeTypes.ToolNameOnly) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Container, {
353
+ ref: ref,
354
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(Header, {
355
+ children: [
356
+ renderStatusIcon,
357
+ " ",
358
+ getStatusText
359
+ ]
360
+ })
361
+ });
281
362
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(Container, {
282
363
  ref: ref,
283
364
  children: [
@@ -299,8 +380,12 @@ const ApToolCall = /*#__PURE__*/ external_react_default().forwardRef((props, ref
299
380
  }),
300
381
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(SectionsContainer, {
301
382
  expanded: toolCallExpanded,
383
+ "aria-hidden": !toolCallExpanded,
384
+ ...!toolCallExpanded && {
385
+ inert: true
386
+ },
302
387
  children: [
303
- (input || span && getAttributes(span.data).arguments) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_ToolCallSection_cjs_namespaceObject.ToolCallSection, {
388
+ (input || span && getAttributes(span.data).arguments) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ToolCallSection_cjs_namespaceObject.ToolCallSection, {
304
389
  type: "input",
305
390
  title: _({
306
391
  id: 'tool-call.input'
@@ -308,27 +393,28 @@ const ApToolCall = /*#__PURE__*/ external_react_default().forwardRef((props, ref
308
393
  isExpanded: expandedSections['input'],
309
394
  onToggle: ()=>setExpandedSections((prev)=>({
310
395
  ...prev,
311
- ['input']: !prev['input']
396
+ input: !prev['input']
312
397
  })),
313
398
  data: input || (span ? getAttributes(span.data).arguments : void 0)
314
399
  }),
315
- span?.children?.length ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_ToolCallSection_cjs_namespaceObject.ToolCallSection, {
316
- type: "execution",
400
+ displayMode === external_ApToolCall_types_cjs_namespaceObject.ConversationalDisplayModeTypes.FullTrace && span?.children?.length ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ToolCallSection_cjs_namespaceObject.ToolCallSection, {
401
+ type: "traces",
317
402
  title: _({
318
- id: 'tool-call.execution'
403
+ id: 'tool-call.traces'
319
404
  }),
320
- isExpanded: expandedSections['execution'],
405
+ isExpanded: expandedSections['traces'],
321
406
  onToggle: ()=>setExpandedSections((prev)=>({
322
407
  ...prev,
323
- ['execution']: !prev['execution']
408
+ traces: !prev['traces']
324
409
  })),
325
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ExecutionItemsContainer, {
326
- children: span.children?.map((child)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ExecutionItemContent, {
327
- child: child
410
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TraceItemsContainer, {
411
+ children: getVisibleChildren(span).map((child)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TraceItemContent, {
412
+ child: child,
413
+ depth: 0
328
414
  }, child.key))
329
415
  })
330
416
  }) : null,
331
- taskUrls.length > 0 ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_ToolCallSection_cjs_namespaceObject.ToolCallSection, {
417
+ taskUrls.length > 0 ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ToolCallSection_cjs_namespaceObject.ToolCallSection, {
332
418
  type: "escalation",
333
419
  title: _({
334
420
  id: 'tool-call.escalation'
@@ -336,13 +422,13 @@ const ApToolCall = /*#__PURE__*/ external_react_default().forwardRef((props, ref
336
422
  isExpanded: expandedSections['escalation'],
337
423
  onToggle: ()=>setExpandedSections((prev)=>({
338
424
  ...prev,
339
- ['escalation']: !prev['escalation']
425
+ escalation: !prev['escalation']
340
426
  })),
341
427
  data: {
342
428
  taskUrls
343
429
  }
344
430
  }) : null,
345
- (isError && output || span && getAttributes(span.data).error) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_ToolCallSection_cjs_namespaceObject.ToolCallSection, {
431
+ (isError && output || span && getAttributes(span.data).error) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ToolCallSection_cjs_namespaceObject.ToolCallSection, {
346
432
  type: "errors",
347
433
  title: _({
348
434
  id: 'tool-call.errors'
@@ -350,11 +436,11 @@ const ApToolCall = /*#__PURE__*/ external_react_default().forwardRef((props, ref
350
436
  isExpanded: expandedSections['errors'],
351
437
  onToggle: ()=>setExpandedSections((prev)=>({
352
438
  ...prev,
353
- ['errors']: !prev['errors']
439
+ errors: !prev['errors']
354
440
  })),
355
441
  data: isError && output ? output : span ? getAttributes(span.data).error : {}
356
442
  }),
357
- (!isError && output || span && getAttributes(span.data).result) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_ToolCallSection_cjs_namespaceObject.ToolCallSection, {
443
+ (!isError && output || span && getAttributes(span.data).result) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ToolCallSection_cjs_namespaceObject.ToolCallSection, {
358
444
  type: "output",
359
445
  title: _({
360
446
  id: 'tool-call.output'
@@ -362,7 +448,7 @@ const ApToolCall = /*#__PURE__*/ external_react_default().forwardRef((props, ref
362
448
  isExpanded: expandedSections['output'],
363
449
  onToggle: ()=>setExpandedSections((prev)=>({
364
450
  ...prev,
365
- ['output']: !prev['output']
451
+ output: !prev['output']
366
452
  })),
367
453
  data: output || (span ? getAttributes(span.data).result : {}) || {}
368
454
  })
@@ -1 +1 @@
1
- {"version":3,"file":"ApToolCall.d.ts","sourceRoot":"","sources":["../../../../src/material/components/ap-tool-call/ApToolCall.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAoD,MAAM,OAAO,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,oBAAoB,CAAC;AAuH5E,eAAO,MAAM,UAAU,wFA2RrB,CAAC"}
1
+ {"version":3,"file":"ApToolCall.d.ts","sourceRoot":"","sources":["../../../../src/material/components/ap-tool-call/ApToolCall.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAoD,MAAM,OAAO,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,oBAAoB,CAAC;AAyL5E,eAAO,MAAM,UAAU,wFAySrB,CAAC"}
@@ -1,12 +1,15 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useLingui } from "@lingui/react";
3
3
  import CheckCircle from "@mui/icons-material/CheckCircle";
4
4
  import Error from "@mui/icons-material/Error";
5
5
  import KeyboardArrowDown from "@mui/icons-material/KeyboardArrowDown";
6
+ import KeyboardArrowRight from "@mui/icons-material/KeyboardArrowRight";
6
7
  import { CircularProgress, styled } from "@mui/material";
7
8
  import apollo_core from "@uipath/apollo-core";
8
9
  import react, { useCallback, useEffect, useMemo, useState } from "react";
9
- import { ToolCallSection } from "./ToolCallSection.js";
10
+ import { ConversationalDisplayModeTypes } from "./ApToolCall.types.js";
11
+ import { ToolCallSection } from "./components/ToolCallSection.js";
12
+ import { getSpanIconSvg } from "./utils/traceIconUtils.js";
10
13
  const Container = styled('div')({
11
14
  fontSize: apollo_core.FontFamily.FontMSize,
12
15
  padding: apollo_core.Spacing.SpacingS,
@@ -52,13 +55,20 @@ const ArrowIcon = styled(KeyboardArrowDown, {
52
55
  marginLeft: apollo_core.Spacing.SpacingXs,
53
56
  transform: expanded ? 'rotate(180deg)' : 'none'
54
57
  }));
58
+ const TraceArrowIcon = styled(KeyboardArrowRight, {
59
+ shouldForwardProp: (prop)=>'expanded' !== prop
60
+ })(({ expanded })=>({
61
+ transition: 'transform 0.2s ease',
62
+ transform: expanded ? 'rotate(90deg)' : 'none',
63
+ flexShrink: 0
64
+ }));
55
65
  const SectionsContainer = styled('div', {
56
66
  shouldForwardProp: (prop)=>'expanded' !== prop
57
67
  })(({ expanded })=>({
58
68
  marginLeft: apollo_core.Spacing.SpacingS,
59
69
  paddingLeft: apollo_core.Spacing.SpacingS,
60
70
  borderLeft: `${apollo_core.Border.BorderThickS} solid var(--color-border)`,
61
- maxHeight: expanded ? '500px' : '0',
71
+ maxHeight: expanded ? 'fit-content' : '0',
62
72
  overflow: 'hidden',
63
73
  transition: 'max-height 0.2s ease',
64
74
  maxWidth: `calc(100% - ${apollo_core.Spacing.SpacingBase})`,
@@ -68,47 +78,107 @@ const SectionsContainer = styled('div', {
68
78
  outlineOffset: '-1px'
69
79
  }
70
80
  }));
71
- const ExecutionItemsContainer = styled('div')({
81
+ const TraceItemsContainer = styled('div')({
72
82
  marginTop: apollo_core.Spacing.SpacingMicro,
73
83
  paddingLeft: apollo_core.Spacing.SpacingMicro
74
84
  });
75
- const ExecutionItemContainer = styled('div')({
76
- display: 'flex',
77
- alignItems: 'center',
78
- gap: apollo_core.Spacing.SpacingS,
79
- marginBottom: apollo_core.Spacing.SpacingS
85
+ const TraceItemContainer = styled('div', {
86
+ shouldForwardProp: (prop)=>'clickable' !== prop
87
+ })(({ clickable })=>({
88
+ display: 'flex',
89
+ alignItems: 'center',
90
+ gap: apollo_core.Spacing.SpacingXs,
91
+ marginBottom: apollo_core.Spacing.SpacingS,
92
+ ...clickable && {
93
+ cursor: 'pointer',
94
+ borderRadius: apollo_core.Spacing.SpacingMicro,
95
+ '&:hover': {
96
+ backgroundColor: 'var(--color-background-hover)'
97
+ }
98
+ }
99
+ }));
100
+ const TraceName = styled('span')({
101
+ display: 'inline-block',
102
+ flex: 1
80
103
  });
81
- const ExecutionIcon = styled('span')({
104
+ const ArrowPlaceholder = styled('span')({
105
+ width: '20px',
106
+ flexShrink: 0,
107
+ display: 'inline-block'
108
+ });
109
+ const TraceIcon = styled('span')({
82
110
  display: 'inline-flex',
83
111
  alignItems: 'center',
84
- width: apollo_core.Spacing.SpacingM,
85
- height: apollo_core.Spacing.SpacingM
86
- });
87
- const ExecutionName = styled('span')({
88
- display: 'inline-block',
89
- flex: 1
112
+ flexShrink: 0,
113
+ width: '16px',
114
+ height: '16px',
115
+ '& svg': {
116
+ width: '100%',
117
+ height: '100%'
118
+ }
90
119
  });
91
- const ExecutionItem = ({ child })=>{
92
- const icon = useMemo(()=>/*#__PURE__*/ jsx(ExecutionIcon, {}), [
120
+ function getVisibleChildren(node) {
121
+ const result = [];
122
+ for (const child of node.children ?? [])if ('llmCall' !== child.data.type && 'agentOutput' !== child.data.type) result.push(child);
123
+ return result;
124
+ }
125
+ const TraceItem = ({ child, depth = 0 })=>{
126
+ const visibleChildren = useMemo(()=>getVisibleChildren(child), [
127
+ child
128
+ ]);
129
+ const hasChildren = visibleChildren.length > 0;
130
+ const [itemExpanded, setItemExpanded] = useState(false);
131
+ const iconSvg = useMemo(()=>getSpanIconSvg(child.data), [
93
132
  child.data
94
133
  ]);
95
- return /*#__PURE__*/ jsxs(ExecutionItemContainer, {
134
+ const handleKeyDown = (event)=>{
135
+ if ('Enter' === event.key || ' ' === event.key) {
136
+ event.preventDefault();
137
+ setItemExpanded((prev)=>!prev);
138
+ }
139
+ };
140
+ return /*#__PURE__*/ jsxs(Fragment, {
96
141
  children: [
97
- icon,
98
- /*#__PURE__*/ jsx(ExecutionName, {
99
- children: child.name
100
- })
142
+ /*#__PURE__*/ jsxs(TraceItemContainer, {
143
+ clickable: hasChildren,
144
+ style: {
145
+ paddingLeft: depth > 0 ? `calc(${depth} * ${apollo_core.Spacing.SpacingM})` : void 0
146
+ },
147
+ onClick: hasChildren ? ()=>setItemExpanded((prev)=>!prev) : void 0,
148
+ role: hasChildren ? 'button' : void 0,
149
+ tabIndex: hasChildren ? 0 : void 0,
150
+ onKeyDown: hasChildren ? handleKeyDown : void 0,
151
+ "aria-expanded": hasChildren ? itemExpanded : void 0,
152
+ children: [
153
+ hasChildren ? /*#__PURE__*/ jsx(TraceArrowIcon, {
154
+ fontSize: "small",
155
+ expanded: itemExpanded
156
+ }) : /*#__PURE__*/ jsx(ArrowPlaceholder, {}),
157
+ iconSvg && /*#__PURE__*/ jsx(TraceIcon, {
158
+ dangerouslySetInnerHTML: {
159
+ __html: iconSvg
160
+ }
161
+ }),
162
+ /*#__PURE__*/ jsx(TraceName, {
163
+ children: child.name.replace('_', ' ')
164
+ })
165
+ ]
166
+ }),
167
+ hasChildren && itemExpanded && visibleChildren.map((c)=>/*#__PURE__*/ jsx(TraceItemContent, {
168
+ child: c,
169
+ depth: depth + 1
170
+ }, c.key))
101
171
  ]
102
172
  });
103
173
  };
104
- const ExecutionItemContent = /*#__PURE__*/ react.memo(ExecutionItem);
174
+ const TraceItemContent = /*#__PURE__*/ react.memo(TraceItem);
105
175
  const ApToolCall = /*#__PURE__*/ react.forwardRef((props, ref)=>{
106
- const { span, toolName, input, output, isError, startTime, endTime } = props;
176
+ const { span, toolName, input, output, isError, startTime, endTime, displayMode } = props;
107
177
  const { _ } = useLingui();
108
178
  const [toolCallExpanded, setToolCallExpanded] = useState(false);
109
179
  const [expandedSections, setExpandedSections] = useState({
110
180
  input: false,
111
- execution: false,
181
+ traces: false,
112
182
  escalation: true,
113
183
  output: false,
114
184
  errors: false
@@ -236,6 +306,16 @@ const ApToolCall = /*#__PURE__*/ react.forwardRef((props, ref)=>{
236
306
  }, [
237
307
  toolCallExpanded
238
308
  ]);
309
+ if (displayMode === ConversationalDisplayModeTypes.ToolNameOnly) return /*#__PURE__*/ jsx(Container, {
310
+ ref: ref,
311
+ children: /*#__PURE__*/ jsxs(Header, {
312
+ children: [
313
+ renderStatusIcon,
314
+ " ",
315
+ getStatusText
316
+ ]
317
+ })
318
+ });
239
319
  return /*#__PURE__*/ jsxs(Container, {
240
320
  ref: ref,
241
321
  children: [
@@ -257,6 +337,10 @@ const ApToolCall = /*#__PURE__*/ react.forwardRef((props, ref)=>{
257
337
  }),
258
338
  /*#__PURE__*/ jsxs(SectionsContainer, {
259
339
  expanded: toolCallExpanded,
340
+ "aria-hidden": !toolCallExpanded,
341
+ ...!toolCallExpanded && {
342
+ inert: true
343
+ },
260
344
  children: [
261
345
  (input || span && getAttributes(span.data).arguments) && /*#__PURE__*/ jsx(ToolCallSection, {
262
346
  type: "input",
@@ -266,23 +350,24 @@ const ApToolCall = /*#__PURE__*/ react.forwardRef((props, ref)=>{
266
350
  isExpanded: expandedSections['input'],
267
351
  onToggle: ()=>setExpandedSections((prev)=>({
268
352
  ...prev,
269
- ['input']: !prev['input']
353
+ input: !prev['input']
270
354
  })),
271
355
  data: input || (span ? getAttributes(span.data).arguments : void 0)
272
356
  }),
273
- span?.children?.length ? /*#__PURE__*/ jsx(ToolCallSection, {
274
- type: "execution",
357
+ displayMode === ConversationalDisplayModeTypes.FullTrace && span?.children?.length ? /*#__PURE__*/ jsx(ToolCallSection, {
358
+ type: "traces",
275
359
  title: _({
276
- id: 'tool-call.execution'
360
+ id: 'tool-call.traces'
277
361
  }),
278
- isExpanded: expandedSections['execution'],
362
+ isExpanded: expandedSections['traces'],
279
363
  onToggle: ()=>setExpandedSections((prev)=>({
280
364
  ...prev,
281
- ['execution']: !prev['execution']
365
+ traces: !prev['traces']
282
366
  })),
283
- children: /*#__PURE__*/ jsx(ExecutionItemsContainer, {
284
- children: span.children?.map((child)=>/*#__PURE__*/ jsx(ExecutionItemContent, {
285
- child: child
367
+ children: /*#__PURE__*/ jsx(TraceItemsContainer, {
368
+ children: getVisibleChildren(span).map((child)=>/*#__PURE__*/ jsx(TraceItemContent, {
369
+ child: child,
370
+ depth: 0
286
371
  }, child.key))
287
372
  })
288
373
  }) : null,
@@ -294,7 +379,7 @@ const ApToolCall = /*#__PURE__*/ react.forwardRef((props, ref)=>{
294
379
  isExpanded: expandedSections['escalation'],
295
380
  onToggle: ()=>setExpandedSections((prev)=>({
296
381
  ...prev,
297
- ['escalation']: !prev['escalation']
382
+ escalation: !prev['escalation']
298
383
  })),
299
384
  data: {
300
385
  taskUrls
@@ -308,7 +393,7 @@ const ApToolCall = /*#__PURE__*/ react.forwardRef((props, ref)=>{
308
393
  isExpanded: expandedSections['errors'],
309
394
  onToggle: ()=>setExpandedSections((prev)=>({
310
395
  ...prev,
311
- ['errors']: !prev['errors']
396
+ errors: !prev['errors']
312
397
  })),
313
398
  data: isError && output ? output : span ? getAttributes(span.data).error : {}
314
399
  }),
@@ -320,7 +405,7 @@ const ApToolCall = /*#__PURE__*/ react.forwardRef((props, ref)=>{
320
405
  isExpanded: expandedSections['output'],
321
406
  onToggle: ()=>setExpandedSections((prev)=>({
322
407
  ...prev,
323
- ['output']: !prev['output']
408
+ output: !prev['output']
324
409
  })),
325
410
  data: output || (span ? getAttributes(span.data).result : {}) || {}
326
411
  })
@@ -1,5 +1,16 @@
1
1
  "use strict";
2
2
  var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
3
14
  (()=>{
4
15
  __webpack_require__.r = (exports1)=>{
5
16
  if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
@@ -12,7 +23,18 @@ var __webpack_require__ = {};
12
23
  })();
13
24
  var __webpack_exports__ = {};
14
25
  __webpack_require__.r(__webpack_exports__);
15
- for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ ConversationalDisplayModeTypes: ()=>ConversationalDisplayModeTypes
28
+ });
29
+ const ConversationalDisplayModeTypes = {
30
+ FullTrace: 'FullTrace',
31
+ InputsAndOutputs: 'InputsAndOutputs',
32
+ ToolNameOnly: 'ToolNameOnly'
33
+ };
34
+ exports.ConversationalDisplayModeTypes = __webpack_exports__.ConversationalDisplayModeTypes;
35
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
36
+ "ConversationalDisplayModeTypes"
37
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
16
38
  Object.defineProperty(exports, '__esModule', {
17
39
  value: true
18
40
  });
@@ -2,6 +2,7 @@ import type React from 'react';
2
2
  export interface TSpan {
3
3
  id?: string;
4
4
  name?: string;
5
+ type?: string;
5
6
  status?: 'unset' | 'ok' | 'error';
6
7
  startTime?: string;
7
8
  endTime?: string;
@@ -13,6 +14,12 @@ export interface ITreeNode<T = any> {
13
14
  data: T;
14
15
  children?: ITreeNode<T>[];
15
16
  }
17
+ export declare const ConversationalDisplayModeTypes: {
18
+ readonly FullTrace: "FullTrace";
19
+ readonly InputsAndOutputs: "InputsAndOutputs";
20
+ readonly ToolNameOnly: "ToolNameOnly";
21
+ };
22
+ export type ConversationalDisplayMode = 'FullTrace' | 'InputsAndOutputs' | 'ToolNameOnly';
16
23
  export interface ApToolCallProps extends React.HTMLAttributes<HTMLDivElement> {
17
24
  span?: ITreeNode<TSpan>;
18
25
  toolName?: string;
@@ -21,8 +28,9 @@ export interface ApToolCallProps extends React.HTMLAttributes<HTMLDivElement> {
21
28
  isError?: boolean;
22
29
  startTime?: string;
23
30
  endTime?: string;
31
+ displayMode?: ConversationalDisplayMode;
24
32
  }
25
- export type ToolCallSectionType = 'input' | 'output' | 'execution' | 'errors' | 'escalation';
33
+ export type ToolCallSectionType = 'input' | 'output' | 'traces' | 'errors' | 'escalation';
26
34
  export interface ToolCallSectionProps {
27
35
  type: ToolCallSectionType;
28
36
  title: string;
@@ -1 +1 @@
1
- {"version":3,"file":"ApToolCall.types.d.ts","sourceRoot":"","sources":["../../../../src/material/components/ap-tool-call/ApToolCall.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,WAAW,KAAK;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,GAAG,OAAO,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,C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