deepline 0.1.90 → 0.1.93

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.
@@ -0,0 +1,217 @@
1
+ export type PlayLiveEventSource =
2
+ | 'worker'
3
+ | 'temporal'
4
+ | 'convex'
5
+ | 'play'
6
+ | 'system';
7
+ export type PlayRunTimelineEventType =
8
+ | 'play.run.status'
9
+ | 'play.run.snapshot'
10
+ | 'play.run.final_status'
11
+ | 'play.step.status'
12
+ | 'play.step.progress'
13
+ | 'play.run.health'
14
+ | 'play.run.log'
15
+ | 'play.sheet.summary'
16
+ | 'play.sheet.delta';
17
+
18
+ export type PlayRunTimelineLogEntry = {
19
+ kind: 'log';
20
+ at: string;
21
+ source: PlayLiveEventSource;
22
+ message: string;
23
+ };
24
+
25
+ export type PlayRunTimelineEventEntry = {
26
+ kind: 'event';
27
+ at: string;
28
+ eventType: PlayRunTimelineEventType;
29
+ summary: string;
30
+ };
31
+
32
+ export type PlayRunTimelineEntry =
33
+ | PlayRunTimelineLogEntry
34
+ | PlayRunTimelineEventEntry;
35
+
36
+ export function makePlayRunTimelineLogEntry(input: {
37
+ at?: string;
38
+ source: PlayLiveEventSource;
39
+ message: string;
40
+ }): PlayRunTimelineLogEntry {
41
+ return {
42
+ kind: 'log',
43
+ at: input.at ?? new Date().toISOString(),
44
+ source: input.source,
45
+ message: input.message,
46
+ };
47
+ }
48
+
49
+ export function makePlayRunTimelineEventEntry(input: {
50
+ at?: string;
51
+ eventType: PlayRunTimelineEventType;
52
+ summary: string;
53
+ }): PlayRunTimelineEventEntry {
54
+ return {
55
+ kind: 'event',
56
+ at: input.at ?? new Date().toISOString(),
57
+ eventType: input.eventType,
58
+ summary: input.summary,
59
+ };
60
+ }
61
+
62
+ export type PlayRuntimeTimingWindow = {
63
+ startedAt?: number | null;
64
+ completedAt?: number | null;
65
+ updatedAt?: number | null;
66
+ };
67
+
68
+ export type PlayStepStatusEventPayload = {
69
+ runId: string;
70
+ stepId: string;
71
+ status: 'running' | 'completed' | 'failed' | 'skipped';
72
+ label?: string;
73
+ artifactTableNamespace?: string | null;
74
+ } & PlayRuntimeTimingWindow;
75
+
76
+ export type PlayStepProgressEventPayload = {
77
+ runId: string;
78
+ stepId: string;
79
+ completed?: number;
80
+ total?: number;
81
+ failed?: number;
82
+ message?: string;
83
+ artifactTableNamespace?: string | null;
84
+ } & PlayRuntimeTimingWindow;
85
+
86
+ export type PlayRunHealthEventPayload = {
87
+ runId: string;
88
+ state: 'healthy' | 'degraded';
89
+ reasons: string[];
90
+ message: string;
91
+ taskQueue: string | null;
92
+ workflowPollerCount?: number;
93
+ activityPollerCount?: number;
94
+ lastHeartbeatAgeMs?: number | null;
95
+ };
96
+
97
+ export type PlayRunLogEventPayload = {
98
+ runId: string;
99
+ lines: string[];
100
+ source: PlayLiveEventSource;
101
+ };
102
+
103
+ export type PlaySheetStats = {
104
+ total: number;
105
+ queued: number;
106
+ running: number;
107
+ completed: number;
108
+ failed: number;
109
+ };
110
+
111
+ export type PlaySheetColumnStats = {
112
+ queued: number;
113
+ running: number;
114
+ completed: number;
115
+ failed: number;
116
+ cached: number;
117
+ missed: number;
118
+ skipped: number;
119
+ };
120
+
121
+ export type PlaySheetSummaryPayload = {
122
+ runId: string;
123
+ tableNamespace: string;
124
+ deltaCursor: number;
125
+ summary: {
126
+ stats: PlaySheetStats;
127
+ columns: Record<string, PlaySheetColumnStats>;
128
+ } | null;
129
+ previewRows: Array<{
130
+ key: string;
131
+ status: string;
132
+ data: Record<string, unknown>;
133
+ cellMeta: Record<string, unknown>;
134
+ }>;
135
+ };
136
+
137
+ export type PlaySheetDeltaEventPayload = {
138
+ runId: string;
139
+ tableNamespace: string;
140
+ nextCursor: number;
141
+ updates: Array<{
142
+ key: string;
143
+ status: string;
144
+ data: Record<string, unknown>;
145
+ cellMeta: Record<string, unknown>;
146
+ inputIndex?: number;
147
+ runId?: string;
148
+ error?: string;
149
+ stage?: string;
150
+ provider?: string;
151
+ seq?: number;
152
+ createdAt: string;
153
+ updatedAt: string;
154
+ }>;
155
+ };
156
+
157
+ export function resolveTimingWindow(input: {
158
+ startedAt?: number | null;
159
+ completedAt?: number | null;
160
+ updatedAt?: number | null;
161
+ }): PlayRuntimeTimingWindow {
162
+ const startedAt =
163
+ typeof input.startedAt === 'number' && Number.isFinite(input.startedAt)
164
+ ? input.startedAt
165
+ : null;
166
+ const completedAt =
167
+ typeof input.completedAt === 'number' && Number.isFinite(input.completedAt)
168
+ ? input.completedAt
169
+ : null;
170
+ const updatedAt =
171
+ typeof input.updatedAt === 'number' && Number.isFinite(input.updatedAt)
172
+ ? input.updatedAt
173
+ : null;
174
+
175
+ return {
176
+ startedAt,
177
+ completedAt,
178
+ updatedAt,
179
+ };
180
+ }
181
+
182
+ export function getTimingDurationMs(input: {
183
+ startedAt?: number | null;
184
+ completedAt?: number | null;
185
+ }): number | null {
186
+ return typeof input.startedAt === 'number' &&
187
+ Number.isFinite(input.startedAt) &&
188
+ typeof input.completedAt === 'number' &&
189
+ Number.isFinite(input.completedAt)
190
+ ? Math.max(0, input.completedAt - input.startedAt)
191
+ : null;
192
+ }
193
+
194
+ export function getTimingActiveDurationMs(input: {
195
+ startedAt?: number | null;
196
+ completedAt?: number | null;
197
+ updatedAt?: number | null;
198
+ now?: number;
199
+ }): number | null {
200
+ if (
201
+ typeof input.startedAt !== 'number' ||
202
+ !Number.isFinite(input.startedAt)
203
+ ) {
204
+ return null;
205
+ }
206
+ if (
207
+ typeof input.completedAt === 'number' &&
208
+ Number.isFinite(input.completedAt)
209
+ ) {
210
+ return Math.max(0, input.completedAt - input.startedAt);
211
+ }
212
+ const referenceAt =
213
+ typeof input.updatedAt === 'number' && Number.isFinite(input.updatedAt)
214
+ ? input.updatedAt
215
+ : (input.now ?? Date.now());
216
+ return Math.max(0, referenceAt - input.startedAt);
217
+ }