@workflow/web-shared 4.1.11 → 4.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/event-list-view.d.ts +1 -1
- package/dist/components/event-list-view.d.ts.map +1 -1
- package/dist/components/event-list-view.js +6 -2
- package/dist/components/sidebar/attribute-panel.d.ts.map +1 -1
- package/dist/components/sidebar/attribute-panel.js +29 -33
- package/dist/components/trace-viewer/components/map.d.ts +2 -2
- package/dist/components/trace-viewer/components/map.d.ts.map +1 -1
- package/dist/components/trace-viewer/components/node.d.ts +7 -7
- package/dist/components/trace-viewer/components/node.d.ts.map +1 -1
- package/dist/components/trace-viewer/trace-viewer.module.css +4 -4
- package/dist/components/ui/alert.js +2 -2
- package/dist/components/ui/card.js +2 -2
- package/dist/components/ui/context-card.d.ts +47 -0
- package/dist/components/ui/context-card.d.ts.map +1 -0
- package/dist/components/ui/context-card.js +471 -0
- package/dist/components/ui/error-card.js +2 -2
- package/dist/components/ui/skeleton.js +2 -2
- package/dist/components/ui/timestamp-tooltip.d.ts +34 -1
- package/dist/components/ui/timestamp-tooltip.d.ts.map +1 -1
- package/dist/components/ui/timestamp-tooltip.js +80 -132
- package/dist/components/workflow-traces/trace-span-construction.d.ts +4 -1
- package/dist/components/workflow-traces/trace-span-construction.d.ts.map +1 -1
- package/dist/components/workflow-traces/trace-span-construction.js +30 -9
- package/dist/hooks/use-reduced-motion.d.ts +10 -0
- package/dist/hooks/use-reduced-motion.d.ts.map +1 -0
- package/dist/hooks/use-reduced-motion.js +29 -0
- package/dist/lib/cn.d.ts +10 -0
- package/dist/lib/cn.d.ts.map +1 -0
- package/dist/lib/cn.js +83 -0
- package/dist/lib/event-materialization.d.ts +3 -0
- package/dist/lib/event-materialization.d.ts.map +1 -1
- package/dist/lib/event-materialization.js +13 -7
- package/dist/lib/utils.d.ts +0 -2
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +1 -6
- package/dist/styles.css +9 -0
- package/package.json +6 -4
- package/src/components/event-list-view.tsx +10 -1
- package/src/components/sidebar/attribute-panel.tsx +122 -121
- package/src/components/trace-viewer/trace-viewer.module.css +4 -4
- package/src/components/ui/alert.tsx +1 -1
- package/src/components/ui/card.tsx +1 -1
- package/src/components/ui/context-card.tsx +784 -0
- package/src/components/ui/error-card.tsx +1 -1
- package/src/components/ui/skeleton.tsx +1 -1
- package/src/components/ui/timestamp-tooltip.tsx +132 -194
- package/src/components/workflow-traces/trace-span-construction.ts +72 -30
- package/src/hooks/use-reduced-motion.ts +34 -0
- package/src/lib/cn.ts +93 -0
- package/src/lib/event-materialization.ts +68 -40
- package/src/lib/utils.ts +0 -6
- package/src/styles.css +9 -0
package/src/lib/cn.ts
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { type ClassValue, clsx } from 'clsx';
|
|
2
|
+
import { extendTailwindMerge } from 'tailwind-merge';
|
|
3
|
+
|
|
4
|
+
const twMergeConfig = {
|
|
5
|
+
extend: {
|
|
6
|
+
classGroups: {
|
|
7
|
+
'text-heading': [
|
|
8
|
+
{
|
|
9
|
+
'text-heading': [
|
|
10
|
+
'72',
|
|
11
|
+
'64',
|
|
12
|
+
'56',
|
|
13
|
+
'48',
|
|
14
|
+
'40',
|
|
15
|
+
'32',
|
|
16
|
+
'24',
|
|
17
|
+
'20',
|
|
18
|
+
'16',
|
|
19
|
+
'14',
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
'text-button': [
|
|
24
|
+
{
|
|
25
|
+
'text-button': ['16', '14', '12'],
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
'text-label': [
|
|
29
|
+
{
|
|
30
|
+
'text-label': [
|
|
31
|
+
'20',
|
|
32
|
+
'18',
|
|
33
|
+
'16',
|
|
34
|
+
'14',
|
|
35
|
+
'14-mono',
|
|
36
|
+
'13',
|
|
37
|
+
'13-mono',
|
|
38
|
+
'12',
|
|
39
|
+
'12-mono',
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
'text-copy': [
|
|
44
|
+
{
|
|
45
|
+
'text-copy': ['24', '20', '18', '16', '14', '13', '13-mono'],
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
material: [
|
|
49
|
+
{
|
|
50
|
+
material: [
|
|
51
|
+
'base',
|
|
52
|
+
'small',
|
|
53
|
+
'medium',
|
|
54
|
+
'large',
|
|
55
|
+
'tooltip',
|
|
56
|
+
'menu',
|
|
57
|
+
'modal',
|
|
58
|
+
'fullscreen',
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
// Make each category conflict with itself, so e.g. text-heading-32 overrides text-heading-24
|
|
64
|
+
conflictingClassGroups: {
|
|
65
|
+
'text-heading': ['text-heading'],
|
|
66
|
+
'text-button': ['text-button'],
|
|
67
|
+
'text-label': ['text-label'],
|
|
68
|
+
'text-copy': ['text-copy'],
|
|
69
|
+
material: ['material'],
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
} as const;
|
|
73
|
+
|
|
74
|
+
type CustomClassGroupIds =
|
|
75
|
+
| 'text-heading'
|
|
76
|
+
| 'text-button'
|
|
77
|
+
| 'text-label'
|
|
78
|
+
| 'text-copy'
|
|
79
|
+
| 'material';
|
|
80
|
+
|
|
81
|
+
const customTwMerge = extendTailwindMerge<CustomClassGroupIds>(twMergeConfig);
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Merges Tailwind class names and resolves any conflicts using `clsx` with `tailwind-merge`.
|
|
85
|
+
*
|
|
86
|
+
* @param inputs - An array of class names to merge.
|
|
87
|
+
* @returns A string of merged and optimized class names.
|
|
88
|
+
*/
|
|
89
|
+
function cn(...classes: ClassValue[]) {
|
|
90
|
+
return customTwMerge(clsx(...classes));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export { cn };
|
|
@@ -23,6 +23,7 @@ export interface MaterializedStep {
|
|
|
23
23
|
status: StepStatus;
|
|
24
24
|
attempt: number;
|
|
25
25
|
createdAt: Date;
|
|
26
|
+
occurredAt?: Date;
|
|
26
27
|
startedAt?: Date;
|
|
27
28
|
completedAt?: Date;
|
|
28
29
|
updatedAt: Date;
|
|
@@ -35,6 +36,7 @@ export interface MaterializedHook {
|
|
|
35
36
|
runId: string;
|
|
36
37
|
token?: string;
|
|
37
38
|
createdAt: Date;
|
|
39
|
+
occurredAt?: Date;
|
|
38
40
|
receivedCount: number;
|
|
39
41
|
lastReceivedAt?: Date;
|
|
40
42
|
disposedAt?: Date;
|
|
@@ -47,6 +49,7 @@ export interface MaterializedWait {
|
|
|
47
49
|
runId: string;
|
|
48
50
|
status: 'waiting' | 'completed';
|
|
49
51
|
createdAt: Date;
|
|
52
|
+
occurredAt?: Date;
|
|
50
53
|
resumeAt?: Date;
|
|
51
54
|
completedAt?: Date;
|
|
52
55
|
/** All events for this wait, in insertion order */
|
|
@@ -59,6 +62,16 @@ export interface MaterializedEntities {
|
|
|
59
62
|
waits: MaterializedWait[];
|
|
60
63
|
}
|
|
61
64
|
|
|
65
|
+
const withOccurredAt = <T extends object>(
|
|
66
|
+
entity: T,
|
|
67
|
+
occurredAt: Event['occurredAt'] | undefined
|
|
68
|
+
): T & { occurredAt?: Date } => {
|
|
69
|
+
if (!occurredAt || (entity as { occurredAt?: unknown }).occurredAt != null) {
|
|
70
|
+
return entity;
|
|
71
|
+
}
|
|
72
|
+
return { ...entity, occurredAt };
|
|
73
|
+
};
|
|
74
|
+
|
|
62
75
|
// ---------------------------------------------------------------------------
|
|
63
76
|
// Helper: group events by correlationId prefix
|
|
64
77
|
// ---------------------------------------------------------------------------
|
|
@@ -133,21 +146,26 @@ export function materializeSteps(events: Event[]): MaterializedStep[] {
|
|
|
133
146
|
}
|
|
134
147
|
}
|
|
135
148
|
|
|
136
|
-
steps.push(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
steps.push(
|
|
150
|
+
withOccurredAt(
|
|
151
|
+
{
|
|
152
|
+
stepId: correlationId,
|
|
153
|
+
runId: created.runId,
|
|
154
|
+
stepName:
|
|
155
|
+
created.eventType === 'step_created'
|
|
156
|
+
? (created.eventData?.stepName ?? correlationId)
|
|
157
|
+
: correlationId,
|
|
158
|
+
status,
|
|
159
|
+
attempt,
|
|
160
|
+
createdAt: created.createdAt,
|
|
161
|
+
startedAt,
|
|
162
|
+
completedAt,
|
|
163
|
+
updatedAt,
|
|
164
|
+
events: stepEvents,
|
|
165
|
+
},
|
|
166
|
+
created.occurredAt
|
|
167
|
+
)
|
|
168
|
+
);
|
|
151
169
|
}
|
|
152
170
|
|
|
153
171
|
return steps;
|
|
@@ -174,19 +192,24 @@ export function materializeHooks(events: Event[]): MaterializedHook[] {
|
|
|
174
192
|
const disposed = hookEvents.find((e) => e.eventType === 'hook_disposed');
|
|
175
193
|
const lastReceived = receivedEvents.at(-1);
|
|
176
194
|
|
|
177
|
-
hooks.push(
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
195
|
+
hooks.push(
|
|
196
|
+
withOccurredAt(
|
|
197
|
+
{
|
|
198
|
+
hookId: correlationId,
|
|
199
|
+
runId: created.runId,
|
|
200
|
+
token:
|
|
201
|
+
created.eventType === 'hook_created'
|
|
202
|
+
? created.eventData?.token
|
|
203
|
+
: undefined,
|
|
204
|
+
createdAt: created.createdAt,
|
|
205
|
+
receivedCount: receivedEvents.length,
|
|
206
|
+
lastReceivedAt: lastReceived?.createdAt,
|
|
207
|
+
disposedAt: disposed?.createdAt,
|
|
208
|
+
events: hookEvents,
|
|
209
|
+
},
|
|
210
|
+
created.occurredAt
|
|
211
|
+
)
|
|
212
|
+
);
|
|
190
213
|
}
|
|
191
214
|
|
|
192
215
|
return hooks;
|
|
@@ -209,18 +232,23 @@ export function materializeWaits(events: Event[]): MaterializedWait[] {
|
|
|
209
232
|
|
|
210
233
|
const completed = waitEvents.find((e) => e.eventType === 'wait_completed');
|
|
211
234
|
|
|
212
|
-
waits.push(
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
235
|
+
waits.push(
|
|
236
|
+
withOccurredAt(
|
|
237
|
+
{
|
|
238
|
+
waitId: correlationId,
|
|
239
|
+
runId: created.runId,
|
|
240
|
+
status: completed ? 'completed' : 'waiting',
|
|
241
|
+
createdAt: created.createdAt,
|
|
242
|
+
resumeAt:
|
|
243
|
+
created.eventType === 'wait_created'
|
|
244
|
+
? created.eventData?.resumeAt
|
|
245
|
+
: undefined,
|
|
246
|
+
completedAt: completed?.createdAt,
|
|
247
|
+
events: waitEvents,
|
|
248
|
+
},
|
|
249
|
+
created.occurredAt
|
|
250
|
+
)
|
|
251
|
+
);
|
|
224
252
|
}
|
|
225
253
|
|
|
226
254
|
return waits;
|
package/src/lib/utils.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import type { Step } from '@workflow/world';
|
|
2
2
|
import type { ModelMessage } from 'ai';
|
|
3
|
-
import { type ClassValue, clsx } from 'clsx';
|
|
4
|
-
import { twMerge } from 'tailwind-merge';
|
|
5
|
-
|
|
6
|
-
export function cn(...inputs: ClassValue[]) {
|
|
7
|
-
return twMerge(clsx(inputs));
|
|
8
|
-
}
|
|
9
3
|
|
|
10
4
|
const durationFormatter = new Intl.NumberFormat(undefined, {
|
|
11
5
|
maximumFractionDigits: 2,
|
package/src/styles.css
CHANGED
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
* import '@workflow/web-shared/styles.css';
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
+
@custom-variant dark-theme (&:where(.dark-theme, .dark-theme *, .dark, .dark *, [data-theme="dark"], [data-theme="dark"] *));
|
|
16
|
+
@custom-variant light-theme (&:where(.light-theme, .light-theme *, .light, .light *));
|
|
17
|
+
|
|
15
18
|
:root {
|
|
16
19
|
/* Background */
|
|
17
20
|
--ds-background-100: hsl(0, 0%, 100%);
|
|
@@ -100,6 +103,9 @@
|
|
|
100
103
|
|
|
101
104
|
/* Shadows */
|
|
102
105
|
--ds-shadow-small: 0px 1px 2px rgba(0, 0, 0, 0.04);
|
|
106
|
+
--ds-shadow-tooltip:
|
|
107
|
+
0 0 0 1px rgba(0, 0, 0, 0.08), 0px 1px 1px rgba(0, 0, 0, 0.02),
|
|
108
|
+
0px 4px 8px rgba(0, 0, 0, 0.04), 0 0 0 1px var(--ds-background-200);
|
|
103
109
|
}
|
|
104
110
|
|
|
105
111
|
/* Dark theme defaults */
|
|
@@ -182,5 +188,8 @@
|
|
|
182
188
|
--ds-pink-900: hsl(336, 80%, 70%);
|
|
183
189
|
|
|
184
190
|
--ds-shadow-small: 0px 1px 2px rgba(0, 0, 0, 0.3);
|
|
191
|
+
--ds-shadow-tooltip:
|
|
192
|
+
0 0 0 1px rgba(255, 255, 255, 0.145), 0px 1px 1px rgba(0, 0, 0, 0.02),
|
|
193
|
+
0px 4px 8px rgba(0, 0, 0, 0.04), 0 0 0 1px var(--ds-background-200);
|
|
185
194
|
}
|
|
186
195
|
|