@workflow/web-shared 4.0.1-beta.43 → 4.0.1-beta.45

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 (45) hide show
  1. package/dist/api/workflow-api-client.d.ts +62 -61
  2. package/dist/api/workflow-api-client.d.ts.map +1 -1
  3. package/dist/api/workflow-api-client.js +24 -1
  4. package/dist/api/workflow-api-client.js.map +1 -1
  5. package/dist/api/workflow-server-actions.d.ts +22 -0
  6. package/dist/api/workflow-server-actions.d.ts.map +1 -1
  7. package/dist/api/workflow-server-actions.js +38 -1
  8. package/dist/api/workflow-server-actions.js.map +1 -1
  9. package/dist/components/ui/error-card.d.ts +15 -0
  10. package/dist/components/ui/error-card.d.ts.map +1 -0
  11. package/dist/components/ui/error-card.js +14 -0
  12. package/dist/components/ui/error-card.js.map +1 -0
  13. package/dist/error-boundary.d.ts +0 -2
  14. package/dist/error-boundary.d.ts.map +1 -1
  15. package/dist/error-boundary.js +6 -6
  16. package/dist/error-boundary.js.map +1 -1
  17. package/dist/event-list-view.d.ts +13 -0
  18. package/dist/event-list-view.d.ts.map +1 -0
  19. package/dist/event-list-view.js +182 -0
  20. package/dist/event-list-view.js.map +1 -0
  21. package/dist/hooks/use-dark-mode.d.ts +9 -0
  22. package/dist/hooks/use-dark-mode.d.ts.map +1 -0
  23. package/dist/hooks/use-dark-mode.js +29 -0
  24. package/dist/hooks/use-dark-mode.js.map +1 -0
  25. package/dist/index.d.ts +4 -1
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +2 -0
  28. package/dist/index.js.map +1 -1
  29. package/dist/sidebar/attribute-panel.d.ts.map +1 -1
  30. package/dist/sidebar/attribute-panel.js +149 -41
  31. package/dist/sidebar/attribute-panel.js.map +1 -1
  32. package/dist/sidebar/conversation-view.js +1 -1
  33. package/dist/sidebar/conversation-view.js.map +1 -1
  34. package/dist/sidebar/{workflow-detail-panel.d.ts → entity-detail-panel.d.ts} +2 -2
  35. package/dist/sidebar/entity-detail-panel.d.ts.map +1 -0
  36. package/dist/sidebar/{workflow-detail-panel.js → entity-detail-panel.js} +3 -3
  37. package/dist/sidebar/entity-detail-panel.js.map +1 -0
  38. package/dist/sidebar/events-list.d.ts.map +1 -1
  39. package/dist/sidebar/events-list.js +2 -3
  40. package/dist/sidebar/events-list.js.map +1 -1
  41. package/dist/workflow-trace-view.js +2 -2
  42. package/dist/workflow-trace-view.js.map +1 -1
  43. package/package.json +5 -3
  44. package/dist/sidebar/workflow-detail-panel.d.ts.map +0 -1
  45. package/dist/sidebar/workflow-detail-panel.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"error-boundary.d.ts","sourceRoot":"","sources":["../src/error-boundary.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAI9C,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,SAAS,CAAC;IACpB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,IAAI,KAAK,SAAS,CAAC;CAC3D;AAED,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAED;;;;;;GAMG;AACH,qBAAa,aAAc,SAAQ,KAAK,CAAC,SAAS,CAChD,kBAAkB,EAClB,kBAAkB,CACnB;gBACa,KAAK,EAAE,kBAAkB;IAQrC,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,kBAAkB;IAOjE,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS;IAK1D,WAAW,aAKT;IAEF,MAAM;CA4CP"}
1
+ {"version":3,"file":"error-boundary.d.ts","sourceRoot":"","sources":["../src/error-boundary.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAG9C,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,SAAS,CAAC;IACpB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,IAAI,KAAK,SAAS,CAAC;CAC3D;AAED,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAED;;;;;;GAMG;AACH,qBAAa,aAAc,SAAQ,KAAK,CAAC,SAAS,CAChD,kBAAkB,EAClB,kBAAkB,CACnB;gBACa,KAAK,EAAE,kBAAkB;IAQrC,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,kBAAkB;IAOjE,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS;IAK1D,WAAW,aAKT;IAEF,MAAM;CAsBP"}
@@ -1,9 +1,7 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { AlertCircle } from 'lucide-react';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
4
3
  import React from 'react';
5
- import { Alert, AlertDescription, AlertTitle } from './components/ui/alert';
6
- import { Card, CardContent, CardHeader, CardTitle } from './components/ui/card';
4
+ import { ErrorCard } from './components/ui/error-card';
7
5
  /**
8
6
  * Error boundary component that catches errors in child components
9
7
  * and displays them without breaking the entire application.
@@ -42,8 +40,10 @@ export class ErrorBoundary extends React.Component {
42
40
  return this.props.fallback(this.state.error, this.handleReset);
43
41
  }
44
42
  // Default error UI
45
- return (_jsxs(Card, { className: "border-destructive/50 bg-destructive/5", children: [_jsx(CardHeader, { children: _jsxs(CardTitle, { className: "flex items-center gap-2 text-destructive", children: [_jsx(AlertCircle, { className: "h-5 w-5" }), this.props.title || 'Error'] }) }), _jsxs(CardContent, { className: "space-y-4", children: [_jsxs(Alert, { variant: "destructive", children: [_jsx(AlertCircle, { className: "h-4 w-4" }), _jsx(AlertTitle, { children: "Something went wrong" }), _jsx(AlertDescription, { children: this.props.description ||
46
- 'An unexpected error occurred in this section.' })] }), _jsxs("div", { className: "bg-muted p-3 rounded-md text-sm font-mono text-muted-foreground overflow-auto max-h-48", children: [_jsx("div", { className: "text-xs font-semibold mb-2", children: "Error details:" }), _jsx("div", { className: "whitespace-pre-wrap break-words text-xs", children: this.state.error.message }), this.state.error.stack && (_jsx("div", { className: "mt-2 opacity-60 text-xs", children: this.state.error.stack }))] })] })] }));
43
+ const errorDetails = this.state.error.stack
44
+ ? `${this.state.error.message}\n\n${this.state.error.stack}`
45
+ : this.state.error.message;
46
+ return (_jsx(ErrorCard, { title: this.props.title || 'An error occurred', details: errorDetails }));
47
47
  }
48
48
  return this.props.children;
49
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"error-boundary.js","sourceRoot":"","sources":["../src/error-boundary.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAyB,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAiBhF;;;;;;GAMG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK,CAAC,SAGxC;IACC,YAAY,KAAyB;QACnC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG;YACX,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE,IAAI;SACZ,CAAC;IAC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KAAK,CAAC,KAAK,EAAE,CAAC;YAC5C,kCAAkC;YAClC,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;gBACxB,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;YACjE,CAAC;YAED,mBAAmB;YACnB,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK;gBACzC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE;gBAC5D,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC;YAE7B,OAAO,CACL,KAAC,SAAS,IACR,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,mBAAmB,EAC9C,OAAO,EAAE,YAAY,GACrB,CACH,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;CACF"}
@@ -0,0 +1,13 @@
1
+ import type { Event } from '@workflow/world';
2
+ import type { EnvMap } from './api/workflow-server-actions';
3
+ interface EventsListProps {
4
+ events: Event[] | null;
5
+ env: EnvMap;
6
+ }
7
+ /**
8
+ * Displays a list of all events for a workflow run as colored cards in a pseudo-table.
9
+ * Events are sorted by createdAt (oldest first).
10
+ */
11
+ export declare function EventListView({ events, env }: EventsListProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
13
+ //# sourceMappingURL=event-list-view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-list-view.d.ts","sourceRoot":"","sources":["../src/event-list-view.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAG7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AA6C5D,UAAU,eAAe;IACvB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;CACb;AA8TD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,eAAe,2CA2D7D"}
@@ -0,0 +1,182 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { ChevronRight, Loader2 } from 'lucide-react';
4
+ import { useCallback, useMemo, useState } from 'react';
5
+ import { fetchEventsByCorrelationId } from './api/workflow-server-actions';
6
+ import { getEventColor } from './workflow-traces/event-colors';
7
+ /**
8
+ * Format a date to a human-readable local time string with milliseconds
9
+ */
10
+ function formatEventTime(date) {
11
+ return (date.toLocaleTimeString('en-US', {
12
+ hour: '2-digit',
13
+ minute: '2-digit',
14
+ second: '2-digit',
15
+ hour12: false,
16
+ }) +
17
+ '.' +
18
+ date.getMilliseconds().toString().padStart(3, '0'));
19
+ }
20
+ /**
21
+ * Format a date to full local datetime string with milliseconds
22
+ */
23
+ function formatEventDateTime(date) {
24
+ return date.toLocaleString(undefined, {
25
+ year: 'numeric',
26
+ month: 'numeric',
27
+ day: 'numeric',
28
+ hour: 'numeric',
29
+ minute: 'numeric',
30
+ second: 'numeric',
31
+ fractionalSecondDigits: 3,
32
+ });
33
+ }
34
+ /**
35
+ * Format event type to a more readable label
36
+ */
37
+ function formatEventType(eventType) {
38
+ return eventType
39
+ .split('_')
40
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
41
+ .join(' ');
42
+ }
43
+ /**
44
+ * Single event row component with expandable details
45
+ */
46
+ function EventRow({ event, env }) {
47
+ const [isExpanded, setIsExpanded] = useState(false);
48
+ const [isLoading, setIsLoading] = useState(false);
49
+ const [loadedEventData, setLoadedEventData] = useState(null);
50
+ const [loadError, setLoadError] = useState(null);
51
+ const colors = getEventColor(event.eventType);
52
+ const createdAt = new Date(event.createdAt);
53
+ // Check if event already has eventData (from initial fetch)
54
+ const hasExistingEventData = 'eventData' in event && event.eventData != null;
55
+ // Load full event details when expanding
56
+ const loadEventDetails = useCallback(async () => {
57
+ // Skip if we already have data or no correlationId
58
+ if (loadedEventData !== null ||
59
+ hasExistingEventData ||
60
+ !event.correlationId) {
61
+ return;
62
+ }
63
+ setIsLoading(true);
64
+ setLoadError(null);
65
+ try {
66
+ const result = await fetchEventsByCorrelationId(env, event.correlationId, {
67
+ sortOrder: 'asc',
68
+ limit: 100,
69
+ withData: true,
70
+ });
71
+ if (!result.success) {
72
+ setLoadError(result.error?.message || 'Failed to load event details');
73
+ return;
74
+ }
75
+ // Find our specific event in the results
76
+ const fullEvent = result.data.data.find((e) => e.eventId === event.eventId);
77
+ if (fullEvent && 'eventData' in fullEvent) {
78
+ setLoadedEventData(fullEvent.eventData);
79
+ }
80
+ }
81
+ catch (err) {
82
+ setLoadError(err instanceof Error ? err.message : 'Failed to load event details');
83
+ }
84
+ finally {
85
+ setIsLoading(false);
86
+ }
87
+ }, [
88
+ env,
89
+ event.correlationId,
90
+ event.eventId,
91
+ loadedEventData,
92
+ hasExistingEventData,
93
+ ]);
94
+ // Handle expand/collapse
95
+ const handleToggle = useCallback(() => {
96
+ const newExpanded = !isExpanded;
97
+ setIsExpanded(newExpanded);
98
+ // Load details when expanding for the first time
99
+ if (newExpanded && loadedEventData === null && !hasExistingEventData) {
100
+ loadEventDetails();
101
+ }
102
+ }, [isExpanded, loadedEventData, hasExistingEventData, loadEventDetails]);
103
+ // Get the event data to display (either from initial fetch, loaded data, or null)
104
+ const eventData = hasExistingEventData
105
+ ? event.eventData
106
+ : loadedEventData;
107
+ return (_jsxs("div", { className: "rounded-lg border overflow-hidden transition-all", style: {
108
+ backgroundColor: 'var(--ds-background-100)',
109
+ borderColor: colors.border,
110
+ borderLeftWidth: '1px',
111
+ borderLeftColor: colors.color,
112
+ }, children: [_jsxs("button", { type: "button", onClick: handleToggle, className: "w-full text-left grid gap-3 items-center px-0 py-2 text-xs hover:brightness-[0.98] transition-all cursor-pointer", style: {
113
+ gridTemplateColumns: '24px 100px minmax(120px, auto) 1fr 1fr',
114
+ }, children: [_jsx("div", { className: "flex justify-center", children: _jsx(ChevronRight, { className: "h-3.5 w-3.5 transition-transform", style: {
115
+ color: colors.secondary,
116
+ transform: isExpanded ? 'rotate(90deg)' : 'rotate(0deg)',
117
+ } }) }), _jsx("div", { className: "font-mono tabular-nums", style: { color: colors.secondary }, children: formatEventTime(createdAt) }), _jsx("div", { className: "font-medium", style: { color: colors.text }, children: _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx("span", { className: "w-2 h-2 rounded-full flex-shrink-0", style: { backgroundColor: colors.color } }), formatEventType(event.eventType)] }) }), _jsx("div", { className: "font-mono text-[11px] overflow-hidden text-ellipsis whitespace-nowrap", style: { color: colors.secondary }, title: event.correlationId || '-', children: event.correlationId || '-' }), _jsx("div", { className: "font-mono text-[11px] pr-3 overflow-hidden text-ellipsis whitespace-nowrap", style: { color: colors.secondary }, title: event.eventId, children: event.eventId })] }), isExpanded && (_jsxs("div", { className: "border-t px-4 py-3", style: {
118
+ borderColor: colors.border,
119
+ backgroundColor: 'var(--ds-background-100)',
120
+ }, children: [_jsxs("div", { className: "flex flex-col divide-y rounded-md border overflow-hidden", style: {
121
+ borderColor: 'var(--ds-gray-300)',
122
+ backgroundColor: 'var(--ds-gray-100)',
123
+ }, children: [_jsx(AttributeRow, { label: "Event ID", value: event.eventId, mono: true }), _jsx(AttributeRow, { label: "Event Type", value: event.eventType }), _jsx(AttributeRow, { label: "Correlation ID", value: event.correlationId || '-', mono: true }), _jsx(AttributeRow, { label: "Run ID", value: event.runId, mono: true }), _jsx(AttributeRow, { label: "Created At", value: formatEventDateTime(createdAt) })] }), _jsxs("div", { className: "mt-3", children: [_jsx("div", { className: "text-xs font-medium mb-1.5", style: { color: 'var(--ds-gray-700)' }, children: "Event Data" }), isLoading && (_jsxs("div", { className: "flex items-center gap-2 rounded-md border p-3", style: {
124
+ borderColor: 'var(--ds-gray-300)',
125
+ backgroundColor: 'var(--ds-gray-100)',
126
+ }, children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin", style: { color: 'var(--ds-gray-700)' } }), _jsx("span", { className: "text-xs", style: { color: 'var(--ds-gray-700)' }, children: "Loading event details..." })] })), loadError && !isLoading && (_jsx("div", { className: "rounded-md border p-3 text-xs", style: {
127
+ borderColor: 'var(--ds-red-400)',
128
+ backgroundColor: 'var(--ds-red-100)',
129
+ color: 'var(--ds-red-900)',
130
+ }, children: loadError })), !isLoading && !loadError && eventData != null && (_jsx("pre", { className: "text-[11px] overflow-x-auto rounded-md border p-3", style: {
131
+ borderColor: 'var(--ds-gray-300)',
132
+ backgroundColor: 'var(--ds-gray-100)',
133
+ color: 'var(--ds-gray-1000)',
134
+ }, children: _jsx("code", { children: JSON.stringify(eventData, null, 2) }) })), !isLoading &&
135
+ !loadError &&
136
+ eventData == null &&
137
+ !event.correlationId && (_jsx("div", { className: "rounded-md border p-3 text-xs", style: {
138
+ borderColor: 'var(--ds-gray-300)',
139
+ backgroundColor: 'var(--ds-gray-100)',
140
+ color: 'var(--ds-gray-700)',
141
+ }, children: "No event data available" })), !isLoading &&
142
+ !loadError &&
143
+ eventData == null &&
144
+ event.correlationId &&
145
+ !hasExistingEventData &&
146
+ loadedEventData === null && (_jsx("div", { className: "rounded-md border p-3 text-xs", style: {
147
+ borderColor: 'var(--ds-gray-300)',
148
+ backgroundColor: 'var(--ds-gray-100)',
149
+ color: 'var(--ds-gray-700)',
150
+ }, children: "No event data for this event type" }))] })] }))] }));
151
+ }
152
+ /**
153
+ * Helper component for attribute rows in the expanded details
154
+ */
155
+ function AttributeRow({ label, value, mono = false, }) {
156
+ return (_jsxs("div", { className: "flex items-center justify-between px-2.5 py-1.5", style: { borderColor: 'var(--ds-gray-300)' }, children: [_jsx("span", { className: "text-[11px] font-medium", style: { color: 'var(--ds-gray-700)' }, children: label }), _jsx("span", { className: `text-[11px] ${mono ? 'font-mono' : ''} text-right max-w-[70%] break-all`, style: { color: 'var(--ds-gray-1000)' }, children: value })] }));
157
+ }
158
+ /**
159
+ * Displays a list of all events for a workflow run as colored cards in a pseudo-table.
160
+ * Events are sorted by createdAt (oldest first).
161
+ */
162
+ export function EventListView({ events, env }) {
163
+ // Sort events by createdAt (oldest first)
164
+ const sortedEvents = useMemo(() => {
165
+ if (!events || events.length === 0)
166
+ return [];
167
+ return [...events].sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
168
+ }, [events]);
169
+ if (!events || events.length === 0) {
170
+ return (_jsx("div", { className: "flex items-center justify-center h-full text-sm", style: { color: 'var(--ds-gray-700)' }, children: "No events found" }));
171
+ }
172
+ return (_jsxs("div", { className: "h-full overflow-auto m-2", children: [_jsxs("div", { className: "grid gap-3 pb-2 mb-2 border-b text-xs font-medium sticky top-0 z-10", style: {
173
+ gridTemplateColumns: '24px 100px minmax(120px, auto) 1fr 1fr',
174
+ borderColor: 'var(--ds-gray-300)',
175
+ backgroundColor: 'var(--ds-background-100)',
176
+ color: 'var(--ds-gray-700)',
177
+ }, children: [_jsx("div", {}), _jsx("div", { children: "Time" }), _jsx("div", { children: "Event Type" }), _jsx("div", { children: "Correlation ID" }), _jsx("div", { children: "Event ID" })] }), _jsx("div", { className: "flex flex-col gap-2", children: sortedEvents.map((event) => (_jsx(EventRow, { event: event, env: env }, event.eventId))) }), _jsxs("div", { className: "mt-4 pt-3 border-t text-xs", style: {
178
+ borderColor: 'var(--ds-gray-300)',
179
+ color: 'var(--ds-gray-700)',
180
+ }, children: [sortedEvents.length, " event", sortedEvents.length !== 1 ? 's' : '', " total"] })] }));
181
+ }
182
+ //# sourceMappingURL=event-list-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-list-view.js","sourceRoot":"","sources":["../src/event-list-view.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc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,CAAC,OAAO,CAA4B,CACzD,CAAC,GACE,EAGN,eACE,SAAS,EAAC,4BAA4B,EACtC,KAAK,EAAE;oBACL,WAAW,EAAE,oBAAoB;oBACjC,KAAK,EAAE,oBAAoB;iBAC5B,aAEA,YAAY,CAAC,MAAM,YAAQ,YAAY,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,cAC5D,IACF,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Hook that detects if dark mode is active and reacts to theme changes.
3
+ * Observes the 'dark' class on the document element, which is how
4
+ * next-themes and similar libraries apply the theme.
5
+ *
6
+ * @returns `true` if dark mode is active, `false` otherwise
7
+ */
8
+ export declare const useDarkMode: () => boolean;
9
+ //# sourceMappingURL=use-dark-mode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-dark-mode.d.ts","sourceRoot":"","sources":["../../src/hooks/use-dark-mode.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,QAAO,OAsB9B,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { useEffect, useState } from 'react';
2
+ /**
3
+ * Hook that detects if dark mode is active and reacts to theme changes.
4
+ * Observes the 'dark' class on the document element, which is how
5
+ * next-themes and similar libraries apply the theme.
6
+ *
7
+ * @returns `true` if dark mode is active, `false` otherwise
8
+ */
9
+ export const useDarkMode = () => {
10
+ const [isDark, setIsDark] = useState(() => {
11
+ if (typeof document === 'undefined')
12
+ return false;
13
+ return document.documentElement.classList.contains('dark');
14
+ });
15
+ useEffect(() => {
16
+ if (typeof document === 'undefined')
17
+ return;
18
+ const observer = new MutationObserver(() => {
19
+ setIsDark(document.documentElement.classList.contains('dark'));
20
+ });
21
+ observer.observe(document.documentElement, {
22
+ attributes: true,
23
+ attributeFilter: ['class'],
24
+ });
25
+ return () => observer.disconnect();
26
+ }, []);
27
+ return isDark;
28
+ };
29
+ //# sourceMappingURL=use-dark-mode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-dark-mode.js","sourceRoot":"","sources":["../../src/hooks/use-dark-mode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,GAAY,EAAE;IACvC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE;QACxC,IAAI,OAAO,QAAQ,KAAK,WAAW;YAAE,OAAO,KAAK,CAAC;QAClD,OAAO,QAAQ,CAAC,eAAe,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,QAAQ,KAAK,WAAW;YAAE,OAAO;QAE5C,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,GAAG,EAAE;YACzC,SAAS,CAAC,QAAQ,CAAC,eAAe,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,EAAE;YACzC,UAAU,EAAE,IAAI;YAChB,eAAe,EAAE,CAAC,OAAO,CAAC;SAC3B,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,11 @@
1
1
  export { parseStepName, parseWorkflowName, } from '@workflow/core/parse-name';
2
2
  export type { Event, Hook, Step, WorkflowRun } from '@workflow/world';
3
3
  export * from './api/workflow-api-client';
4
- export type { EnvMap, PublicServerConfig } from './api/workflow-server-actions';
4
+ export type { EnvMap, HealthCheckResultWithLatency, PublicServerConfig, } from './api/workflow-server-actions';
5
+ export { runHealthCheck } from './api/workflow-server-actions';
6
+ export type { HealthCheckEndpoint, HealthCheckResult, } from '@workflow/core/runtime';
5
7
  export { ErrorBoundary } from './error-boundary';
8
+ export { EventListView } from './event-list-view';
6
9
  export type { HookActionCallbacks, HookActionsDropdownItemProps, HookResolveModalProps, UseHookActionsOptions, UseHookActionsReturn, } from './hook-actions';
7
10
  export { HookResolveModalWrapper, ResolveHookDropdownItem, ResolveHookModal, useHookActions, } from './hook-actions';
8
11
  export type { EventAnalysis } from './lib/event-analysis';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEtE,cAAc,2BAA2B,CAAC;AAC1C,YAAY,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EACV,mBAAmB,EACnB,4BAA4B,EAC5B,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EACL,aAAa,EACb,yBAAyB,EACzB,yBAAyB,EACzB,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,cAAc,GACf,MAAM,aAAa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;AAC9C,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  export { parseStepName, parseWorkflowName, } from '@workflow/core/parse-name';
2
2
  export * from './api/workflow-api-client';
3
+ export { runHealthCheck } from './api/workflow-server-actions';
3
4
  export { ErrorBoundary } from './error-boundary';
5
+ export { EventListView } from './event-list-view';
4
6
  export { HookResolveModalWrapper, ResolveHookDropdownItem, ResolveHookModal, useHookActions, } from './hook-actions';
5
7
  export { analyzeEvents, hasPendingHooksFromEvents, hasPendingStepsFromEvents, isTerminalStatus, shouldShowReenqueueButton, } from './lib/event-analysis';
6
8
  export { extractConversation, formatDuration, identifyStreamSteps, isDoStreamStep, } from './lib/utils';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AAGnC,cAAc,2BAA2B,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAQjD,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,cAAc,GACf,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,aAAa,EACb,yBAAyB,EACzB,yBAAyB,EACzB,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AAGnC,cAAc,2BAA2B,CAAC;AAM1C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAK/D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAQlD,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,cAAc,GACf,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,aAAa,EACb,yBAAyB,EACzB,yBAAyB,EACzB,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"attribute-panel.d.ts","sourceRoot":"","sources":["../../src/sidebar/attribute-panel.tsx"],"names":[],"mappings":"AAoUA,eAAO,MAAM,oBAAoB,GAAI,OAAO,OAAO,KAAG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AK,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,kDAAkD;IAClD,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C,4CAyFA,CAAC"}
@@ -1,34 +1,43 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { parseStepName, parseWorkflowName } from '@workflow/core/parse-name';
4
- import { AlertCircle } from 'lucide-react';
5
- import { createContext, useContext, useMemo, useState, } from 'react';
6
- import { Alert, AlertDescription, AlertTitle } from '../components/ui/alert';
4
+ import { createContext, useContext, useMemo, useState } from 'react';
5
+ import { ErrorCard } from '../components/ui/error-card';
6
+ import { useDarkMode } from '../hooks/use-dark-mode';
7
7
  import { extractConversation, isDoStreamStep } from '../lib/utils';
8
8
  import { ConversationView } from './conversation-view';
9
9
  import { DetailCard } from './detail-card';
10
+ /**
11
+ * Tab button for conversation/JSON toggle
12
+ */
13
+ function TabButton({ active, onClick, children, }) {
14
+ return (_jsx("button", { type: "button", onClick: onClick, className: "px-3 py-1.5 text-[11px] font-medium transition-colors -mb-px", style: {
15
+ // Explicit styles to prevent app-level button overrides when web-shared
16
+ // is embedded in a self-hosted app.
17
+ backgroundColor: 'transparent',
18
+ borderTop: 'none',
19
+ borderLeft: 'none',
20
+ borderRight: 'none',
21
+ borderBottom: `2px solid ${active ? 'var(--ds-blue-600)' : 'transparent'}`,
22
+ borderRadius: 0,
23
+ outline: 'none',
24
+ boxShadow: 'none',
25
+ cursor: 'pointer',
26
+ color: active ? 'var(--ds-gray-1000)' : 'var(--ds-gray-600)',
27
+ }, children: children }));
28
+ }
10
29
  /**
11
30
  * Tabbed view for conversation and raw JSON
12
31
  */
13
32
  function ConversationWithTabs({ conversation, args, }) {
14
33
  const [activeTab, setActiveTab] = useState('conversation');
15
- return (_jsx(DetailCard, { summary: `Input (${conversation.length} messages)`, children: _jsxs("div", { className: "rounded-md border", style: { borderColor: 'var(--ds-gray-300)' }, children: [_jsxs("div", { className: "flex gap-1 border-b", style: { borderColor: 'var(--ds-gray-300)' }, children: [_jsx("button", { type: "button", onClick: () => setActiveTab('conversation'), className: "px-3 py-1.5 text-[11px] font-medium transition-colors", style: {
16
- color: activeTab === 'conversation'
17
- ? 'var(--ds-gray-1000)'
18
- : 'var(--ds-gray-600)',
19
- borderBottom: activeTab === 'conversation'
20
- ? '2px solid var(--ds-blue-600)'
21
- : '2px solid transparent',
22
- marginBottom: '-1px',
23
- }, children: "Conversation" }), _jsx("button", { type: "button", onClick: () => setActiveTab('json'), className: "px-3 py-1.5 text-[11px] font-medium transition-colors", style: {
24
- color: activeTab === 'json'
25
- ? 'var(--ds-gray-1000)'
26
- : 'var(--ds-gray-600)',
27
- borderBottom: activeTab === 'json'
28
- ? '2px solid var(--ds-blue-600)'
29
- : '2px solid transparent',
30
- marginBottom: '-1px',
31
- }, children: "Raw JSON" })] }), activeTab === 'conversation' ? (_jsx(ConversationView, { messages: conversation })) : (_jsx("div", { className: "p-3 max-h-[400px] overflow-y-auto", children: Array.isArray(args)
34
+ return (_jsx(DetailCard, { summary: `Input (${conversation.length} messages)`, children: _jsxs("div", { className: "rounded-md border", style: {
35
+ borderColor: 'var(--ds-gray-300)',
36
+ backgroundColor: 'transparent',
37
+ }, children: [_jsxs("div", { className: "flex gap-1 border-b", style: {
38
+ borderColor: 'var(--ds-gray-300)',
39
+ backgroundColor: 'transparent',
40
+ }, children: [_jsx(TabButton, { active: activeTab === 'conversation', onClick: () => setActiveTab('conversation'), children: "Conversation" }), _jsx(TabButton, { active: activeTab === 'json', onClick: () => setActiveTab('json'), children: "Raw JSON" })] }), activeTab === 'conversation' ? (_jsx(ConversationView, { messages: conversation })) : (_jsx("div", { className: "p-3", children: Array.isArray(args)
32
41
  ? args.map((v, i) => (_jsx("div", { className: "mt-2 first:mt-0", children: JsonBlock(v) }, i)))
33
42
  : JsonBlock(args) }))] }) }));
34
43
  }
@@ -56,6 +65,77 @@ const isStreamRef = (value) => {
56
65
  'streamId' in value &&
57
66
  typeof value.streamId === 'string');
58
67
  };
68
+ /**
69
+ * Marker for custom class instance references.
70
+ * This is duplicated from @workflow/core/observability to avoid pulling in
71
+ * Node.js dependencies into the client bundle.
72
+ */
73
+ const CLASS_INSTANCE_REF_TYPE = '__workflow_class_instance_ref__';
74
+ /**
75
+ * Check if a value is a ClassInstanceRef object
76
+ */
77
+ const isClassInstanceRef = (value) => {
78
+ return (value !== null &&
79
+ typeof value === 'object' &&
80
+ '__type' in value &&
81
+ value.__type === CLASS_INSTANCE_REF_TYPE &&
82
+ 'className' in value &&
83
+ typeof value.className === 'string');
84
+ };
85
+ import ColorHash from 'color-hash';
86
+ /**
87
+ * Color hash instance configured for nice saturation and lightness.
88
+ * Returns HSL values which we can transform for different use cases.
89
+ */
90
+ const colorHash = new ColorHash({
91
+ saturation: [0.5, 0.6, 0.7],
92
+ lightness: [0.4, 0.5, 0.6],
93
+ });
94
+ /**
95
+ * Convert HSL to CSS hsl() string
96
+ */
97
+ const hslToString = (h, s, l) => {
98
+ return `hsl(${h}, ${Math.round(s * 100)}%, ${Math.round(l * 100)}%)`;
99
+ };
100
+ /**
101
+ * Get consistent colors for a class ID using color-hash and HSL transformations.
102
+ * Adjusts colors based on light/dark mode for optimal appearance.
103
+ */
104
+ const getClassColors = (classId, isDark) => {
105
+ const [h, s, l] = colorHash.hsl(classId);
106
+ if (isDark) {
107
+ // Dark mode: vibrant header, dark body, light text
108
+ return {
109
+ header: hslToString(h, s, Math.min(l + 0.1, 0.6)), // Slightly brighter header
110
+ body: hslToString(h, s * 0.8, 0.15), // Very dark, slightly desaturated body
111
+ text: hslToString(h, s * 0.6, 0.8), // Light, slightly desaturated text
112
+ };
113
+ }
114
+ else {
115
+ // Light mode: vibrant header, light body, dark text
116
+ return {
117
+ header: hslToString(h, s, l), // Use base color for header
118
+ body: hslToString(h, s * 0.4, 0.95), // Very light, desaturated body
119
+ text: hslToString(h, s * 0.8, 0.25), // Dark, saturated text
120
+ };
121
+ }
122
+ };
123
+ /**
124
+ * Renders a ClassInstanceRef as a styled card showing the class name and serialized data.
125
+ * The header color is determined by hashing the classId for visual distinction.
126
+ * Reacts to theme changes for proper dark/light mode support.
127
+ */
128
+ const ClassInstanceRefDisplay = ({ classInstanceRef, }) => {
129
+ const isDark = useDarkMode();
130
+ const colors = getClassColors(classInstanceRef.classId, isDark);
131
+ return (_jsxs("div", { className: "inline-flex flex-col rounded text-[11px] font-mono my-1", style: {
132
+ backgroundColor: colors.body,
133
+ border: `1px solid ${colors.header}`,
134
+ }, children: [_jsxs("div", { className: "flex items-center gap-1.5 px-2 py-1 rounded-t", style: {
135
+ backgroundColor: colors.header,
136
+ color: '#FFFFFF',
137
+ }, title: `Custom class: ${classInstanceRef.classId}`, children: [_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("title", { children: "Class instance" }), _jsx("path", { d: "M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z" }), _jsx("polyline", { points: "3.27 6.96 12 12.01 20.73 6.96" }), _jsx("line", { x1: "12", y1: "22.08", x2: "12", y2: "12" })] }), _jsx("span", { className: "font-semibold", children: classInstanceRef.className })] }), _jsx("pre", { className: "px-2 py-1.5 overflow-x-auto whitespace-pre-wrap", style: { color: colors.text }, children: JSON.stringify(classInstanceRef.data, null, 2) })] }));
138
+ };
59
139
  /**
60
140
  * Renders a StreamRef as a styled link/badge
61
141
  */
@@ -75,11 +155,13 @@ const StreamRefDisplay = ({ streamRef }) => {
75
155
  : streamRef.streamId] }));
76
156
  };
77
157
  /**
78
- * Recursively transforms a value for JSON display, replacing StreamRef objects
79
- * with placeholder strings that can be identified and replaced with React elements
158
+ * Recursively transforms a value for JSON display, replacing StreamRef and
159
+ * ClassInstanceRef objects with placeholder strings that can be identified
160
+ * and replaced with React elements.
80
161
  */
81
162
  const transformValueForDisplay = (value) => {
82
163
  const streamRefs = new Map();
164
+ const classInstanceRefs = new Map();
83
165
  let counter = 0;
84
166
  const transform = (v) => {
85
167
  if (isStreamRef(v)) {
@@ -87,6 +169,11 @@ const transformValueForDisplay = (value) => {
87
169
  streamRefs.set(placeholder, v);
88
170
  return placeholder;
89
171
  }
172
+ if (isClassInstanceRef(v)) {
173
+ const placeholder = `__CLASS_INSTANCE_REF_${counter++}__`;
174
+ classInstanceRefs.set(placeholder, v);
175
+ return placeholder;
176
+ }
90
177
  if (Array.isArray(v)) {
91
178
  return v.map(transform);
92
179
  }
@@ -103,37 +190,58 @@ const transformValueForDisplay = (value) => {
103
190
  return {
104
191
  json: JSON.stringify(transformed, null, 2),
105
192
  streamRefs,
193
+ classInstanceRefs,
106
194
  };
107
195
  };
108
196
  const JsonBlock = (value) => {
109
- const { json, streamRefs } = transformValueForDisplay(value);
110
- // If no stream refs, just render plain JSON
111
- if (streamRefs.size === 0) {
197
+ const { json, streamRefs, classInstanceRefs } = transformValueForDisplay(value);
198
+ // If no special refs, just render plain JSON
199
+ if (streamRefs.size === 0 && classInstanceRefs.size === 0) {
112
200
  return (_jsx("pre", { className: "text-[11px] overflow-x-auto rounded-md border p-3", style: {
113
201
  borderColor: 'var(--ds-gray-300)',
114
202
  backgroundColor: 'var(--ds-gray-100)',
115
203
  color: 'var(--ds-gray-1000)',
116
204
  }, children: _jsx("code", { children: json }) }));
117
205
  }
118
- // Split the JSON by stream ref placeholders and render with React elements
119
- const parts = [];
120
- let remaining = json;
206
+ // Build a combined map of all placeholders to their React elements
207
+ const placeholderComponents = new Map();
121
208
  let keyIndex = 0;
122
209
  for (const [placeholder, streamRef] of streamRefs) {
123
- const index = remaining.indexOf(`"${placeholder}"`);
124
- if (index !== -1) {
125
- // Add text before the placeholder
126
- if (index > 0) {
127
- parts.push(remaining.slice(0, index));
210
+ placeholderComponents.set(placeholder, _jsx(StreamRefDisplay, { streamRef: streamRef }, keyIndex++));
211
+ }
212
+ for (const [placeholder, classInstanceRef] of classInstanceRefs) {
213
+ placeholderComponents.set(placeholder, _jsx(ClassInstanceRefDisplay, { classInstanceRef: classInstanceRef }, keyIndex++));
214
+ }
215
+ // Split the JSON by all placeholders and render with React elements
216
+ const parts = [];
217
+ let remaining = json;
218
+ // Process placeholders in order of their appearance in the string
219
+ while (remaining.length > 0) {
220
+ let earliestIndex = -1;
221
+ let earliestPlaceholder = '';
222
+ let earliestComponent = null;
223
+ // Find the earliest placeholder in the remaining string
224
+ for (const [placeholder, component] of placeholderComponents) {
225
+ const index = remaining.indexOf(`"${placeholder}"`);
226
+ if (index !== -1 && (earliestIndex === -1 || index < earliestIndex)) {
227
+ earliestIndex = index;
228
+ earliestPlaceholder = placeholder;
229
+ earliestComponent = component;
128
230
  }
129
- // Add the StreamRef component
130
- parts.push(_jsx(StreamRefDisplay, { streamRef: streamRef }, keyIndex++));
131
- remaining = remaining.slice(index + placeholder.length + 2); // +2 for quotes
132
231
  }
133
- }
134
- // Add any remaining text
135
- if (remaining) {
136
- parts.push(remaining);
232
+ if (earliestIndex === -1) {
233
+ // No more placeholders found, add the rest
234
+ parts.push(remaining);
235
+ break;
236
+ }
237
+ // Add text before the placeholder
238
+ if (earliestIndex > 0) {
239
+ parts.push(remaining.slice(0, earliestIndex));
240
+ }
241
+ // Add the component
242
+ parts.push(earliestComponent);
243
+ // Move past the placeholder
244
+ remaining = remaining.slice(earliestIndex + earliestPlaceholder.length + 2); // +2 for quotes
137
245
  }
138
246
  return (_jsx("pre", { className: "text-[11px] overflow-x-auto rounded-md border p-3", style: {
139
247
  borderColor: 'var(--ds-gray-300)',
@@ -337,6 +445,6 @@ export const AttributePanel = ({ data, isLoading, error, expiredAt, onStreamClic
337
445
  backgroundColor: 'var(--ds-gray-100)',
338
446
  }, children: visibleBasicAttributes.map((attribute) => (_jsxs("div", { className: "flex items-center justify-between px-3 py-1.5", style: {
339
447
  borderColor: 'var(--ds-gray-300)',
340
- }, children: [_jsx("span", { className: "text-[11px] font-medium", style: { color: 'var(--ds-gray-700)' }, children: attribute }), _jsx("span", { className: "text-[11px] font-mono", style: { color: 'var(--ds-gray-1000)' }, children: attributeToDisplayFn[attribute]?.(displayData[attribute]) })] }, attribute))) })), error ? (_jsxs(Alert, { variant: "destructive", className: "my-4", children: [_jsx(AlertCircle, { className: "h-4 w-4" }), _jsx(AlertTitle, { children: "Failed to load resource details" }), _jsx(AlertDescription, { className: "text-sm", children: error.message })] })) : hasExpired ? (_jsx(ExpiredDataMessage, {})) : (resolvedAttributes.map((attribute) => (_jsx(AttributeBlock, { isLoading: isLoading, attribute: attribute, value: displayData[attribute], context: displayContext }, attribute))))] }) }));
448
+ }, children: [_jsx("span", { className: "text-[11px] font-medium", style: { color: 'var(--ds-gray-700)' }, children: attribute }), _jsx("span", { className: "text-[11px] font-mono", style: { color: 'var(--ds-gray-1000)' }, children: attributeToDisplayFn[attribute]?.(displayData[attribute]) })] }, attribute))) })), error ? (_jsx(ErrorCard, { title: "Failed to load resource details", details: error.message, className: "my-4" })) : hasExpired ? (_jsx(ExpiredDataMessage, {})) : (resolvedAttributes.map((attribute) => (_jsx(AttributeBlock, { isLoading: isLoading, attribute: attribute, value: displayData[attribute], context: displayContext }, attribute))))] }) }));
341
449
  };
342
450
  //# sourceMappingURL=attribute-panel.js.map