@workflow/web-shared 5.1.1 → 5.3.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.
- package/dist/components/event-list/event-details-panel.d.ts.map +1 -1
- package/dist/components/event-list/event-details-panel.js +7 -6
- package/dist/components/event-list/event-list-toolbar.d.ts +2 -1
- package/dist/components/event-list/event-list-toolbar.d.ts.map +1 -1
- package/dist/components/event-list/event-list-toolbar.js +20 -11
- package/dist/components/event-list/event-row.d.ts +3 -3
- package/dist/components/event-list/event-row.d.ts.map +1 -1
- package/dist/components/event-list/event-row.js +15 -13
- package/dist/components/event-list/use-event-search.d.ts +3 -1
- package/dist/components/event-list/use-event-search.d.ts.map +1 -1
- package/dist/components/event-list/use-event-search.js +19 -20
- package/dist/components/event-list-view.d.ts.map +1 -1
- package/dist/components/event-list-view.js +53 -24
- package/dist/components/hook-actions.d.ts +0 -1
- package/dist/components/hook-actions.d.ts.map +1 -1
- package/dist/components/hook-actions.js +1 -3
- package/dist/components/index.d.ts +5 -9
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -9
- package/dist/components/sidebar/attribute-panel.d.ts +0 -13
- package/dist/components/sidebar/attribute-panel.d.ts.map +1 -1
- package/dist/components/sidebar/attribute-panel.js +5 -5
- package/dist/components/sidebar/attributes-block.d.ts +0 -7
- package/dist/components/sidebar/attributes-block.d.ts.map +1 -1
- package/dist/components/sidebar/attributes-block.js +5 -5
- package/dist/components/sidebar/conversation-view.d.ts.map +1 -1
- package/dist/components/sidebar/conversation-view.js +4 -3
- package/dist/components/sidebar/copyable-data-block.d.ts.map +1 -1
- package/dist/components/sidebar/copyable-data-block.js +8 -6
- package/dist/components/sidebar/entity-detail-panel.d.ts.map +1 -1
- package/dist/components/sidebar/entity-detail-panel.js +2 -3
- package/dist/components/stream-image-preview.js +2 -2
- package/dist/components/stream-viewer.js +3 -3
- package/dist/components/trace-viewer/components/detail-panel-shell.d.ts +2 -1
- package/dist/components/trace-viewer/components/detail-panel-shell.d.ts.map +1 -1
- package/dist/components/trace-viewer/components/detail-panel-shell.js +3 -3
- package/dist/components/trace-viewer/components/event-list.d.ts.map +1 -1
- package/dist/components/trace-viewer/components/event-list.js +2 -2
- package/dist/components/trace-viewer/components/middle-truncate/truncate.d.ts +1 -4
- package/dist/components/trace-viewer/components/middle-truncate/truncate.d.ts.map +1 -1
- package/dist/components/trace-viewer/components/middle-truncate/truncate.js +2 -2
- package/dist/components/trace-viewer/components/minimap.d.ts.map +1 -1
- package/dist/components/trace-viewer/components/minimap.js +6 -4
- package/dist/components/trace-viewer/components/timeline.d.ts +0 -11
- package/dist/components/trace-viewer/components/timeline.d.ts.map +1 -1
- package/dist/components/trace-viewer/components/timeline.js +1 -2
- package/dist/components/trace-viewer/trace-viewer.js +9 -10
- package/dist/components/ui/button.d.ts +28 -17
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +47 -43
- package/dist/components/ui/context-card.js +3 -3
- package/dist/components/ui/copy-button.d.ts +15 -0
- package/dist/components/ui/copy-button.d.ts.map +1 -0
- package/dist/components/ui/copy-button.js +41 -0
- package/dist/components/ui/data-inspector.d.ts.map +1 -1
- package/dist/components/ui/data-inspector.js +8 -38
- package/dist/components/ui/decrypt-button.d.ts +3 -2
- package/dist/components/ui/decrypt-button.d.ts.map +1 -1
- package/dist/components/ui/decrypt-button.js +13 -7
- package/dist/components/ui/duplicate-event-tooltip.d.ts +1 -9
- package/dist/components/ui/duplicate-event-tooltip.d.ts.map +1 -1
- package/dist/components/ui/duplicate-event-tooltip.js +2 -10
- package/dist/components/ui/error-stack-block.js +3 -3
- package/dist/components/ui/icon-button.d.ts +2 -2
- package/dist/components/ui/icon-button.d.ts.map +1 -1
- package/dist/components/ui/icon-button.js +2 -3
- package/dist/components/ui/kbd.d.ts +1 -1
- package/dist/components/ui/kbd.d.ts.map +1 -1
- package/dist/components/ui/kbd.js +1 -2
- package/dist/components/ui/search-input.d.ts +19 -0
- package/dist/components/ui/search-input.d.ts.map +1 -0
- package/dist/components/ui/search-input.js +61 -0
- package/dist/components/ui/spinner.d.ts +54 -6
- package/dist/components/ui/spinner.d.ts.map +1 -1
- package/dist/components/ui/spinner.js +84 -46
- package/dist/components/workflow-traces/trace-span-construction.d.ts +1 -22
- package/dist/components/workflow-traces/trace-span-construction.d.ts.map +1 -1
- package/dist/components/workflow-traces/trace-span-construction.js +3 -3
- package/dist/index.d.ts +9 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -11
- package/dist/lib/event-analysis.d.ts +1 -25
- package/dist/lib/event-analysis.d.ts.map +1 -1
- package/dist/lib/event-analysis.js +2 -75
- package/dist/lib/event-list-model.d.ts +4 -2
- package/dist/lib/event-list-model.d.ts.map +1 -1
- package/dist/lib/event-list-model.js +13 -11
- package/dist/lib/exact-event-search-id.d.ts +0 -2
- package/dist/lib/exact-event-search-id.d.ts.map +1 -1
- package/dist/lib/exact-event-search-id.js +1 -12
- package/dist/lib/hydration.d.ts +1 -12
- package/dist/lib/hydration.d.ts.map +1 -1
- package/dist/lib/hydration.js +8 -20
- package/dist/lib/stream-display.d.ts +0 -1
- package/dist/lib/stream-display.d.ts.map +1 -1
- package/dist/lib/stream-display.js +2 -2
- package/dist/lib/trace-builder.d.ts +0 -8
- package/dist/lib/trace-builder.d.ts.map +1 -1
- package/dist/lib/trace-builder.js +2 -2
- package/dist/lib/utils.d.ts +0 -22
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +1 -31
- package/dist/styles.css +286 -117
- package/package.json +5 -17
- package/src/components/event-list/event-details-panel.tsx +22 -26
- package/src/components/event-list/event-list-toolbar.tsx +35 -28
- package/src/components/event-list/event-row.tsx +33 -29
- package/src/components/event-list/use-event-search.ts +29 -22
- package/src/components/event-list-view.tsx +180 -52
- package/src/components/hook-actions.tsx +0 -1
- package/src/components/index.ts +4 -20
- package/src/components/sidebar/attribute-panel.tsx +4 -7
- package/src/components/sidebar/attributes-block.tsx +7 -6
- package/src/components/sidebar/conversation-view.tsx +3 -2
- package/src/components/sidebar/copyable-data-block.tsx +17 -14
- package/src/components/sidebar/entity-detail-panel.tsx +2 -7
- package/src/components/stream-image-preview.tsx +1 -1
- package/src/components/stream-viewer.tsx +4 -4
- package/src/components/trace-viewer/components/detail-panel-shell.tsx +3 -0
- package/src/components/trace-viewer/components/event-list.tsx +16 -18
- package/src/components/trace-viewer/components/middle-truncate/truncate.ts +1 -2
- package/src/components/trace-viewer/components/minimap.tsx +4 -3
- package/src/components/trace-viewer/components/timeline.tsx +0 -2
- package/src/components/trace-viewer/trace-viewer.tsx +19 -38
- package/src/components/ui/button.tsx +144 -46
- package/src/components/ui/context-card.tsx +2 -2
- package/src/components/ui/copy-button.tsx +86 -0
- package/src/components/ui/data-inspector.tsx +23 -67
- package/src/components/ui/decrypt-button.tsx +23 -48
- package/src/components/ui/duplicate-event-tooltip.tsx +1 -22
- package/src/components/ui/error-stack-block.tsx +4 -4
- package/src/components/ui/icon-button.tsx +1 -3
- package/src/components/ui/kbd.tsx +0 -2
- package/src/components/ui/search-input.tsx +143 -0
- package/src/components/ui/spinner.tsx +105 -55
- package/src/components/workflow-traces/trace-span-construction.ts +2 -2
- package/src/index.ts +7 -55
- package/src/lib/event-analysis.ts +1 -104
- package/src/lib/event-list-model.ts +15 -12
- package/src/lib/exact-event-search-id.ts +0 -13
- package/src/lib/hydration.ts +6 -31
- package/src/lib/stream-display.ts +1 -1
- package/src/lib/trace-builder.ts +1 -1
- package/src/lib/utils.ts +0 -48
- package/src/styles.css +286 -117
- package/dist/components/trace-viewer/components/copy-button.d.ts +0 -9
- package/dist/components/trace-viewer/components/copy-button.d.ts.map +0 -1
- package/dist/components/trace-viewer/components/copy-button.js +0 -27
- package/dist/components/ui/alert.d.ts +0 -9
- package/dist/components/ui/alert.d.ts.map +0 -1
- package/dist/components/ui/alert.js +0 -23
- package/dist/components/ui/card.d.ts +0 -9
- package/dist/components/ui/card.d.ts.map +0 -1
- package/dist/components/ui/card.js +0 -18
- package/dist/components/ui/load-more-button.d.ts +0 -13
- package/dist/components/ui/load-more-button.d.ts.map +0 -1
- package/dist/components/ui/load-more-button.js +0 -12
- package/dist/components/ui/menu-dropdown.d.ts +0 -16
- package/dist/components/ui/menu-dropdown.d.ts.map +0 -1
- package/dist/components/ui/menu-dropdown.js +0 -30
- package/dist/hooks/use-dark-mode.d.ts +0 -9
- package/dist/hooks/use-dark-mode.d.ts.map +0 -1
- package/dist/hooks/use-dark-mode.js +0 -30
- package/dist/lib/event-materialization.d.ts +0 -91
- package/dist/lib/event-materialization.d.ts.map +0 -1
- package/dist/lib/event-materialization.js +0 -219
- package/src/components/index.d.ts +0 -1
- package/src/components/trace-viewer/components/copy-button.tsx +0 -68
- package/src/components/ui/alert.tsx +0 -59
- package/src/components/ui/card.tsx +0 -79
- package/src/components/ui/load-more-button.tsx +0 -38
- package/src/components/ui/menu-dropdown.tsx +0 -97
- package/src/hooks/use-dark-mode.ts +0 -34
- package/src/index.d.ts +0 -1
- package/src/lib/event-materialization.ts +0 -304
package/src/index.ts
CHANGED
|
@@ -6,85 +6,37 @@ export {
|
|
|
6
6
|
export type { Event, Hook, Step, WorkflowRun } from '@workflow/world';
|
|
7
7
|
export * from './components';
|
|
8
8
|
export {
|
|
9
|
-
hookEventsToHookEntity,
|
|
10
9
|
stepEventsToStepEntity,
|
|
11
10
|
waitEventsToWaitEntity,
|
|
12
11
|
} from './components/workflow-traces/trace-span-construction';
|
|
13
|
-
export {
|
|
14
|
-
DUPLICATE_EVENT_MESSAGE,
|
|
15
|
-
findDuplicateEventIds,
|
|
16
|
-
} from './lib/duplicate-events';
|
|
12
|
+
export { cn } from './lib/cn';
|
|
17
13
|
export type { EventAnalysis } from './lib/event-analysis';
|
|
18
|
-
export {
|
|
19
|
-
analyzeEvents,
|
|
20
|
-
hasPendingHooksFromEvents,
|
|
21
|
-
hasPendingStepsFromEvents,
|
|
22
|
-
isTerminalStatus,
|
|
23
|
-
shouldShowReenqueueButton,
|
|
24
|
-
} from './lib/event-analysis';
|
|
14
|
+
export { analyzeEvents } from './lib/event-analysis';
|
|
25
15
|
export type {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
MaterializedStep,
|
|
29
|
-
MaterializedWait,
|
|
30
|
-
} from './lib/event-materialization';
|
|
31
|
-
export {
|
|
32
|
-
materializeAll,
|
|
33
|
-
materializeHooks,
|
|
34
|
-
materializeSteps,
|
|
35
|
-
materializeWaits,
|
|
36
|
-
} from './lib/event-materialization';
|
|
37
|
-
export {
|
|
38
|
-
type ExactIdSearchResult,
|
|
39
|
-
type ExactWorkflowSearchId,
|
|
40
|
-
type ExactWorkflowSearchIdKind,
|
|
41
|
-
looksLikeWorkflowIdSearchInput,
|
|
42
|
-
parseExactWorkflowSearchId,
|
|
16
|
+
ExactIdSearchResult,
|
|
17
|
+
ExactWorkflowSearchIdKind,
|
|
43
18
|
} from './lib/exact-event-search-id';
|
|
44
|
-
export type { Revivers
|
|
19
|
+
export type { Revivers } from './lib/hydration';
|
|
45
20
|
export {
|
|
46
|
-
CLASS_INSTANCE_REF_TYPE,
|
|
47
|
-
ClassInstanceRef,
|
|
48
21
|
ENCRYPTED_PLACEHOLDER,
|
|
49
|
-
extractStreamIds,
|
|
50
22
|
getWebRevivers,
|
|
51
23
|
hasEncryptedFields,
|
|
52
24
|
hydrateResourceIO,
|
|
53
25
|
hydrateResourceIOAsync,
|
|
54
|
-
hydrateResourceIOWithKey,
|
|
55
|
-
isClassInstanceRef,
|
|
56
|
-
isEncryptedMarker,
|
|
57
|
-
isStreamId,
|
|
58
|
-
isStreamRef,
|
|
59
|
-
STREAM_REF_TYPE,
|
|
60
|
-
truncateId,
|
|
61
26
|
} from './lib/hydration';
|
|
62
27
|
export {
|
|
63
28
|
getRunLimitGuidance,
|
|
64
|
-
isQuickJSSnapshotRun,
|
|
65
29
|
type RunLimitGuidance,
|
|
66
30
|
type RunLimitGuidanceInput,
|
|
67
31
|
type RunLimitGuidanceKind,
|
|
68
32
|
} from './lib/run-limit-guidance';
|
|
69
|
-
export {
|
|
70
|
-
isSealedNoopEvent,
|
|
71
|
-
SEALED_EVENT_MESSAGE,
|
|
72
|
-
} from './lib/sealed-events';
|
|
73
33
|
export {
|
|
74
34
|
createRunStateHydrator,
|
|
75
35
|
type RunStateHydrator,
|
|
76
36
|
type RunStateHydratorOptions,
|
|
77
37
|
type StateHistoryPage,
|
|
78
38
|
} from './lib/state-hydration';
|
|
79
|
-
export type { DecodedStreamChunkSource } from './lib/stream-display';
|
|
80
39
|
export { getStreamImageType } from './lib/stream-image';
|
|
81
40
|
export type { ToastAdapter } from './lib/toast';
|
|
82
|
-
export { ToastProvider
|
|
83
|
-
export
|
|
84
|
-
export {
|
|
85
|
-
extractConversation,
|
|
86
|
-
formatDuration,
|
|
87
|
-
formatDurationPrecise,
|
|
88
|
-
identifyStreamSteps,
|
|
89
|
-
isDoStreamStep,
|
|
90
|
-
} from './lib/utils';
|
|
41
|
+
export { ToastProvider } from './lib/toast';
|
|
42
|
+
export { formatDuration } from './lib/utils';
|
|
@@ -3,18 +3,9 @@
|
|
|
3
3
|
* Used by run-actions and trace viewer components.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
type Event,
|
|
8
|
-
isRunCreationEvent,
|
|
9
|
-
isTerminalWorkflowRunStatus,
|
|
10
|
-
type WorkflowRunStatus,
|
|
11
|
-
} from '@workflow/world';
|
|
6
|
+
import { type Event, isRunCreationEvent } from '@workflow/world';
|
|
12
7
|
import { findStartHookCreation } from './start-hook';
|
|
13
8
|
|
|
14
|
-
// Time thresholds for Re-enqueue button visibility
|
|
15
|
-
const STEP_ACTIVITY_TIMEOUT_MS = 30 * 60 * 1000; // 30 minutes
|
|
16
|
-
const STEP_IDLE_TIMEOUT_MS = 5 * 60 * 1000; // 5 minutes
|
|
17
|
-
|
|
18
9
|
/**
|
|
19
10
|
* Result of analyzing events for a workflow run
|
|
20
11
|
*/
|
|
@@ -146,97 +137,3 @@ export function analyzeEvents(events: Event[] | undefined): EventAnalysis {
|
|
|
146
137
|
lastStepCompletionAt,
|
|
147
138
|
};
|
|
148
139
|
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Check if a workflow run status is terminal (completed, failed, or cancelled)
|
|
152
|
-
*/
|
|
153
|
-
export function isTerminalStatus(
|
|
154
|
-
status: WorkflowRunStatus | undefined
|
|
155
|
-
): boolean {
|
|
156
|
-
return status ? isTerminalWorkflowRunStatus(status) : false;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Determine if the Re-enqueue button should be shown without the debug flag.
|
|
161
|
-
*
|
|
162
|
-
* The Re-enqueue button is shown when the workflow appears to be stuck:
|
|
163
|
-
* - The workflow is not in a terminal state
|
|
164
|
-
* - There are no pending sleeps (which would show the Wake up button instead)
|
|
165
|
-
* - There are no pending hooks (which are waiting for external input)
|
|
166
|
-
* - Either:
|
|
167
|
-
* - The last step_started or step_retrying event was >30 minutes ago, OR
|
|
168
|
-
* - There have been no pending steps for >5 minutes (all steps completed/failed)
|
|
169
|
-
*/
|
|
170
|
-
export function shouldShowReenqueueButton(
|
|
171
|
-
events: Event[] | undefined,
|
|
172
|
-
status: WorkflowRunStatus | undefined
|
|
173
|
-
): boolean {
|
|
174
|
-
// Never show if in terminal state
|
|
175
|
-
if (isTerminalStatus(status)) {
|
|
176
|
-
return false;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
const analysis = analyzeEvents(events);
|
|
180
|
-
|
|
181
|
-
// Don't show if there are pending sleeps (Wake up button handles this)
|
|
182
|
-
if (analysis.hasPendingSleeps) {
|
|
183
|
-
return false;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// Don't show if there are pending hooks (waiting for external input)
|
|
187
|
-
if (analysis.hasPendingHooks) {
|
|
188
|
-
return false;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
const now = Date.now();
|
|
192
|
-
|
|
193
|
-
// Check if last step activity was >30 minutes ago
|
|
194
|
-
if (analysis.lastStepActivityAt) {
|
|
195
|
-
const timeSinceLastActivity = now - analysis.lastStepActivityAt.getTime();
|
|
196
|
-
if (timeSinceLastActivity > STEP_ACTIVITY_TIMEOUT_MS) {
|
|
197
|
-
return true;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// Check if there are no pending steps and last completion was >5 minutes ago
|
|
202
|
-
if (!analysis.hasPendingSteps && analysis.lastStepCompletionAt) {
|
|
203
|
-
const timeSinceLastCompletion =
|
|
204
|
-
now - analysis.lastStepCompletionAt.getTime();
|
|
205
|
-
if (timeSinceLastCompletion > STEP_IDLE_TIMEOUT_MS) {
|
|
206
|
-
return true;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// If there's no step activity at all but the run is not terminal,
|
|
211
|
-
// and we've been waiting for a while, show the button
|
|
212
|
-
if (
|
|
213
|
-
!analysis.lastStepActivityAt &&
|
|
214
|
-
!analysis.hasPendingSteps &&
|
|
215
|
-
!analysis.hasPendingSleeps &&
|
|
216
|
-
!analysis.hasPendingHooks
|
|
217
|
-
) {
|
|
218
|
-
// This case handles runs that haven't started any steps yet
|
|
219
|
-
// but aren't in a terminal state - they might be stuck
|
|
220
|
-
return true;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
return false;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Check if there are pending steps from an events list.
|
|
228
|
-
*/
|
|
229
|
-
export function hasPendingStepsFromEvents(
|
|
230
|
-
events: Event[] | undefined
|
|
231
|
-
): boolean {
|
|
232
|
-
return analyzeEvents(events).hasPendingSteps;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Check if there are pending hooks from an events list.
|
|
237
|
-
*/
|
|
238
|
-
export function hasPendingHooksFromEvents(
|
|
239
|
-
events: Event[] | undefined
|
|
240
|
-
): boolean {
|
|
241
|
-
return analyzeEvents(events).hasPendingHooks;
|
|
242
|
-
}
|
|
@@ -609,7 +609,7 @@ export type EventSearchState =
|
|
|
609
609
|
status: 'error';
|
|
610
610
|
query: string;
|
|
611
611
|
id: ExactWorkflowSearchId;
|
|
612
|
-
message
|
|
612
|
+
message?: string;
|
|
613
613
|
};
|
|
614
614
|
|
|
615
615
|
const NO_EVENTS: Event[] = [];
|
|
@@ -648,15 +648,20 @@ function countEvents(n: number): string {
|
|
|
648
648
|
|
|
649
649
|
/** Shown in place of the list when it has no rows. */
|
|
650
650
|
export function getEmptyMessage(search: EventSearchState): string {
|
|
651
|
+
return search.status === 'not_found'
|
|
652
|
+
? `No events found for ${search.query}`
|
|
653
|
+
: 'No events found';
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
/** Shown under the search box while the query cannot be looked up. */
|
|
657
|
+
export function getSearchHint(search: EventSearchState): string | null {
|
|
651
658
|
switch (search.status) {
|
|
652
|
-
case '
|
|
653
|
-
return
|
|
654
|
-
case 'error':
|
|
655
|
-
return search.message;
|
|
659
|
+
case 'incomplete':
|
|
660
|
+
return 'Enter a full step, wait, hook, or event ID to search';
|
|
656
661
|
case 'unavailable':
|
|
657
|
-
return '
|
|
662
|
+
return 'Search isn’t available in this view';
|
|
658
663
|
default:
|
|
659
|
-
return
|
|
664
|
+
return null;
|
|
660
665
|
}
|
|
661
666
|
}
|
|
662
667
|
|
|
@@ -667,17 +672,15 @@ export function getFooterLabel(
|
|
|
667
672
|
total: number;
|
|
668
673
|
hasMoreEvents: boolean;
|
|
669
674
|
}
|
|
670
|
-
): string {
|
|
675
|
+
): string | null {
|
|
671
676
|
const { total, hasMoreEvents } = counts;
|
|
672
677
|
switch (search.status) {
|
|
673
678
|
case 'ok':
|
|
674
679
|
return `${countEvents(total)} for ${search.query}${search.truncated ? ' (results may be truncated)' : ''}`;
|
|
680
|
+
case 'loading':
|
|
675
681
|
case 'not_found':
|
|
676
|
-
return `No events found for ${search.query}`;
|
|
677
682
|
case 'error':
|
|
678
|
-
return
|
|
679
|
-
case 'incomplete':
|
|
680
|
-
return 'Enter a full step ID, wait ID, hook ID, or event ID';
|
|
683
|
+
return null;
|
|
681
684
|
default:
|
|
682
685
|
return `${countEvents(total)}${hasMoreEvents ? ' loaded' : ''}`;
|
|
683
686
|
}
|
|
@@ -7,8 +7,6 @@ const WAIT_ID_PATTERN = new RegExp(`^wait_(${WORKFLOW_ULID_BODY})$`, 'i');
|
|
|
7
7
|
const HOOK_ID_PATTERN = new RegExp(`^hook_(${WORKFLOW_ULID_BODY})$`, 'i');
|
|
8
8
|
const EVENT_ID_PATTERN = new RegExp(`^evnt_(${WORKFLOW_ULID_BODY})$`, 'i');
|
|
9
9
|
|
|
10
|
-
const WORKFLOW_ID_PREFIX_PATTERN = /^(step_|wait_|hook_|evnt_|wrun_)/i;
|
|
11
|
-
|
|
12
10
|
export type ExactWorkflowSearchIdKind = 'step' | 'wait' | 'hook' | 'event';
|
|
13
11
|
|
|
14
12
|
export type ExactWorkflowSearchId = {
|
|
@@ -54,14 +52,3 @@ export function parseExactWorkflowSearchId(
|
|
|
54
52
|
matchPrefixedId(EVENT_ID_PATTERN, 'evnt', 'event', trimmed)
|
|
55
53
|
);
|
|
56
54
|
}
|
|
57
|
-
|
|
58
|
-
/** True when input looks like the user is attempting an ID search (including partial). */
|
|
59
|
-
export function looksLikeWorkflowIdSearchInput(query: string): boolean {
|
|
60
|
-
const trimmed = query.trim();
|
|
61
|
-
if (!WORKFLOW_ID_PREFIX_PATTERN.test(trimmed)) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
// Distinguish IDs (contain digits) from event-type strings like step_started.
|
|
65
|
-
// Assumes workflow event types do not include digits in their names.
|
|
66
|
-
return /\d/.test(trimmed);
|
|
67
|
-
}
|
package/src/lib/hydration.ts
CHANGED
|
@@ -20,22 +20,14 @@ import { getEventDataRefFields } from '@workflow/world';
|
|
|
20
20
|
|
|
21
21
|
// Re-export types and utilities that consumers need
|
|
22
22
|
export {
|
|
23
|
-
CLASS_INSTANCE_REF_TYPE,
|
|
24
23
|
ClassInstanceRef,
|
|
25
24
|
ENCRYPTED_PLACEHOLDER,
|
|
26
|
-
extractStreamIds,
|
|
27
25
|
isClassInstanceRef,
|
|
28
|
-
isEncryptedData,
|
|
29
26
|
isRunRef,
|
|
30
|
-
isStreamId,
|
|
31
27
|
isStreamRef,
|
|
32
28
|
type Revivers,
|
|
33
|
-
RUN_REF_TYPE,
|
|
34
29
|
type RunRef,
|
|
35
|
-
STREAM_REF_TYPE,
|
|
36
30
|
type StreamRef,
|
|
37
|
-
serializedInstanceToRef,
|
|
38
|
-
truncateId,
|
|
39
31
|
} from '@workflow/core/serialization-format';
|
|
40
32
|
|
|
41
33
|
// ---------------------------------------------------------------------------
|
|
@@ -179,7 +171,7 @@ export function getWebRevivers(): Revivers {
|
|
|
179
171
|
// doesn't need `instanceof FatalError` to pass (no user code runs
|
|
180
172
|
// here). The web o11y UI needs `name`, `message`, `stack`, and any extra
|
|
181
173
|
// enumerable fields to render. Construct a plain `Error` with `name`
|
|
182
|
-
// set;
|
|
174
|
+
// set; DataInspector reads `constructor.name` for the displayed
|
|
183
175
|
// class label, but we don't have the real class, so we emit a tagged
|
|
184
176
|
// Error whose `name` field carries the class identity. This matches
|
|
185
177
|
// how the existing base `Error` reviver presents unknown subclasses.
|
|
@@ -410,7 +402,7 @@ export const ENCRYPTED_DISPLAY_NAME = 'Encrypted';
|
|
|
410
402
|
* Create a display-friendly object for encrypted data.
|
|
411
403
|
*
|
|
412
404
|
* Uses the same named-constructor trick as the Instance reviver so that
|
|
413
|
-
*
|
|
405
|
+
* the inspector renders the constructor name ("Encrypted") with no
|
|
414
406
|
* expandable children. The original encrypted bytes are stored in a
|
|
415
407
|
* non-enumerable property for later decryption.
|
|
416
408
|
*/
|
|
@@ -421,7 +413,7 @@ function createEncryptedMarker(data: Uint8Array): object {
|
|
|
421
413
|
]!;
|
|
422
414
|
const obj = Object.create(ctor.prototype);
|
|
423
415
|
// Store original bytes for decryption, but non-enumerable so
|
|
424
|
-
//
|
|
416
|
+
// DataInspector doesn't list them as entries
|
|
425
417
|
Object.defineProperty(obj, '__encryptedData', {
|
|
426
418
|
value: data,
|
|
427
419
|
enumerable: false,
|
|
@@ -443,14 +435,14 @@ export function isEncryptedMarker(value: unknown): boolean {
|
|
|
443
435
|
// Expired data display markers
|
|
444
436
|
// ---------------------------------------------------------------------------
|
|
445
437
|
|
|
446
|
-
|
|
438
|
+
const EXPIRED_DISPLAY_NAME = 'Expired Data';
|
|
447
439
|
|
|
448
440
|
/**
|
|
449
441
|
* Create a display-friendly object for expired data.
|
|
450
442
|
*
|
|
451
443
|
* Uses the same named-constructor trick as the encrypted marker so that
|
|
452
|
-
*
|
|
453
|
-
*
|
|
444
|
+
* DataInspector shows the constructor name ("Expired Data") with no
|
|
445
|
+
* entries.
|
|
454
446
|
*/
|
|
455
447
|
function createExpiredMarker(): object {
|
|
456
448
|
// biome-ignore lint/complexity/useArrowFunction: arrow functions have no .prototype
|
|
@@ -519,23 +511,6 @@ function replaceEncryptedAndExpiredWithMarkers<T>(resource: T): T {
|
|
|
519
511
|
return result as T;
|
|
520
512
|
}
|
|
521
513
|
|
|
522
|
-
/**
|
|
523
|
-
* Hydrate resource data with decryption support.
|
|
524
|
-
*
|
|
525
|
-
* When a key is provided, encrypted fields are decrypted before hydration.
|
|
526
|
-
* This is the async version used when the user clicks "Decrypt" in the web UI.
|
|
527
|
-
*
|
|
528
|
-
* Handles both top-level fields (input, output, metadata) and nested eventData
|
|
529
|
-
* payload fields for that event type.
|
|
530
|
-
*/
|
|
531
|
-
export async function hydrateResourceIOWithKey<T>(
|
|
532
|
-
resource: T,
|
|
533
|
-
key: Uint8Array,
|
|
534
|
-
extraRevivers?: Revivers
|
|
535
|
-
): Promise<T> {
|
|
536
|
-
return hydrateResourceIOAsync(resource, key, extraRevivers);
|
|
537
|
-
}
|
|
538
|
-
|
|
539
514
|
/**
|
|
540
515
|
* Async hydration for web display.
|
|
541
516
|
*
|
|
@@ -9,7 +9,7 @@ export interface FormattedStreamChunkDisplay {
|
|
|
9
9
|
decodedFrom?: DecodedStreamChunkSource;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
function summarizeArrayBufferView(value: ArrayBufferView): string {
|
|
13
13
|
const ta = value as unknown as {
|
|
14
14
|
length: number;
|
|
15
15
|
constructor: { name: string };
|
package/src/lib/trace-builder.ts
CHANGED
|
@@ -35,7 +35,7 @@ import type { Span } from './trace-types';
|
|
|
35
35
|
* step/timer/hook events (e.g. `attr_set`, whose correlationId is a dedup
|
|
36
36
|
* token rather than a child entity ID).
|
|
37
37
|
*/
|
|
38
|
-
|
|
38
|
+
const isRunLevelEvent = (event: Event): boolean =>
|
|
39
39
|
!event.correlationId ||
|
|
40
40
|
(!isWaitEventType(event.eventType) &&
|
|
41
41
|
!isHookLifecycleEventType(event.eventType) &&
|
package/src/lib/utils.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Step } from '@workflow/world';
|
|
2
1
|
import type { ModelMessage } from 'ai';
|
|
3
2
|
|
|
4
3
|
const MS_IN_SECOND = 1000;
|
|
@@ -127,24 +126,6 @@ export function formatDurationPrecise(ms: number, fractionDigits = 2): string {
|
|
|
127
126
|
return parts.join(' ');
|
|
128
127
|
}
|
|
129
128
|
|
|
130
|
-
/**
|
|
131
|
-
* Returns a formatted pagination display string
|
|
132
|
-
* @param currentPage - The current page number
|
|
133
|
-
* @param totalPages - The total number of pages visited so far
|
|
134
|
-
* @param hasMore - Whether there are more pages available
|
|
135
|
-
* @returns Formatted string like "Page 1 of 3+" or "Page 2 of 2"
|
|
136
|
-
*/
|
|
137
|
-
export function getPaginationDisplay(
|
|
138
|
-
currentPage: number,
|
|
139
|
-
totalPages: number,
|
|
140
|
-
hasMore: boolean
|
|
141
|
-
): string {
|
|
142
|
-
if (hasMore) {
|
|
143
|
-
return `Page ${currentPage} of ${totalPages}+`;
|
|
144
|
-
}
|
|
145
|
-
return `Page ${currentPage} of ${totalPages}`;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
129
|
// ============================================================================
|
|
149
130
|
// Durable Agent Utilities
|
|
150
131
|
// ============================================================================
|
|
@@ -181,32 +162,3 @@ export function extractConversation(stepInput: unknown): ModelMessage[] | null {
|
|
|
181
162
|
|
|
182
163
|
return firstArg as ModelMessage[];
|
|
183
164
|
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* A doStreamStep with its conversation input extracted
|
|
187
|
-
*/
|
|
188
|
-
export interface StreamStep {
|
|
189
|
-
stepId: string;
|
|
190
|
-
stepName: string;
|
|
191
|
-
displayName: string;
|
|
192
|
-
conversation: ModelMessage[];
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Identifies all stream steps (doStreamStep) in a run and extracts their conversations.
|
|
197
|
-
*/
|
|
198
|
-
export function identifyStreamSteps(steps: Step[]): StreamStep[] {
|
|
199
|
-
return steps
|
|
200
|
-
.filter((step) => isDoStreamStep(step.stepName))
|
|
201
|
-
.map((step) => {
|
|
202
|
-
const functionName = step.stepName.split('//').pop() ?? 'unknown';
|
|
203
|
-
const conversation = extractConversation(step.input) ?? [];
|
|
204
|
-
|
|
205
|
-
return {
|
|
206
|
-
stepId: step.stepId,
|
|
207
|
-
stepName: step.stepName,
|
|
208
|
-
displayName: functionName,
|
|
209
|
-
conversation,
|
|
210
|
-
};
|
|
211
|
-
});
|
|
212
|
-
}
|