@uipath/apollo-wind 2.67.1 → 2.69.0

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 (54) hide show
  1. package/dist/components/forms/metadata-form.cjs +40 -44
  2. package/dist/components/forms/metadata-form.js +40 -44
  3. package/dist/components/ui/code-block.cjs +375 -0
  4. package/dist/components/ui/code-block.d.ts +38 -0
  5. package/dist/components/ui/code-block.js +307 -0
  6. package/dist/components/ui/index.cjs +268 -191
  7. package/dist/components/ui/index.d.ts +7 -0
  8. package/dist/components/ui/index.js +7 -0
  9. package/dist/components/ui/json-tree-view/JsonTree.cjs +2 -2
  10. package/dist/components/ui/json-tree-view/JsonTree.js +1 -1
  11. package/dist/components/ui/json-tree-view/JsonTree.types.d.ts +26 -0
  12. package/dist/components/ui/json-tree-view/JsonTreeRow.cjs +13 -10
  13. package/dist/components/ui/json-tree-view/JsonTreeRow.js +14 -11
  14. package/dist/components/ui/json-tree-view/JsonTreeToolbar.cjs +22 -11
  15. package/dist/components/ui/json-tree-view/JsonTreeToolbar.d.ts +6 -1
  16. package/dist/components/ui/json-tree-view/JsonTreeToolbar.js +22 -11
  17. package/dist/components/ui/json-tree-view/NodeKey.cjs +4 -0
  18. package/dist/components/ui/json-tree-view/NodeKey.js +4 -0
  19. package/dist/components/ui/json-tree-view/RowActions.cjs +23 -17
  20. package/dist/components/ui/json-tree-view/RowActions.d.ts +4 -1
  21. package/dist/components/ui/json-tree-view/RowActions.js +23 -17
  22. package/dist/components/ui/json-tree-view/buildJsonTree.cjs +99 -44
  23. package/dist/components/ui/json-tree-view/buildJsonTree.d.ts +15 -2
  24. package/dist/components/ui/json-tree-view/buildJsonTree.js +97 -45
  25. package/dist/components/ui/json-tree-view/index.cjs +26 -23
  26. package/dist/components/ui/json-tree-view/index.d.ts +2 -2
  27. package/dist/components/ui/json-tree-view/index.js +2 -2
  28. package/dist/components/ui/live-region.cjs +106 -0
  29. package/dist/components/ui/live-region.d.ts +31 -0
  30. package/dist/components/ui/live-region.js +72 -0
  31. package/dist/components/ui/loading-dots.cjs +95 -0
  32. package/dist/components/ui/loading-dots.d.ts +21 -0
  33. package/dist/components/ui/loading-dots.js +55 -0
  34. package/dist/components/ui/markdown.cjs +428 -0
  35. package/dist/components/ui/markdown.d.ts +55 -0
  36. package/dist/components/ui/markdown.js +378 -0
  37. package/dist/components/ui/panel-tabs.cjs +99 -0
  38. package/dist/components/ui/panel-tabs.d.ts +34 -0
  39. package/dist/components/ui/panel-tabs.js +53 -0
  40. package/dist/components/ui/thinking-indicator.cjs +146 -0
  41. package/dist/components/ui/thinking-indicator.d.ts +38 -0
  42. package/dist/components/ui/thinking-indicator.js +106 -0
  43. package/dist/components/ui/tool-call.cjs +359 -0
  44. package/dist/components/ui/tool-call.d.ts +75 -0
  45. package/dist/components/ui/tool-call.js +301 -0
  46. package/dist/index.cjs +334 -246
  47. package/dist/index.d.ts +15 -1
  48. package/dist/index.js +9 -2
  49. package/dist/styles.css +239 -0
  50. package/dist/tailwind.utilities.css +21 -0
  51. package/package.json +7 -1
  52. /package/dist/{components/ui/json-tree-view → lib}/clipboard.cjs +0 -0
  53. /package/dist/{components/ui/json-tree-view → lib}/clipboard.d.ts +0 -0
  54. /package/dist/{components/ui/json-tree-view → lib}/clipboard.js +0 -0
@@ -0,0 +1,75 @@
1
+ import { type VariantProps } from 'class-variance-authority';
2
+ import * as React from 'react';
3
+ import { CollapsibleContent } from './collapsible';
4
+ import { type JsonTreeViewStrings } from './json-tree-view';
5
+ export type ToolCallStatus = 'pending' | 'executing' | 'completed' | 'failed';
6
+ export interface ToolCallStrings {
7
+ pending: string;
8
+ executing: string;
9
+ completed: string;
10
+ failed: string;
11
+ /** Status line while the call is pending or executing. */
12
+ running: (name: string) => string;
13
+ /** Status line once the call has finished. `duration` is pre-formatted, e.g. "1.23 seconds". */
14
+ ran: (name: string, duration?: string) => string;
15
+ input: string;
16
+ output: string;
17
+ errors: string;
18
+ }
19
+ export declare const DEFAULT_TOOL_CALL_STRINGS: ToolCallStrings;
20
+ declare const toolCallVariants: (props?: ({
21
+ size?: "sm" | "md" | null | undefined;
22
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
23
+ export interface ToolCallProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof toolCallVariants> {
24
+ status: ToolCallStatus;
25
+ /** Controlled open state of the body. */
26
+ open?: boolean;
27
+ /** Initial open state when uncontrolled. */
28
+ defaultOpen?: boolean;
29
+ onOpenChange?: (open: boolean) => void;
30
+ /** Overrides for any subset of the English strings. */
31
+ strings?: Partial<ToolCallStrings>;
32
+ /** Overrides for the JSON tree's strings, merged over any outer `JsonTreeViewProvider`. */
33
+ jsonTreeStrings?: Partial<JsonTreeViewStrings>;
34
+ }
35
+ /**
36
+ * One agent tool call, laid out like the Material ApToolCall: a status line ("Ran 'x' for 1.2
37
+ * seconds") that toggles an indented body of collapsible sections (input, errors, output, or any
38
+ * `ToolCallSection`). The body is not rendered while closed. Omit `ToolCallContent` for a
39
+ * name-only line (the toggle hides itself).
40
+ */
41
+ declare const ToolCall: React.ForwardRefExoticComponent<ToolCallProps & React.RefAttributes<HTMLDivElement>>;
42
+ export interface ToolCallHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
43
+ /** Tool name, as it should read inside the status line. */
44
+ name: string;
45
+ /** Pre-formatted elapsed time, e.g. "1.23 seconds". Shown once the call has finished. */
46
+ duration?: string;
47
+ }
48
+ declare const ToolCallHeader: React.ForwardRefExoticComponent<ToolCallHeaderProps & React.RefAttributes<HTMLDivElement>>;
49
+ export type ToolCallContentProps = React.ComponentPropsWithoutRef<typeof CollapsibleContent>;
50
+ declare const ToolCallContent: React.ForwardRefExoticComponent<Omit<Omit<import("@radix-ui/react-collapsible").CollapsibleContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
51
+ export interface ToolCallSectionProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
52
+ title: React.ReactNode;
53
+ /** Controlled open state. */
54
+ open?: boolean;
55
+ /** Initial open state when uncontrolled. Sections start closed, like ApToolCall's. */
56
+ defaultOpen?: boolean;
57
+ onOpenChange?: (open: boolean) => void;
58
+ }
59
+ /** A collapsible section of the body, for input/output/errors or custom ones such as traces. */
60
+ declare const ToolCallSection: React.ForwardRefExoticComponent<ToolCallSectionProps & React.RefAttributes<HTMLDivElement>>;
61
+ /** Returns a node to replace the default rendering, or `undefined` to keep it. */
62
+ export type ToolCallRenderValue = (value: unknown) => React.ReactNode | undefined;
63
+ export interface ToolCallValueProps extends Omit<ToolCallSectionProps, 'title' | 'children'> {
64
+ /**
65
+ * Arrays and plain objects render as a read-only JSON tree with nested values folded; anything
66
+ * else as text. `undefined` and `null` hide the section, as ApToolCall hides empty data.
67
+ */
68
+ value: unknown;
69
+ /** Custom renderer, e.g. a syntax-highlighted code block. */
70
+ renderValue?: ToolCallRenderValue;
71
+ }
72
+ declare const ToolCallInput: React.ForwardRefExoticComponent<ToolCallValueProps & React.RefAttributes<HTMLDivElement>>;
73
+ declare const ToolCallOutput: React.ForwardRefExoticComponent<ToolCallValueProps & React.RefAttributes<HTMLDivElement>>;
74
+ declare const ToolCallError: React.ForwardRefExoticComponent<ToolCallValueProps & React.RefAttributes<HTMLDivElement>>;
75
+ export { ToolCall, ToolCallHeader, ToolCallContent, ToolCallSection, ToolCallInput, ToolCallOutput, ToolCallError, toolCallVariants, };
@@ -0,0 +1,301 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { cva } from "class-variance-authority";
3
+ import { ChevronDown, ChevronRight, CircleCheck, CircleX, Clock, Loader2 } from "lucide-react";
4
+ import { createContext, forwardRef, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useState } from "react";
5
+ import { cn } from "../../lib/index.js";
6
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./collapsible.js";
7
+ import { JsonTreeView, buildJsonTree, collectContainerPaths } from "./json-tree-view/index.js";
8
+ const DEFAULT_TOOL_CALL_STRINGS = {
9
+ pending: 'Pending',
10
+ executing: 'Running',
11
+ completed: 'Completed',
12
+ failed: 'Failed',
13
+ running: (name)=>`Running '${name}'`,
14
+ ran: (name, duration)=>duration ? `Ran '${name}' for ${duration}` : `Ran '${name}'`,
15
+ input: 'Input',
16
+ output: 'Output',
17
+ errors: 'Errors'
18
+ };
19
+ const ToolCallContext = /*#__PURE__*/ createContext(null);
20
+ function useToolCallContext(component) {
21
+ const context = useContext(ToolCallContext);
22
+ if (!context) throw new Error(`${component} must be used within a ToolCall`);
23
+ return context;
24
+ }
25
+ function mergeStrings(overrides) {
26
+ const merged = {
27
+ ...DEFAULT_TOOL_CALL_STRINGS
28
+ };
29
+ if (!overrides) return merged;
30
+ for (const key of Object.keys(overrides)){
31
+ const value = overrides[key];
32
+ if (void 0 !== value) merged[key] = value;
33
+ }
34
+ return merged;
35
+ }
36
+ const useIsomorphicLayoutEffect = "u" < typeof window ? useEffect : useLayoutEffect;
37
+ const TOGGLE_CLASSES = 'flex w-full min-w-0 items-center gap-2 rounded p-1 text-left transition-colors hover:text-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring motion-reduce:transition-none';
38
+ const toolCallVariants = cva('group/tool-call flex w-full min-w-0 flex-col text-muted-foreground', {
39
+ variants: {
40
+ size: {
41
+ sm: 'p-2 text-xs',
42
+ md: 'p-3 text-sm'
43
+ }
44
+ },
45
+ defaultVariants: {
46
+ size: 'md'
47
+ }
48
+ });
49
+ const ToolCall = /*#__PURE__*/ forwardRef(({ className, status, size = 'md', open, defaultOpen, onOpenChange, strings, jsonTreeStrings, ...props }, ref)=>{
50
+ const [contentCount, setContentCount] = useState(0);
51
+ const registerContent = useCallback(()=>{
52
+ setContentCount((count)=>count + 1);
53
+ return ()=>setContentCount((count)=>count - 1);
54
+ }, []);
55
+ const context = useMemo(()=>({
56
+ status,
57
+ strings: mergeStrings(strings),
58
+ jsonTreeStrings,
59
+ hasContent: contentCount > 0,
60
+ registerContent
61
+ }), [
62
+ status,
63
+ strings,
64
+ jsonTreeStrings,
65
+ contentCount,
66
+ registerContent
67
+ ]);
68
+ return /*#__PURE__*/ jsx(ToolCallContext.Provider, {
69
+ value: context,
70
+ children: /*#__PURE__*/ jsx(Collapsible, {
71
+ asChild: true,
72
+ open: open,
73
+ defaultOpen: defaultOpen,
74
+ onOpenChange: onOpenChange,
75
+ children: /*#__PURE__*/ jsx("div", {
76
+ ref: ref,
77
+ "data-slot": "tool-call",
78
+ "data-status": status,
79
+ "data-size": size,
80
+ className: cn(toolCallVariants({
81
+ size
82
+ }), className),
83
+ ...props
84
+ })
85
+ })
86
+ });
87
+ });
88
+ ToolCall.displayName = 'ToolCall';
89
+ const STATUS_ICONS = {
90
+ pending: Clock,
91
+ executing: Loader2,
92
+ completed: CircleCheck,
93
+ failed: CircleX
94
+ };
95
+ const toolCallStatusIconVariants = cva('size-5 shrink-0 group-data-[size=sm]/tool-call:size-4', {
96
+ variants: {
97
+ status: {
98
+ pending: 'text-muted-foreground',
99
+ executing: 'animate-spin text-primary motion-reduce:animate-none',
100
+ completed: 'text-success',
101
+ failed: 'text-destructive'
102
+ }
103
+ }
104
+ });
105
+ const ToolCallHeader = /*#__PURE__*/ forwardRef(({ className, name, duration, ...props }, ref)=>{
106
+ const { status, strings, hasContent } = useToolCallContext('ToolCallHeader');
107
+ const StatusIcon = STATUS_ICONS[status];
108
+ const finished = 'completed' === status || 'failed' === status;
109
+ const line = /*#__PURE__*/ jsxs(Fragment, {
110
+ children: [
111
+ /*#__PURE__*/ jsx(StatusIcon, {
112
+ "data-slot": "tool-call-status-icon",
113
+ "aria-hidden": "true",
114
+ className: toolCallStatusIconVariants({
115
+ status
116
+ })
117
+ }),
118
+ /*#__PURE__*/ jsx("span", {
119
+ "data-slot": "tool-call-status",
120
+ className: "sr-only",
121
+ children: strings[status]
122
+ }),
123
+ ' ',
124
+ /*#__PURE__*/ jsx("span", {
125
+ "data-slot": "tool-call-label",
126
+ className: "min-w-0 wrap-break-word",
127
+ children: finished ? strings.ran(name, duration) : strings.running(name)
128
+ })
129
+ ]
130
+ });
131
+ return /*#__PURE__*/ jsx("div", {
132
+ ref: ref,
133
+ "data-slot": "tool-call-header",
134
+ className: cn('flex min-w-0', className),
135
+ ...props,
136
+ children: hasContent ? /*#__PURE__*/ jsxs(CollapsibleTrigger, {
137
+ "data-slot": "tool-call-toggle",
138
+ className: cn('group/tool-call-toggle', TOGGLE_CLASSES),
139
+ children: [
140
+ line,
141
+ /*#__PURE__*/ jsx(ChevronDown, {
142
+ "aria-hidden": "true",
143
+ className: "size-4 shrink-0 transition-transform motion-reduce:transition-none group-data-[state=open]/tool-call-toggle:rotate-180"
144
+ })
145
+ ]
146
+ }) : /*#__PURE__*/ jsx("div", {
147
+ className: "flex min-w-0 items-center gap-2 p-1",
148
+ children: line
149
+ })
150
+ });
151
+ });
152
+ ToolCallHeader.displayName = 'ToolCallHeader';
153
+ const ToolCallContent = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>{
154
+ const { registerContent } = useToolCallContext('ToolCallContent');
155
+ useIsomorphicLayoutEffect(()=>registerContent(), [
156
+ registerContent
157
+ ]);
158
+ return /*#__PURE__*/ jsx(CollapsibleContent, {
159
+ ref: ref,
160
+ "data-slot": "tool-call-content",
161
+ className: cn('mt-2 ml-3 flex min-w-0 flex-col border-l pl-3 group-data-[size=sm]/tool-call:ml-2 group-data-[size=sm]/tool-call:pl-2', className),
162
+ ...props
163
+ });
164
+ });
165
+ ToolCallContent.displayName = 'ToolCallContent';
166
+ const ToolCallSection = /*#__PURE__*/ forwardRef(({ className, title, open, defaultOpen = false, onOpenChange, children, ...props }, ref)=>{
167
+ useToolCallContext('ToolCallSection');
168
+ return /*#__PURE__*/ jsx(Collapsible, {
169
+ asChild: true,
170
+ open: open,
171
+ defaultOpen: defaultOpen,
172
+ onOpenChange: onOpenChange,
173
+ children: /*#__PURE__*/ jsxs("div", {
174
+ ref: ref,
175
+ "data-slot": "tool-call-section",
176
+ className: cn('flex min-w-0 flex-col', className),
177
+ ...props,
178
+ children: [
179
+ /*#__PURE__*/ jsxs(CollapsibleTrigger, {
180
+ "data-slot": "tool-call-section-toggle",
181
+ className: cn('group/tool-call-section-toggle', TOGGLE_CLASSES),
182
+ children: [
183
+ /*#__PURE__*/ jsx(ChevronRight, {
184
+ "aria-hidden": "true",
185
+ className: "size-4 shrink-0 transition-transform motion-reduce:transition-none group-data-[state=open]/tool-call-section-toggle:rotate-90"
186
+ }),
187
+ title
188
+ ]
189
+ }),
190
+ /*#__PURE__*/ jsx(CollapsibleContent, {
191
+ "data-slot": "tool-call-section-content",
192
+ className: "ml-7 min-w-0",
193
+ children: children
194
+ })
195
+ ]
196
+ })
197
+ });
198
+ });
199
+ ToolCallSection.displayName = 'ToolCallSection';
200
+ function isJsonContainer(value) {
201
+ if (Array.isArray(value)) return true;
202
+ if ('object' != typeof value || null === value) return false;
203
+ const prototype = Object.getPrototypeOf(value);
204
+ return prototype === Object.prototype || null === prototype;
205
+ }
206
+ const VIRTUALIZE_NODE_COUNT = 200;
207
+ function countNodes(nodes) {
208
+ let count = 0;
209
+ const stack = [
210
+ ...nodes
211
+ ];
212
+ while(stack.length > 0){
213
+ const node = stack.pop();
214
+ count += 1;
215
+ if (node.children) stack.push(...node.children);
216
+ }
217
+ return count;
218
+ }
219
+ function ToolCallJsonValue({ value }) {
220
+ const { jsonTreeStrings } = useToolCallContext('ToolCallJsonValue');
221
+ const nodes = useMemo(()=>buildJsonTree({
222
+ value
223
+ }), [
224
+ value
225
+ ]);
226
+ const [opened, setOpened] = useState({});
227
+ const collapsed = useMemo(()=>Object.fromEntries(collectContainerPaths(nodes).map(({ path })=>[
228
+ path,
229
+ !opened[path]
230
+ ])), [
231
+ nodes,
232
+ opened
233
+ ]);
234
+ const toggle = useCallback((path)=>setOpened((prev)=>({
235
+ ...prev,
236
+ [path]: !prev[path]
237
+ })), []);
238
+ const virtualized = useMemo(()=>countNodes(nodes) > VIRTUALIZE_NODE_COUNT, [
239
+ nodes
240
+ ]);
241
+ const [scrollElement, setScrollElement] = useState(null);
242
+ return /*#__PURE__*/ jsx("div", {
243
+ ref: setScrollElement,
244
+ "data-slot": "tool-call-value",
245
+ className: "my-2 max-h-80 overflow-auto rounded-md border bg-background",
246
+ children: /*#__PURE__*/ jsx(JsonTreeView, {
247
+ nodes: nodes,
248
+ collapsed: collapsed,
249
+ onToggleCollapsed: toggle,
250
+ readOnly: true,
251
+ strings: jsonTreeStrings,
252
+ virtualized: virtualized,
253
+ scrollElement: virtualized ? scrollElement : void 0
254
+ })
255
+ });
256
+ }
257
+ function ToolCallTextValue({ value }) {
258
+ return /*#__PURE__*/ jsx("div", {
259
+ tabIndex: 0,
260
+ "data-slot": "tool-call-value",
261
+ className: "my-2 max-h-45 overflow-y-auto rounded bg-muted px-3 py-2 text-xs wrap-break-word whitespace-pre-wrap outline-hidden focus-visible:ring-2 focus-visible:ring-ring",
262
+ children: String(value)
263
+ });
264
+ }
265
+ function ToolCallValue({ value, renderValue }) {
266
+ const custom = renderValue?.(value);
267
+ if (void 0 !== custom) return /*#__PURE__*/ jsx(Fragment, {
268
+ children: custom
269
+ });
270
+ if (!isJsonContainer(value)) return /*#__PURE__*/ jsx(ToolCallTextValue, {
271
+ value: value
272
+ });
273
+ if (0 === Object.keys(value).length) return /*#__PURE__*/ jsx(ToolCallTextValue, {
274
+ value: Array.isArray(value) ? '[]' : '{}'
275
+ });
276
+ return /*#__PURE__*/ jsx(ToolCallJsonValue, {
277
+ value: value
278
+ });
279
+ }
280
+ function createValueSection(slot, titleKey, displayName) {
281
+ const Section = /*#__PURE__*/ forwardRef(({ value, renderValue, ...props }, ref)=>{
282
+ const { strings } = useToolCallContext(displayName);
283
+ if (null == value) return null;
284
+ return /*#__PURE__*/ jsx(ToolCallSection, {
285
+ ref: ref,
286
+ "data-slot": `tool-call-${slot}`,
287
+ title: strings[titleKey],
288
+ ...props,
289
+ children: /*#__PURE__*/ jsx(ToolCallValue, {
290
+ value: value,
291
+ renderValue: renderValue
292
+ })
293
+ });
294
+ });
295
+ Section.displayName = displayName;
296
+ return Section;
297
+ }
298
+ const ToolCallInput = createValueSection('input', 'input', 'ToolCallInput');
299
+ const ToolCallOutput = createValueSection('output', 'output', 'ToolCallOutput');
300
+ const ToolCallError = createValueSection('error', 'errors', 'ToolCallError');
301
+ export { DEFAULT_TOOL_CALL_STRINGS, ToolCall, ToolCallContent, ToolCallError, ToolCallHeader, ToolCallInput, ToolCallOutput, ToolCallSection, toolCallVariants };