@pipelex/mthds-ui 0.38.0 → 0.40.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/README.md +4 -2
- package/dist/chunk-7JZBXBZS.js +258 -0
- package/dist/chunk-7JZBXBZS.js.map +1 -0
- package/dist/{chunk-AGFLCOWW.js → chunk-HPARBH6K.js} +14 -197
- package/dist/chunk-HPARBH6K.js.map +1 -0
- package/dist/chunk-N2F62MW7.js +55 -0
- package/dist/chunk-N2F62MW7.js.map +1 -0
- package/dist/chunk-P6IGZVWE.js +155 -0
- package/dist/chunk-P6IGZVWE.js.map +1 -0
- package/dist/chunk-RU3CIXFC.js +1251 -0
- package/dist/chunk-RU3CIXFC.js.map +1 -0
- package/dist/form/brand/index.js.map +1 -1
- package/dist/form/react/index.d.ts +36 -3
- package/dist/form/react/index.js +45 -14
- package/dist/form/react/index.js.map +1 -1
- package/dist/graph/index.d.ts +19 -3
- package/dist/graph/index.js +20 -12
- package/dist/graph/react/index.d.ts +13 -13
- package/dist/graph/react/index.js +387 -560
- package/dist/graph/react/index.js.map +1 -1
- package/dist/graph/react/viewer/GraphToolbar.css +2 -107
- package/dist/graph/react/viewer/StyleMenu.css +109 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +20 -12
- package/dist/registryJoin-C6Wfkik-.d.ts +441 -0
- package/dist/standalone/graph-standalone.html +183 -178
- package/dist/standalone/graph-viewer.css +75 -70
- package/dist/standalone/graph-viewer.js +108 -108
- package/dist/static-graph/index.d.ts +1 -1
- package/dist/timeline/index.d.ts +240 -77
- package/dist/timeline/index.js +61 -3
- package/dist/timeline/react/RunTimeline.css +48 -0
- package/dist/timeline/react/index.d.ts +46 -4
- package/dist/timeline/react/index.js +774 -105
- package/dist/timeline/react/index.js.map +1 -1
- package/dist/timeline/react/styles/simple/SimpleProgress.css +354 -0
- package/dist/{types-DsrzH6gM.d.ts → types-DLAnYNoi.d.ts} +1 -1
- package/package.json +5 -3
- package/dist/chunk-AGFLCOWW.js.map +0 -1
- package/dist/chunk-ILZJIORT.js +0 -54
- package/dist/chunk-ILZJIORT.js.map +0 -1
- package/dist/chunk-JJG2TO7P.js +0 -473
- package/dist/chunk-JJG2TO7P.js.map +0 -1
- package/dist/progressSnapshot-VZ4PLul9.d.ts +0 -191
|
@@ -0,0 +1,1251 @@
|
|
|
1
|
+
import {
|
|
2
|
+
humanizeInSentence,
|
|
3
|
+
pipeTitle
|
|
4
|
+
} from "./chunk-P6IGZVWE.js";
|
|
5
|
+
import {
|
|
6
|
+
isBindingStepSpec
|
|
7
|
+
} from "./chunk-4KLE62AN.js";
|
|
8
|
+
import {
|
|
9
|
+
__spreadProps,
|
|
10
|
+
__spreadValues
|
|
11
|
+
} from "./chunk-2NMEKWO5.js";
|
|
12
|
+
|
|
13
|
+
// src/timeline/progressSnapshot.ts
|
|
14
|
+
var PROGRESS_MODE = {
|
|
15
|
+
LIVE: "live",
|
|
16
|
+
DRY: "dry"
|
|
17
|
+
};
|
|
18
|
+
var RUN_PROGRESS_STATUS = {
|
|
19
|
+
PENDING: "pending",
|
|
20
|
+
RUNNING: "running",
|
|
21
|
+
SUCCEEDED: "succeeded",
|
|
22
|
+
FAILED: "failed",
|
|
23
|
+
CANCELED: "canceled"
|
|
24
|
+
};
|
|
25
|
+
var INVOCATION_STATUS = {
|
|
26
|
+
SCHEDULED: "scheduled",
|
|
27
|
+
RUNNING: "running",
|
|
28
|
+
SUCCEEDED: "succeeded",
|
|
29
|
+
FAILED: "failed",
|
|
30
|
+
SKIPPED: "skipped",
|
|
31
|
+
CANCELED: "canceled"
|
|
32
|
+
};
|
|
33
|
+
var DEGRADATION_REASON = {
|
|
34
|
+
WORKFLOW_TASK_FAILING: "workflow_task_failing",
|
|
35
|
+
STATUS_UNAVAILABLE: "status_unavailable"
|
|
36
|
+
};
|
|
37
|
+
function isRunEnded(status) {
|
|
38
|
+
return status === RUN_PROGRESS_STATUS.SUCCEEDED || status === RUN_PROGRESS_STATUS.FAILED || status === RUN_PROGRESS_STATUS.CANCELED;
|
|
39
|
+
}
|
|
40
|
+
var TIMESTAMP_PATTERN = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(?:\.(\d+))?(Z|[+-]\d{2}:\d{2})$/;
|
|
41
|
+
function parseTimestamp(timestamp) {
|
|
42
|
+
if (!timestamp) return null;
|
|
43
|
+
const match = TIMESTAMP_PATTERN.exec(timestamp);
|
|
44
|
+
if (!match) return null;
|
|
45
|
+
const [, base, fraction = "", offset] = match;
|
|
46
|
+
const millis = fraction.slice(0, 3).padEnd(3, "0");
|
|
47
|
+
const wholeMs = Date.parse(`${base}.${millis}${offset}`);
|
|
48
|
+
if (Number.isNaN(wholeMs)) return null;
|
|
49
|
+
return { wholeMs, subMsDigits: fraction.slice(3).replace(/0+$/, "") };
|
|
50
|
+
}
|
|
51
|
+
function timestampMs(timestamp) {
|
|
52
|
+
const parsed = parseTimestamp(timestamp);
|
|
53
|
+
if (!parsed) return null;
|
|
54
|
+
return parsed.subMsDigits ? parsed.wholeMs + Number(`0.${parsed.subMsDigits}`) : parsed.wholeMs;
|
|
55
|
+
}
|
|
56
|
+
function compareTimestamps(a, b) {
|
|
57
|
+
const left = parseTimestamp(a);
|
|
58
|
+
const right = parseTimestamp(b);
|
|
59
|
+
if (!left || !right) return null;
|
|
60
|
+
if (left.wholeMs !== right.wholeMs) return left.wholeMs < right.wholeMs ? -1 : 1;
|
|
61
|
+
const width = Math.max(left.subMsDigits.length, right.subMsDigits.length);
|
|
62
|
+
const leftDigits = left.subMsDigits.padEnd(width, "0");
|
|
63
|
+
const rightDigits = right.subMsDigits.padEnd(width, "0");
|
|
64
|
+
if (leftDigits === rightDigits) return 0;
|
|
65
|
+
return leftDigits < rightDigits ? -1 : 1;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// src/timeline/invocationPath.ts
|
|
69
|
+
var PATH_SEGMENT_KIND = {
|
|
70
|
+
STEP: "step",
|
|
71
|
+
BRANCH: "branch",
|
|
72
|
+
ITEM: "item",
|
|
73
|
+
OUTCOME: "outcome",
|
|
74
|
+
DEFAULT: "default",
|
|
75
|
+
UNKNOWN: "unknown"
|
|
76
|
+
};
|
|
77
|
+
var PATH_SEPARATOR = "/";
|
|
78
|
+
var ORDINAL_SEGMENT = /^(step|branch|item)_([1-9][0-9]*)$/;
|
|
79
|
+
var OUTCOME_PREFIX = "outcome_";
|
|
80
|
+
var DEFAULT_SEGMENT = "default";
|
|
81
|
+
function splitInvocationPath(path) {
|
|
82
|
+
const [root, ...segments] = path.split(PATH_SEPARATOR);
|
|
83
|
+
return { root, segments };
|
|
84
|
+
}
|
|
85
|
+
function invocationPathDepth(path) {
|
|
86
|
+
return path.split(PATH_SEPARATOR).length;
|
|
87
|
+
}
|
|
88
|
+
function parentInvocationPath(path) {
|
|
89
|
+
const cut = path.lastIndexOf(PATH_SEPARATOR);
|
|
90
|
+
return cut < 0 ? null : path.slice(0, cut);
|
|
91
|
+
}
|
|
92
|
+
function lastPathSegment(path) {
|
|
93
|
+
const cut = path.lastIndexOf(PATH_SEPARATOR);
|
|
94
|
+
return cut < 0 ? null : parsePathSegment(path.slice(cut + 1));
|
|
95
|
+
}
|
|
96
|
+
function decodeOutcomeKey(encoded) {
|
|
97
|
+
try {
|
|
98
|
+
return decodeURIComponent(encoded);
|
|
99
|
+
} catch (e) {
|
|
100
|
+
return encoded;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function parsePathSegment(raw) {
|
|
104
|
+
const ordinal = ORDINAL_SEGMENT.exec(raw);
|
|
105
|
+
if (ordinal) {
|
|
106
|
+
const kind = ordinal[1];
|
|
107
|
+
return { kind, ordinal: Number.parseInt(ordinal[2], 10), raw };
|
|
108
|
+
}
|
|
109
|
+
if (raw.startsWith(OUTCOME_PREFIX)) {
|
|
110
|
+
return {
|
|
111
|
+
kind: PATH_SEGMENT_KIND.OUTCOME,
|
|
112
|
+
key: decodeOutcomeKey(raw.slice(OUTCOME_PREFIX.length)),
|
|
113
|
+
raw
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
if (raw === DEFAULT_SEGMENT) return { kind: PATH_SEGMENT_KIND.DEFAULT, raw };
|
|
117
|
+
return { kind: PATH_SEGMENT_KIND.UNKNOWN, raw };
|
|
118
|
+
}
|
|
119
|
+
function isOrdinalSegment(segment) {
|
|
120
|
+
return segment !== null && (segment.kind === PATH_SEGMENT_KIND.STEP || segment.kind === PATH_SEGMENT_KIND.BRANCH || segment.kind === PATH_SEGMENT_KIND.ITEM);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// src/timeline/snapshotFreshness.ts
|
|
124
|
+
function progressStreamKey(snapshot) {
|
|
125
|
+
var _a;
|
|
126
|
+
return JSON.stringify([snapshot.pipeline_run_id, snapshot.mode, (_a = snapshot.root_path) != null ? _a : null]);
|
|
127
|
+
}
|
|
128
|
+
function isSameProgressStream(a, b) {
|
|
129
|
+
return progressStreamKey(a) === progressStreamKey(b);
|
|
130
|
+
}
|
|
131
|
+
function fresherSnapshot(held, incoming) {
|
|
132
|
+
if (!held || held === incoming) return incoming;
|
|
133
|
+
if (!isSameProgressStream(held, incoming)) return incoming;
|
|
134
|
+
const heldEnded = isRunEnded(held.status);
|
|
135
|
+
const incomingEnded = isRunEnded(incoming.status);
|
|
136
|
+
if (heldEnded !== incomingEnded) return heldEnded ? held : incoming;
|
|
137
|
+
if (incoming.version !== held.version) {
|
|
138
|
+
return incoming.version > held.version ? incoming : held;
|
|
139
|
+
}
|
|
140
|
+
const order = compareTimestamps(incoming.assembled_at, held.assembled_at);
|
|
141
|
+
if (order === null) return timestampMs(incoming.assembled_at) === null ? held : incoming;
|
|
142
|
+
return order > 0 ? incoming : held;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// src/timeline/invocationTree.ts
|
|
146
|
+
function compareSiblings(a, b) {
|
|
147
|
+
const aOrdinal = isOrdinalSegment(a.segment) ? a.segment.ordinal : null;
|
|
148
|
+
const bOrdinal = isOrdinalSegment(b.segment) ? b.segment.ordinal : null;
|
|
149
|
+
if (aOrdinal !== null && bOrdinal !== null && aOrdinal !== bOrdinal) return aOrdinal - bOrdinal;
|
|
150
|
+
if (aOrdinal !== null && bOrdinal === null) return -1;
|
|
151
|
+
if (aOrdinal === null && bOrdinal !== null) return 1;
|
|
152
|
+
return a.order - b.order;
|
|
153
|
+
}
|
|
154
|
+
function buildInvocationTree(snapshot) {
|
|
155
|
+
const byPath = /* @__PURE__ */ new Map();
|
|
156
|
+
snapshot.invocations.forEach((invocation, order) => {
|
|
157
|
+
if (byPath.has(invocation.path)) return;
|
|
158
|
+
byPath.set(invocation.path, {
|
|
159
|
+
invocation,
|
|
160
|
+
order,
|
|
161
|
+
segment: lastPathSegment(invocation.path),
|
|
162
|
+
parentPath: null,
|
|
163
|
+
children: []
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
const roots = [];
|
|
167
|
+
for (const node of byPath.values()) {
|
|
168
|
+
let ancestor = parentInvocationPath(node.invocation.path);
|
|
169
|
+
while (ancestor !== null && !byPath.has(ancestor)) ancestor = parentInvocationPath(ancestor);
|
|
170
|
+
const parent = ancestor === null ? void 0 : byPath.get(ancestor);
|
|
171
|
+
if (parent) {
|
|
172
|
+
node.parentPath = parent.invocation.path;
|
|
173
|
+
parent.children.push(node);
|
|
174
|
+
} else {
|
|
175
|
+
roots.push(node);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
for (const node of byPath.values()) node.children.sort(compareSiblings);
|
|
179
|
+
roots.sort((a, b) => a.order - b.order);
|
|
180
|
+
return roots;
|
|
181
|
+
}
|
|
182
|
+
function isItemNode(node) {
|
|
183
|
+
var _a;
|
|
184
|
+
return ((_a = node.segment) == null ? void 0 : _a.kind) === PATH_SEGMENT_KIND.ITEM;
|
|
185
|
+
}
|
|
186
|
+
function isOutcomeNode(node) {
|
|
187
|
+
var _a, _b;
|
|
188
|
+
return ((_a = node.segment) == null ? void 0 : _a.kind) === PATH_SEGMENT_KIND.OUTCOME || ((_b = node.segment) == null ? void 0 : _b.kind) === PATH_SEGMENT_KIND.DEFAULT;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// src/timeline/timelineRows.ts
|
|
192
|
+
var DEFAULT_WIDE_BATCH_THRESHOLD = 10;
|
|
193
|
+
var KEPT_VISIBLE_REASON = {
|
|
194
|
+
FAILED: "failed",
|
|
195
|
+
DEGRADED: "degraded"
|
|
196
|
+
};
|
|
197
|
+
function markTrouble(node, trouble) {
|
|
198
|
+
let failed = node.invocation.status === INVOCATION_STATUS.FAILED;
|
|
199
|
+
let degraded = node.invocation.degradation !== void 0;
|
|
200
|
+
for (const child of node.children) {
|
|
201
|
+
const reason2 = markTrouble(child, trouble);
|
|
202
|
+
if (reason2 === KEPT_VISIBLE_REASON.FAILED) failed = true;
|
|
203
|
+
if (reason2 === KEPT_VISIBLE_REASON.DEGRADED) degraded = true;
|
|
204
|
+
}
|
|
205
|
+
let reason = null;
|
|
206
|
+
if (failed) reason = KEPT_VISIBLE_REASON.FAILED;
|
|
207
|
+
else if (degraded) reason = KEPT_VISIBLE_REASON.DEGRADED;
|
|
208
|
+
trouble.set(node, reason);
|
|
209
|
+
return reason;
|
|
210
|
+
}
|
|
211
|
+
function placeLabelOf(segment, parent, outcome) {
|
|
212
|
+
var _a;
|
|
213
|
+
if (!segment) return null;
|
|
214
|
+
const of = (count) => count === void 0 ? "" : ` of ${count}`;
|
|
215
|
+
switch (segment.kind) {
|
|
216
|
+
case PATH_SEGMENT_KIND.STEP:
|
|
217
|
+
return `step ${segment.ordinal}${of(parent == null ? void 0 : parent.step_count)}`;
|
|
218
|
+
case PATH_SEGMENT_KIND.BRANCH:
|
|
219
|
+
return `branch ${segment.ordinal}${of(parent == null ? void 0 : parent.branch_count)}`;
|
|
220
|
+
case PATH_SEGMENT_KIND.ITEM:
|
|
221
|
+
return `item ${segment.ordinal}${of((_a = parent == null ? void 0 : parent.batch) == null ? void 0 : _a.total)}`;
|
|
222
|
+
case PATH_SEGMENT_KIND.OUTCOME:
|
|
223
|
+
case PATH_SEGMENT_KIND.DEFAULT:
|
|
224
|
+
return outcome && outcome.key !== null ? `outcome ${outcome.key}` : "default outcome";
|
|
225
|
+
default:
|
|
226
|
+
return segment.raw;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
function outcomeOf(node, parent) {
|
|
230
|
+
const segment = node.segment;
|
|
231
|
+
if ((segment == null ? void 0 : segment.kind) !== PATH_SEGMENT_KIND.OUTCOME && (segment == null ? void 0 : segment.kind) !== PATH_SEGMENT_KIND.DEFAULT) {
|
|
232
|
+
return null;
|
|
233
|
+
}
|
|
234
|
+
const resolution = parent == null ? void 0 : parent.invocation.condition;
|
|
235
|
+
const outcomeSiblings = parent ? parent.children.filter(isOutcomeNode).length : 0;
|
|
236
|
+
if (resolution && outcomeSiblings === 1) {
|
|
237
|
+
return { key: resolution.selected_outcome, fromResolution: true };
|
|
238
|
+
}
|
|
239
|
+
return {
|
|
240
|
+
key: segment.kind === PATH_SEGMENT_KIND.OUTCOME ? segment.key : null,
|
|
241
|
+
fromResolution: false
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
function stripOf(items) {
|
|
245
|
+
const strip = [];
|
|
246
|
+
items.forEach((item, index) => {
|
|
247
|
+
const status = item.invocation.status;
|
|
248
|
+
const firstItem = isOrdinalSegment(item.segment) ? item.segment.ordinal : index + 1;
|
|
249
|
+
const last = strip[strip.length - 1];
|
|
250
|
+
if (last && last.status === status && last.firstItem + last.count === firstItem) {
|
|
251
|
+
last.count += 1;
|
|
252
|
+
} else {
|
|
253
|
+
strip.push({ status, firstItem, count: 1 });
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
return strip;
|
|
257
|
+
}
|
|
258
|
+
function buildTimelineRows(snapshot, options = {}) {
|
|
259
|
+
var _a, _b;
|
|
260
|
+
const threshold = (_a = options.wideBatchThreshold) != null ? _a : DEFAULT_WIDE_BATCH_THRESHOLD;
|
|
261
|
+
const expandedBatches = (_b = options.expandedBatches) != null ? _b : {};
|
|
262
|
+
const rows = [];
|
|
263
|
+
const roots = buildInvocationTree(snapshot);
|
|
264
|
+
const trouble = /* @__PURE__ */ new Map();
|
|
265
|
+
for (const root of roots) markTrouble(root, trouble);
|
|
266
|
+
const troubleOf2 = (node) => {
|
|
267
|
+
var _a2;
|
|
268
|
+
return (_a2 = trouble.get(node)) != null ? _a2 : null;
|
|
269
|
+
};
|
|
270
|
+
const visit = (node, parent, depth, keptVisible) => {
|
|
271
|
+
var _a2, _b2, _c, _d, _e;
|
|
272
|
+
const invocation = node.invocation;
|
|
273
|
+
const items = node.children.filter(isItemNode);
|
|
274
|
+
const isBatch = invocation.batch !== void 0 || items.length > 0;
|
|
275
|
+
let batch = null;
|
|
276
|
+
let expanded = true;
|
|
277
|
+
if (isBatch) {
|
|
278
|
+
const total = (_b2 = (_a2 = invocation.batch) == null ? void 0 : _a2.total) != null ? _b2 : items.length;
|
|
279
|
+
const wide = total > threshold;
|
|
280
|
+
expanded = (_c = expandedBatches[invocation.path]) != null ? _c : !wide;
|
|
281
|
+
const keptCount = expanded ? 0 : items.filter((item) => troubleOf2(item) !== null).length;
|
|
282
|
+
batch = {
|
|
283
|
+
counts: (_d = invocation.batch) != null ? _d : null,
|
|
284
|
+
total,
|
|
285
|
+
strip: stripOf(items),
|
|
286
|
+
wide,
|
|
287
|
+
expanded,
|
|
288
|
+
hiddenItemCount: expanded ? 0 : items.length - keptCount
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
const owner = parent && parentInvocationPath(invocation.path) === parent.invocation.path ? parent : null;
|
|
292
|
+
const outcome = outcomeOf(node, owner);
|
|
293
|
+
rows.push({
|
|
294
|
+
path: invocation.path,
|
|
295
|
+
parentPath: node.parentPath,
|
|
296
|
+
depth,
|
|
297
|
+
segment: node.segment,
|
|
298
|
+
placeLabel: placeLabelOf(node.segment, (_e = owner == null ? void 0 : owner.invocation) != null ? _e : null, outcome),
|
|
299
|
+
outcome,
|
|
300
|
+
invocation,
|
|
301
|
+
childCount: node.children.length,
|
|
302
|
+
batch,
|
|
303
|
+
keptVisible
|
|
304
|
+
});
|
|
305
|
+
for (const child of node.children) {
|
|
306
|
+
if (expanded || !isItemNode(child)) {
|
|
307
|
+
visit(child, node, depth + 1, null);
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
const reason = troubleOf2(child);
|
|
311
|
+
if (reason) visit(child, node, depth + 1, reason);
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
for (const root of roots) visit(root, null, 0, null);
|
|
315
|
+
return rows;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// src/timeline/timelineTime.ts
|
|
319
|
+
function readingClockMs(snapshot, now) {
|
|
320
|
+
var _a;
|
|
321
|
+
if (typeof now === "number") return Number.isFinite(now) ? now : null;
|
|
322
|
+
if (typeof now === "string") return (_a = timestampMs(now)) != null ? _a : timestampMs(snapshot.assembled_at);
|
|
323
|
+
return timestampMs(snapshot.assembled_at);
|
|
324
|
+
}
|
|
325
|
+
function invocationTimes(invocation) {
|
|
326
|
+
var _a;
|
|
327
|
+
return {
|
|
328
|
+
startedMs: timestampMs(invocation.started_at),
|
|
329
|
+
endedMs: timestampMs(invocation.ended_at),
|
|
330
|
+
failedMs: timestampMs((_a = invocation.last_failure) == null ? void 0 : _a.at)
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
function snapshotTimes(snapshot) {
|
|
334
|
+
const invocations = /* @__PURE__ */ new Map();
|
|
335
|
+
let startMs = Number.POSITIVE_INFINITY;
|
|
336
|
+
let endMs = Number.NEGATIVE_INFINITY;
|
|
337
|
+
for (const invocation of snapshot.invocations) {
|
|
338
|
+
const times = invocationTimes(invocation);
|
|
339
|
+
if (!invocations.has(invocation.path)) invocations.set(invocation.path, times);
|
|
340
|
+
if (times.startedMs !== null) {
|
|
341
|
+
startMs = Math.min(startMs, times.startedMs);
|
|
342
|
+
endMs = Math.max(endMs, times.startedMs);
|
|
343
|
+
}
|
|
344
|
+
if (times.endedMs !== null) endMs = Math.max(endMs, times.endedMs);
|
|
345
|
+
if (times.failedMs !== null) endMs = Math.max(endMs, times.failedMs);
|
|
346
|
+
}
|
|
347
|
+
const recorded = startMs === Number.POSITIVE_INFINITY ? null : { startMs, endMs: endMs > startMs ? endMs : startMs + 1 };
|
|
348
|
+
return {
|
|
349
|
+
invocations,
|
|
350
|
+
recorded,
|
|
351
|
+
assembledMs: timestampMs(snapshot.assembled_at),
|
|
352
|
+
ended: isRunEnded(snapshot.status)
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
function timelineWindowAt(times, nowMs) {
|
|
356
|
+
const recorded = times.recorded;
|
|
357
|
+
if (!recorded || times.ended) return recorded;
|
|
358
|
+
const clock = typeof nowMs === "number" && Number.isFinite(nowMs) ? nowMs : times.assembledMs;
|
|
359
|
+
if (clock === null || clock <= recorded.endMs) return recorded;
|
|
360
|
+
return { startMs: recorded.startMs, endMs: clock };
|
|
361
|
+
}
|
|
362
|
+
function timelineWindow(snapshot, nowMs) {
|
|
363
|
+
return timelineWindowAt(snapshotTimes(snapshot), nowMs);
|
|
364
|
+
}
|
|
365
|
+
function barFollowsClock(invocation, times = invocationTimes(invocation)) {
|
|
366
|
+
if (times.startedMs === null || times.endedMs !== null) return false;
|
|
367
|
+
return invocation.status === INVOCATION_STATUS.RUNNING || invocation.status === INVOCATION_STATUS.CANCELED;
|
|
368
|
+
}
|
|
369
|
+
function invocationBar(invocation, window, nowMs, times = invocationTimes(invocation)) {
|
|
370
|
+
var _a;
|
|
371
|
+
const startMs = times.startedMs;
|
|
372
|
+
if (startMs === null) return null;
|
|
373
|
+
const endedMs = times.endedMs;
|
|
374
|
+
const clock = typeof nowMs === "number" && Number.isFinite(nowMs) ? nowMs : null;
|
|
375
|
+
let endMs;
|
|
376
|
+
let growing = false;
|
|
377
|
+
let openEnded = false;
|
|
378
|
+
switch (invocation.status) {
|
|
379
|
+
case INVOCATION_STATUS.RUNNING:
|
|
380
|
+
endMs = (_a = endedMs != null ? endedMs : clock) != null ? _a : window.endMs;
|
|
381
|
+
growing = endedMs === null;
|
|
382
|
+
break;
|
|
383
|
+
case INVOCATION_STATUS.CANCELED:
|
|
384
|
+
endMs = endedMs != null ? endedMs : window.endMs;
|
|
385
|
+
openEnded = endedMs === null;
|
|
386
|
+
break;
|
|
387
|
+
default:
|
|
388
|
+
endMs = endedMs != null ? endedMs : startMs;
|
|
389
|
+
}
|
|
390
|
+
return { startMs, endMs: Math.max(startMs, endMs), growing, openEnded };
|
|
391
|
+
}
|
|
392
|
+
function axisPercent(ms, window) {
|
|
393
|
+
const span = window.endMs - window.startMs;
|
|
394
|
+
if (span <= 0) return 0;
|
|
395
|
+
return Math.min(100, Math.max(0, (ms - window.startMs) / span * 100));
|
|
396
|
+
}
|
|
397
|
+
var DAY_MS = 864e5;
|
|
398
|
+
var TICK_STEPS_MS = [
|
|
399
|
+
100,
|
|
400
|
+
200,
|
|
401
|
+
500,
|
|
402
|
+
1e3,
|
|
403
|
+
2e3,
|
|
404
|
+
5e3,
|
|
405
|
+
1e4,
|
|
406
|
+
15e3,
|
|
407
|
+
3e4,
|
|
408
|
+
6e4,
|
|
409
|
+
12e4,
|
|
410
|
+
3e5,
|
|
411
|
+
6e5,
|
|
412
|
+
9e5,
|
|
413
|
+
18e5,
|
|
414
|
+
36e5,
|
|
415
|
+
72e5,
|
|
416
|
+
144e5,
|
|
417
|
+
216e5,
|
|
418
|
+
432e5,
|
|
419
|
+
DAY_MS
|
|
420
|
+
];
|
|
421
|
+
function timelineTicks(window, maxTicks = 6) {
|
|
422
|
+
var _a;
|
|
423
|
+
const span = window.endMs - window.startMs;
|
|
424
|
+
if (!Number.isFinite(span) || span <= 0) return [];
|
|
425
|
+
const budget = Math.max(1, maxTicks);
|
|
426
|
+
const step = (_a = TICK_STEPS_MS.find((candidate) => span / candidate <= budget)) != null ? _a : Math.ceil(span / budget / DAY_MS) * DAY_MS;
|
|
427
|
+
const ticks = [];
|
|
428
|
+
for (let offsetMs = 0; offsetMs <= span; offsetMs += step) {
|
|
429
|
+
ticks.push({
|
|
430
|
+
offsetMs,
|
|
431
|
+
percent: axisPercent(window.startMs + offsetMs, window),
|
|
432
|
+
label: formatDuration(offsetMs)
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
return ticks;
|
|
436
|
+
}
|
|
437
|
+
function formatDuration(ms) {
|
|
438
|
+
const safe = Math.max(0, ms);
|
|
439
|
+
if (safe === 0) return "0s";
|
|
440
|
+
if (Math.round(safe) < 1e3) return `${Math.round(safe)}ms`;
|
|
441
|
+
const tenths = Math.round(safe / 100) / 10;
|
|
442
|
+
if (tenths < 10) return `${tenths}s`;
|
|
443
|
+
const totalSeconds = Math.round(safe / 1e3);
|
|
444
|
+
if (totalSeconds < 60) return `${totalSeconds}s`;
|
|
445
|
+
if (totalSeconds < 3600) {
|
|
446
|
+
const minutes2 = Math.floor(totalSeconds / 60);
|
|
447
|
+
const seconds = totalSeconds % 60;
|
|
448
|
+
return seconds === 0 ? `${minutes2}m` : `${minutes2}m ${String(seconds).padStart(2, "0")}s`;
|
|
449
|
+
}
|
|
450
|
+
const totalMinutes = Math.round(totalSeconds / 60);
|
|
451
|
+
const hours = Math.floor(totalMinutes / 60);
|
|
452
|
+
const minutes = totalMinutes % 60;
|
|
453
|
+
return minutes === 0 ? `${hours}h` : `${hours}h ${String(minutes).padStart(2, "0")}m`;
|
|
454
|
+
}
|
|
455
|
+
function formatClockTime(ms) {
|
|
456
|
+
return `${new Date(ms).toISOString().slice(11, 23)} UTC`;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
// src/timeline/styles/timelineStyles.ts
|
|
460
|
+
var TIMELINE_STYLE = {
|
|
461
|
+
/** Every invocation, labelled by its pipe code, with a bar on a shared time axis. */
|
|
462
|
+
DETAILED: "detailed",
|
|
463
|
+
/** The steps in the method's own words, as a checklist, with each batch as one line of counts. */
|
|
464
|
+
SIMPLE: "simple"
|
|
465
|
+
};
|
|
466
|
+
var TIMELINE_STYLES = {
|
|
467
|
+
[TIMELINE_STYLE.DETAILED]: {
|
|
468
|
+
id: TIMELINE_STYLE.DETAILED,
|
|
469
|
+
name: "Detailed",
|
|
470
|
+
description: "Every pipe, with a bar on a time axis"
|
|
471
|
+
},
|
|
472
|
+
[TIMELINE_STYLE.SIMPLE]: {
|
|
473
|
+
id: TIMELINE_STYLE.SIMPLE,
|
|
474
|
+
name: "Simple",
|
|
475
|
+
description: "The steps in plain words, with batches as counts"
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
var TIMELINE_STYLE_IDS = Object.values(TIMELINE_STYLE);
|
|
479
|
+
var DEFAULT_TIMELINE_STYLE = TIMELINE_STYLE.DETAILED;
|
|
480
|
+
function isTimelineStyleId(value) {
|
|
481
|
+
return typeof value === "string" && Object.hasOwn(TIMELINE_STYLES, value);
|
|
482
|
+
}
|
|
483
|
+
function resolveTimelineStyle(style) {
|
|
484
|
+
return isTimelineStyleId(style) ? style : DEFAULT_TIMELINE_STYLE;
|
|
485
|
+
}
|
|
486
|
+
function resolveTimelineStyleMenu(styleMenu) {
|
|
487
|
+
if (styleMenu === void 0 || styleMenu === false) return [];
|
|
488
|
+
const requested = styleMenu === true ? TIMELINE_STYLE_IDS : styleMenu;
|
|
489
|
+
const offered = [];
|
|
490
|
+
for (const id of requested) {
|
|
491
|
+
if (isTimelineStyleId(id) && !offered.includes(id)) offered.push(id);
|
|
492
|
+
}
|
|
493
|
+
return offered.length >= 2 ? offered : [];
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// src/timeline/styles/registryJoin.ts
|
|
497
|
+
function qualifyPipeCode(pipeCode, domainCode) {
|
|
498
|
+
return pipeCode.includes(".") || domainCode === "" ? pipeCode : `${domainCode}.${pipeCode}`;
|
|
499
|
+
}
|
|
500
|
+
function pipeOf(registry, pipeRef) {
|
|
501
|
+
var _a;
|
|
502
|
+
if (!registry || !Object.hasOwn(registry, pipeRef)) return null;
|
|
503
|
+
return (_a = registry[pipeRef]) != null ? _a : null;
|
|
504
|
+
}
|
|
505
|
+
function sequenceOf(registry, pipeRef) {
|
|
506
|
+
const pipe = pipeOf(registry, pipeRef);
|
|
507
|
+
return (pipe == null ? void 0 : pipe.type) === "PipeSequence" && Array.isArray(pipe.sequential_sub_pipes) ? pipe : null;
|
|
508
|
+
}
|
|
509
|
+
function batchOf(registry, pipeRef) {
|
|
510
|
+
const pipe = pipeOf(registry, pipeRef);
|
|
511
|
+
return (pipe == null ? void 0 : pipe.type) === "PipeBatch" ? pipe : null;
|
|
512
|
+
}
|
|
513
|
+
function takesNumber(spec) {
|
|
514
|
+
return !(isBindingStepSpec(spec) && spec.is_dotted_batch_over === true);
|
|
515
|
+
}
|
|
516
|
+
function numberedSpecs(sequence) {
|
|
517
|
+
const numbered = [];
|
|
518
|
+
let number = 0;
|
|
519
|
+
for (const spec of sequence.sequential_sub_pipes) {
|
|
520
|
+
if (!takesNumber(spec)) continue;
|
|
521
|
+
number += 1;
|
|
522
|
+
numbered.push({ number, spec });
|
|
523
|
+
}
|
|
524
|
+
return numbered;
|
|
525
|
+
}
|
|
526
|
+
function asNumberedStep(sequence, entry) {
|
|
527
|
+
if (isBindingStepSpec(entry.spec)) return null;
|
|
528
|
+
return {
|
|
529
|
+
number: entry.number,
|
|
530
|
+
spec: entry.spec,
|
|
531
|
+
pipeRef: qualifyPipeCode(entry.spec.pipe_code, sequence.domain_code)
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
function stepAt(sequence, number) {
|
|
535
|
+
return stepIn(sequence, numberedSpecs(sequence), number);
|
|
536
|
+
}
|
|
537
|
+
function stepIn(sequence, numbered, number) {
|
|
538
|
+
const entry = Number.isInteger(number) && number >= 1 ? numbered[number - 1] : void 0;
|
|
539
|
+
return entry ? asNumberedStep(sequence, entry) : null;
|
|
540
|
+
}
|
|
541
|
+
function stepsAfter(sequence, reached) {
|
|
542
|
+
return numberedSpecs(sequence).filter((each) => each.number > reached).map((each) => asNumberedStep(sequence, each)).filter((each) => each !== null);
|
|
543
|
+
}
|
|
544
|
+
function stepNumberOf(node) {
|
|
545
|
+
var _a;
|
|
546
|
+
return ((_a = node.segment) == null ? void 0 : _a.kind) === PATH_SEGMENT_KIND.STEP && isOrdinalSegment(node.segment) ? node.segment.ordinal : null;
|
|
547
|
+
}
|
|
548
|
+
function sequenceMatches(sequence, node) {
|
|
549
|
+
const numbered = numberedSpecs(sequence);
|
|
550
|
+
for (const child of node.children) {
|
|
551
|
+
const number = stepNumberOf(child);
|
|
552
|
+
if (number === null) continue;
|
|
553
|
+
const step = stepIn(sequence, numbered, number);
|
|
554
|
+
if (!step) return false;
|
|
555
|
+
const invocation = child.invocation;
|
|
556
|
+
if (step.spec.batch_params) {
|
|
557
|
+
if (invocation.pipe_type !== "PipeBatch" && invocation.pipe_ref !== step.pipeRef)
|
|
558
|
+
return false;
|
|
559
|
+
} else if (invocation.pipe_ref !== step.pipeRef) {
|
|
560
|
+
return false;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
return true;
|
|
564
|
+
}
|
|
565
|
+
function joinedSequence(registry, node) {
|
|
566
|
+
const sequence = sequenceOf(registry, node.invocation.pipe_ref);
|
|
567
|
+
return sequence && sequenceMatches(sequence, node) ? sequence : null;
|
|
568
|
+
}
|
|
569
|
+
function titleOf(registry, pipeRef, pipeCode = pipeRef) {
|
|
570
|
+
var _a;
|
|
571
|
+
return pipeTitle((_a = pipeOf(registry, pipeRef)) == null ? void 0 : _a.description, pipeCode);
|
|
572
|
+
}
|
|
573
|
+
function joinBatch(registry, node, parentSequence) {
|
|
574
|
+
var _a, _b;
|
|
575
|
+
const invocation = node.invocation;
|
|
576
|
+
let branchRef = null;
|
|
577
|
+
let itemName = null;
|
|
578
|
+
const batch = batchOf(registry, invocation.pipe_ref);
|
|
579
|
+
if (batch) {
|
|
580
|
+
branchRef = qualifyPipeCode(batch.branch_pipe_code, batch.domain_code);
|
|
581
|
+
itemName = ((_a = batch.batch_params) == null ? void 0 : _a.input_item_stuff_name) || null;
|
|
582
|
+
}
|
|
583
|
+
const number = stepNumberOf(node);
|
|
584
|
+
const step = parentSequence && number !== null ? stepAt(parentSequence, number) : null;
|
|
585
|
+
if (step == null ? void 0 : step.spec.batch_params) {
|
|
586
|
+
branchRef != null ? branchRef : branchRef = step.pipeRef;
|
|
587
|
+
itemName != null ? itemName : itemName = step.spec.batch_params.input_item_stuff_name || null;
|
|
588
|
+
}
|
|
589
|
+
if (branchRef === null) {
|
|
590
|
+
const item = node.children.find((child) => {
|
|
591
|
+
var _a2;
|
|
592
|
+
return ((_a2 = child.segment) == null ? void 0 : _a2.kind) === PATH_SEGMENT_KIND.ITEM;
|
|
593
|
+
});
|
|
594
|
+
branchRef = (_b = item == null ? void 0 : item.invocation.pipe_ref) != null ? _b : null;
|
|
595
|
+
}
|
|
596
|
+
const title = branchRef ? titleOf(registry, branchRef) : pipeTitle(null, invocation.pipe_code);
|
|
597
|
+
return { branchRef, title, itemName: itemName ? humanizeInSentence(itemName) : null };
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
// src/timeline/styles/simpleProgress.ts
|
|
601
|
+
var SIMPLE_LINE_KIND = {
|
|
602
|
+
/** An operator: one piece of work. */
|
|
603
|
+
STEP: "step",
|
|
604
|
+
/** A sequence, or a pipe of a type the style does not know that holds work of its own. */
|
|
605
|
+
GROUP: "group",
|
|
606
|
+
/** A parallel: work done at the same time. */
|
|
607
|
+
TOGETHER: "together",
|
|
608
|
+
/** A condition, followed by the outcome it took. */
|
|
609
|
+
DECISION: "decision",
|
|
610
|
+
/** A batch: one line for all its items, titled by its branch, with their counts. */
|
|
611
|
+
FOR_EACH: "forEach",
|
|
612
|
+
/** In an expanded batch, one step of its branch, its states counted across the items. */
|
|
613
|
+
BRANCH_STEP: "branchStep",
|
|
614
|
+
/** In a wide parallel, its finished branches folded into one line. */
|
|
615
|
+
FINISHED: "finished",
|
|
616
|
+
/** Past the indentation cap, the deepest work going on beneath a line. */
|
|
617
|
+
NOW: "now"
|
|
618
|
+
};
|
|
619
|
+
var SIMPLE_LINE_STATE = {
|
|
620
|
+
/** Not started: a step the method declares that the run has not reached, or a scheduled item. */
|
|
621
|
+
UPCOMING: "upcoming",
|
|
622
|
+
RUNNING: "running",
|
|
623
|
+
DONE: "done",
|
|
624
|
+
FAILED: "failed",
|
|
625
|
+
/** Skipped: a successful end with no output of its own. */
|
|
626
|
+
SKIPPED: "skipped",
|
|
627
|
+
/** Canceled: it had not ended when the run ended. */
|
|
628
|
+
STOPPED: "stopped",
|
|
629
|
+
/** A step the method declares that its sequence, failed or canceled, never reached. */
|
|
630
|
+
NOT_RUN: "notRun"
|
|
631
|
+
};
|
|
632
|
+
var SIMPLE_RUN_NOTE_REASON = {
|
|
633
|
+
/** The run status could not be read, so the progress may be out of date. */
|
|
634
|
+
UNREACHABLE: "unreachable",
|
|
635
|
+
/** The run is not making progress, at no invocation a line stands for. */
|
|
636
|
+
STUCK: "stuck",
|
|
637
|
+
/** A reason the style does not know: the degradation's own message tells it. */
|
|
638
|
+
OTHER: "other"
|
|
639
|
+
};
|
|
640
|
+
var DEFAULT_WIDE_PARALLEL_THRESHOLD = 5;
|
|
641
|
+
var SIMPLE_MAX_DEPTH = 2;
|
|
642
|
+
var STATE_OF_STATUS = {
|
|
643
|
+
scheduled: SIMPLE_LINE_STATE.UPCOMING,
|
|
644
|
+
running: SIMPLE_LINE_STATE.RUNNING,
|
|
645
|
+
succeeded: SIMPLE_LINE_STATE.DONE,
|
|
646
|
+
failed: SIMPLE_LINE_STATE.FAILED,
|
|
647
|
+
skipped: SIMPLE_LINE_STATE.SKIPPED,
|
|
648
|
+
canceled: SIMPLE_LINE_STATE.STOPPED
|
|
649
|
+
};
|
|
650
|
+
function stateOf(invocation) {
|
|
651
|
+
if (Object.hasOwn(STATE_OF_STATUS, invocation.status)) {
|
|
652
|
+
return STATE_OF_STATUS[invocation.status];
|
|
653
|
+
}
|
|
654
|
+
if (invocation.ended_at) return SIMPLE_LINE_STATE.DONE;
|
|
655
|
+
return invocation.started_at ? SIMPLE_LINE_STATE.RUNNING : SIMPLE_LINE_STATE.UPCOMING;
|
|
656
|
+
}
|
|
657
|
+
function isActiveState(state) {
|
|
658
|
+
return state === SIMPLE_LINE_STATE.RUNNING || state === SIMPLE_LINE_STATE.FAILED;
|
|
659
|
+
}
|
|
660
|
+
function isBatchNode(node) {
|
|
661
|
+
return node.invocation.pipe_type === "PipeBatch" || node.invocation.batch !== void 0 || node.children.some(isItemNode);
|
|
662
|
+
}
|
|
663
|
+
function kindOfNode(node) {
|
|
664
|
+
if (isBatchNode(node)) return SIMPLE_LINE_KIND.FOR_EACH;
|
|
665
|
+
switch (node.invocation.pipe_type) {
|
|
666
|
+
case "PipeSequence":
|
|
667
|
+
return SIMPLE_LINE_KIND.GROUP;
|
|
668
|
+
case "PipeParallel":
|
|
669
|
+
return SIMPLE_LINE_KIND.TOGETHER;
|
|
670
|
+
case "PipeCondition":
|
|
671
|
+
return SIMPLE_LINE_KIND.DECISION;
|
|
672
|
+
default:
|
|
673
|
+
return node.children.length > 0 ? SIMPLE_LINE_KIND.GROUP : SIMPLE_LINE_KIND.STEP;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
function kindOfPipe(pipe, batching) {
|
|
677
|
+
if (batching || (pipe == null ? void 0 : pipe.type) === "PipeBatch") return SIMPLE_LINE_KIND.FOR_EACH;
|
|
678
|
+
switch (pipe == null ? void 0 : pipe.type) {
|
|
679
|
+
case "PipeSequence":
|
|
680
|
+
return SIMPLE_LINE_KIND.GROUP;
|
|
681
|
+
case "PipeParallel":
|
|
682
|
+
return SIMPLE_LINE_KIND.TOGETHER;
|
|
683
|
+
case "PipeCondition":
|
|
684
|
+
return SIMPLE_LINE_KIND.DECISION;
|
|
685
|
+
default:
|
|
686
|
+
return SIMPLE_LINE_KIND.STEP;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
function isRetrying(invocation) {
|
|
690
|
+
return invocation.status === INVOCATION_STATUS.RUNNING && invocation.attempts !== void 0 && invocation.attempts > 1;
|
|
691
|
+
}
|
|
692
|
+
function emptyHidden() {
|
|
693
|
+
return { retryAttempt: null, degradation: null, failure: null };
|
|
694
|
+
}
|
|
695
|
+
function gather(into, invocation) {
|
|
696
|
+
var _a, _b, _c;
|
|
697
|
+
if (isRetrying(invocation)) {
|
|
698
|
+
into.retryAttempt = Math.max((_a = into.retryAttempt) != null ? _a : 0, (_b = invocation.attempts) != null ? _b : 0);
|
|
699
|
+
}
|
|
700
|
+
if (invocation.degradation && !into.degradation) into.degradation = invocation.degradation;
|
|
701
|
+
const problem = (_c = invocation.last_failure) == null ? void 0 : _c.problem;
|
|
702
|
+
if (invocation.status === INVOCATION_STATUS.FAILED && problem) {
|
|
703
|
+
const depth = invocationPathDepth(invocation.path);
|
|
704
|
+
if (!into.failure || depth > into.failure.depth) into.failure = { depth, problem };
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
function gatherBeneath(node, skip = null, into = emptyHidden()) {
|
|
708
|
+
for (const child of node.children) {
|
|
709
|
+
if (child === skip) continue;
|
|
710
|
+
gather(into, child.invocation);
|
|
711
|
+
gatherBeneath(child, skip, into);
|
|
712
|
+
}
|
|
713
|
+
return into;
|
|
714
|
+
}
|
|
715
|
+
function hasHealth(health) {
|
|
716
|
+
return health.retryAttempt !== null || health.retryingItems > 0 || health.degradation !== null || health.stuckItems > 0 || health.problem !== null;
|
|
717
|
+
}
|
|
718
|
+
function showsFailure(lines) {
|
|
719
|
+
return lines.some(
|
|
720
|
+
(line) => {
|
|
721
|
+
var _a;
|
|
722
|
+
return line.state === SIMPLE_LINE_STATE.FAILED || Boolean((_a = line.health) == null ? void 0 : _a.problem);
|
|
723
|
+
}
|
|
724
|
+
);
|
|
725
|
+
}
|
|
726
|
+
function healthOf(state, own, hidden, showProblem, items = { retrying: 0, stuck: 0 }) {
|
|
727
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
728
|
+
const running = state === SIMPLE_LINE_STATE.RUNNING;
|
|
729
|
+
let retryAttempt = null;
|
|
730
|
+
if (running) {
|
|
731
|
+
if (own && isRetrying(own)) retryAttempt = (_a = own.attempts) != null ? _a : null;
|
|
732
|
+
else if (hidden == null ? void 0 : hidden.retryAttempt) retryAttempt = hidden.retryAttempt;
|
|
733
|
+
}
|
|
734
|
+
let problem = null;
|
|
735
|
+
if (showProblem && state === SIMPLE_LINE_STATE.FAILED) {
|
|
736
|
+
problem = (_e = (_d = (_b = hidden == null ? void 0 : hidden.failure) == null ? void 0 : _b.problem) != null ? _d : (_c = own == null ? void 0 : own.last_failure) == null ? void 0 : _c.problem) != null ? _e : null;
|
|
737
|
+
} else if (showProblem && running) {
|
|
738
|
+
problem = (_g = (_f = hidden == null ? void 0 : hidden.failure) == null ? void 0 : _f.problem) != null ? _g : null;
|
|
739
|
+
}
|
|
740
|
+
const health = {
|
|
741
|
+
retryAttempt,
|
|
742
|
+
retryingItems: running ? items.retrying : 0,
|
|
743
|
+
degradation: (_i = (_h = own == null ? void 0 : own.degradation) != null ? _h : hidden == null ? void 0 : hidden.degradation) != null ? _i : null,
|
|
744
|
+
stuckItems: items.stuck,
|
|
745
|
+
problem
|
|
746
|
+
};
|
|
747
|
+
return hasHealth(health) ? health : null;
|
|
748
|
+
}
|
|
749
|
+
function blankLine(key, kind, state, title) {
|
|
750
|
+
return {
|
|
751
|
+
key,
|
|
752
|
+
kind,
|
|
753
|
+
state,
|
|
754
|
+
title: title.title,
|
|
755
|
+
titleFromDescription: title.fromDescription,
|
|
756
|
+
forEachItem: null,
|
|
757
|
+
outcome: null,
|
|
758
|
+
counts: null,
|
|
759
|
+
skippedItems: 0,
|
|
760
|
+
tally: null,
|
|
761
|
+
foldedCount: null,
|
|
762
|
+
health: null,
|
|
763
|
+
invocation: null,
|
|
764
|
+
expandable: false,
|
|
765
|
+
expanded: false,
|
|
766
|
+
children: []
|
|
767
|
+
};
|
|
768
|
+
}
|
|
769
|
+
function upcomingLine(ctx, sequencePath, step) {
|
|
770
|
+
var _a;
|
|
771
|
+
const pipe = pipeOf(ctx.registry, step.pipeRef);
|
|
772
|
+
const batching = Boolean(step.spec.batch_params);
|
|
773
|
+
const line = blankLine(
|
|
774
|
+
`${sequencePath}/step_${step.number}`,
|
|
775
|
+
kindOfPipe(pipe, batching),
|
|
776
|
+
SIMPLE_LINE_STATE.UPCOMING,
|
|
777
|
+
titleOf(ctx.registry, step.pipeRef)
|
|
778
|
+
);
|
|
779
|
+
const itemName = (_a = step.spec.batch_params) == null ? void 0 : _a.input_item_stuff_name;
|
|
780
|
+
if (batching && itemName) line.forEachItem = humanizeInSentence(itemName);
|
|
781
|
+
return line;
|
|
782
|
+
}
|
|
783
|
+
function branchOutcome(node, parent) {
|
|
784
|
+
if (!isOutcomeNode(node)) return null;
|
|
785
|
+
if ((parent == null ? void 0 : parent.invocation.condition) && parent.children.filter(isOutcomeNode).length === 1) {
|
|
786
|
+
return null;
|
|
787
|
+
}
|
|
788
|
+
const segment = node.segment;
|
|
789
|
+
return {
|
|
790
|
+
key: (segment == null ? void 0 : segment.kind) === PATH_SEGMENT_KIND.OUTCOME ? segment.key : null,
|
|
791
|
+
resolved: false
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
function deepestBeneath(node, state) {
|
|
795
|
+
let found = null;
|
|
796
|
+
let foundDepth = -1;
|
|
797
|
+
const visit = (current) => {
|
|
798
|
+
for (const child of current.children) {
|
|
799
|
+
if (stateOf(child.invocation) === state) {
|
|
800
|
+
const depth = invocationPathDepth(child.invocation.path);
|
|
801
|
+
if (depth > foundDepth) {
|
|
802
|
+
found = child;
|
|
803
|
+
foundDepth = depth;
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
visit(child);
|
|
807
|
+
}
|
|
808
|
+
};
|
|
809
|
+
visit(node);
|
|
810
|
+
return found;
|
|
811
|
+
}
|
|
812
|
+
function nowLine(ctx, node) {
|
|
813
|
+
var _a;
|
|
814
|
+
const [first, second] = stateOf(node.invocation) === SIMPLE_LINE_STATE.FAILED ? [SIMPLE_LINE_STATE.FAILED, SIMPLE_LINE_STATE.RUNNING] : [SIMPLE_LINE_STATE.RUNNING, SIMPLE_LINE_STATE.FAILED];
|
|
815
|
+
const target = (_a = deepestBeneath(node, first)) != null ? _a : deepestBeneath(node, second);
|
|
816
|
+
if (!target) return null;
|
|
817
|
+
const invocation = target.invocation;
|
|
818
|
+
const state = stateOf(invocation);
|
|
819
|
+
const line = blankLine(
|
|
820
|
+
`${node.invocation.path}#now`,
|
|
821
|
+
SIMPLE_LINE_KIND.NOW,
|
|
822
|
+
state,
|
|
823
|
+
titleOf(ctx.registry, invocation.pipe_ref, invocation.pipe_code)
|
|
824
|
+
);
|
|
825
|
+
line.invocation = invocation;
|
|
826
|
+
line.health = healthOf(state, invocation, gatherBeneath(target), true);
|
|
827
|
+
return { line, target };
|
|
828
|
+
}
|
|
829
|
+
function emptyTally() {
|
|
830
|
+
return { done: 0, running: 0, failed: 0, skipped: 0, stopped: 0 };
|
|
831
|
+
}
|
|
832
|
+
function addToTally(tally, state) {
|
|
833
|
+
if (state === SIMPLE_LINE_STATE.DONE) tally.done += 1;
|
|
834
|
+
else if (state === SIMPLE_LINE_STATE.RUNNING) tally.running += 1;
|
|
835
|
+
else if (state === SIMPLE_LINE_STATE.FAILED) tally.failed += 1;
|
|
836
|
+
else if (state === SIMPLE_LINE_STATE.SKIPPED) tally.skipped += 1;
|
|
837
|
+
else if (state === SIMPLE_LINE_STATE.STOPPED) tally.stopped += 1;
|
|
838
|
+
}
|
|
839
|
+
function sumCounts(invocations) {
|
|
840
|
+
const batches = invocations.map((each) => each.batch).filter((each) => each !== void 0);
|
|
841
|
+
if (batches.length === 0) return null;
|
|
842
|
+
return batches.reduce(
|
|
843
|
+
(sum, each) => ({
|
|
844
|
+
total: sum.total + each.total,
|
|
845
|
+
done: sum.done + each.done,
|
|
846
|
+
running: sum.running + each.running,
|
|
847
|
+
failed: sum.failed + each.failed
|
|
848
|
+
}),
|
|
849
|
+
{ total: 0, done: 0, running: 0, failed: 0 }
|
|
850
|
+
);
|
|
851
|
+
}
|
|
852
|
+
function branchStepLines(ctx, batchNode, branchRef, batchState) {
|
|
853
|
+
var _a, _b, _c, _d, _e;
|
|
854
|
+
const items = batchNode.children.filter(isItemNode);
|
|
855
|
+
const unseen = Math.max(0, ((_b = (_a = batchNode.invocation.batch) == null ? void 0 : _a.total) != null ? _b : 0) - items.length);
|
|
856
|
+
const pending = items.filter((item) => {
|
|
857
|
+
const itemState = stateOf(item.invocation);
|
|
858
|
+
return itemState === SIMPLE_LINE_STATE.RUNNING || itemState === SIMPLE_LINE_STATE.UPCOMING;
|
|
859
|
+
});
|
|
860
|
+
const nested = items.some((item) => item.children.some(isItemNode));
|
|
861
|
+
const bySegment = /* @__PURE__ */ new Map();
|
|
862
|
+
if (!nested) {
|
|
863
|
+
for (const item of items) {
|
|
864
|
+
for (const child of item.children) {
|
|
865
|
+
const raw = (_d = (_c = child.segment) == null ? void 0 : _c.raw) != null ? _d : child.invocation.path;
|
|
866
|
+
const group = bySegment.get(raw);
|
|
867
|
+
if (group) group.push(child);
|
|
868
|
+
else bySegment.set(raw, [child]);
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
const groups = nested ? [items] : [...bySegment.values()].sort((a, b) => compareSiblings(a[0], b[0]));
|
|
873
|
+
const lines = groups.map((group) => {
|
|
874
|
+
var _a2, _b2;
|
|
875
|
+
const first = group[0].invocation;
|
|
876
|
+
const tally = emptyTally();
|
|
877
|
+
const hidden = emptyHidden();
|
|
878
|
+
let retrying = 0;
|
|
879
|
+
let stuck = 0;
|
|
880
|
+
let skippedItems = 0;
|
|
881
|
+
for (const node of group) {
|
|
882
|
+
addToTally(tally, stateOf(node.invocation));
|
|
883
|
+
gather(hidden, node.invocation);
|
|
884
|
+
gatherBeneath(node, null, hidden);
|
|
885
|
+
const trouble = troubleWithin(node);
|
|
886
|
+
if (trouble.retrying) retrying += 1;
|
|
887
|
+
if (trouble.stuck) stuck += 1;
|
|
888
|
+
skippedItems += skippedItemsOf(node);
|
|
889
|
+
}
|
|
890
|
+
const holders = new Set(group.map((node) => node.parentPath));
|
|
891
|
+
const outcome = isOutcomeNode(group[0]);
|
|
892
|
+
const mayStillReach = nested ? 0 : pending.filter(
|
|
893
|
+
(item) => !holders.has(item.invocation.path) && !(outcome && item.children.some(isOutcomeNode))
|
|
894
|
+
).length;
|
|
895
|
+
const groupExpected = group.length + mayStillReach + unseen;
|
|
896
|
+
let state;
|
|
897
|
+
if (tally.running > 0) state = SIMPLE_LINE_STATE.RUNNING;
|
|
898
|
+
else if (tally.failed > 0) state = SIMPLE_LINE_STATE.FAILED;
|
|
899
|
+
else if (tally.done + tally.skipped >= groupExpected) state = SIMPLE_LINE_STATE.DONE;
|
|
900
|
+
else if (batchState === SIMPLE_LINE_STATE.RUNNING) state = SIMPLE_LINE_STATE.RUNNING;
|
|
901
|
+
else state = SIMPLE_LINE_STATE.STOPPED;
|
|
902
|
+
const segment = nested ? first.pipe_code : (_b2 = (_a2 = group[0].segment) == null ? void 0 : _a2.raw) != null ? _b2 : first.pipe_code;
|
|
903
|
+
const line = blankLine(
|
|
904
|
+
`${batchNode.invocation.path}/*/${segment}`,
|
|
905
|
+
SIMPLE_LINE_KIND.BRANCH_STEP,
|
|
906
|
+
state,
|
|
907
|
+
titleOf(ctx.registry, first.pipe_ref, first.pipe_code)
|
|
908
|
+
);
|
|
909
|
+
line.tally = tally;
|
|
910
|
+
line.counts = sumCounts(group.map((node) => node.invocation));
|
|
911
|
+
line.skippedItems = line.counts ? skippedItems : 0;
|
|
912
|
+
line.health = healthOf(state, null, __spreadProps(__spreadValues({}, hidden), { retryAttempt: null }), true, {
|
|
913
|
+
retrying,
|
|
914
|
+
stuck
|
|
915
|
+
});
|
|
916
|
+
return line;
|
|
917
|
+
});
|
|
918
|
+
const branch = branchRef ? sequenceOf(ctx.registry, branchRef) : null;
|
|
919
|
+
if (branch && batchState === SIMPLE_LINE_STATE.RUNNING && items.every((item) => sequenceMatches(branch, item))) {
|
|
920
|
+
let reached = 0;
|
|
921
|
+
for (const item of items) {
|
|
922
|
+
for (const child of item.children) reached = Math.max(reached, (_e = stepNumberOf(child)) != null ? _e : 0);
|
|
923
|
+
}
|
|
924
|
+
for (const step of stepsAfter(branch, reached)) {
|
|
925
|
+
const line = upcomingLine(ctx, `${batchNode.invocation.path}/*`, step);
|
|
926
|
+
line.kind = SIMPLE_LINE_KIND.BRANCH_STEP;
|
|
927
|
+
line.tally = emptyTally();
|
|
928
|
+
lines.push(line);
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
return lines;
|
|
932
|
+
}
|
|
933
|
+
function troubleOf(invocation) {
|
|
934
|
+
return { retrying: isRetrying(invocation), stuck: invocation.degradation !== void 0 };
|
|
935
|
+
}
|
|
936
|
+
function troubleWithin(node, into = troubleOf(node.invocation)) {
|
|
937
|
+
for (const child of node.children) {
|
|
938
|
+
if (into.retrying && into.stuck) break;
|
|
939
|
+
const own = troubleOf(child.invocation);
|
|
940
|
+
into.retrying || (into.retrying = own.retrying);
|
|
941
|
+
into.stuck || (into.stuck = own.stuck);
|
|
942
|
+
troubleWithin(child, into);
|
|
943
|
+
}
|
|
944
|
+
return into;
|
|
945
|
+
}
|
|
946
|
+
function skippedItemsOf(node) {
|
|
947
|
+
return node.children.filter(
|
|
948
|
+
(child) => isItemNode(child) && stateOf(child.invocation) === SIMPLE_LINE_STATE.SKIPPED
|
|
949
|
+
).length;
|
|
950
|
+
}
|
|
951
|
+
function forEachLine(ctx, node, depth, parentSequence) {
|
|
952
|
+
var _a, _b;
|
|
953
|
+
const invocation = node.invocation;
|
|
954
|
+
const state = stateOf(invocation);
|
|
955
|
+
const joined = joinBatch(ctx.registry, node, parentSequence);
|
|
956
|
+
const line = blankLine(invocation.path, SIMPLE_LINE_KIND.FOR_EACH, state, joined.title);
|
|
957
|
+
line.invocation = invocation;
|
|
958
|
+
line.forEachItem = joined.itemName;
|
|
959
|
+
line.counts = (_a = invocation.batch) != null ? _a : null;
|
|
960
|
+
line.skippedItems = skippedItemsOf(node);
|
|
961
|
+
const items = node.children.filter(isItemNode);
|
|
962
|
+
const steps = depth < SIMPLE_MAX_DEPTH ? branchStepLines(ctx, node, joined.branchRef, state) : [];
|
|
963
|
+
line.expandable = steps.length > 0;
|
|
964
|
+
line.expanded = line.expandable && ((_b = ctx.expanded[line.key]) != null ? _b : false);
|
|
965
|
+
if (line.expanded) line.children = steps;
|
|
966
|
+
const hidden = emptyHidden();
|
|
967
|
+
if (line.expanded) for (const item of items) gather(hidden, item.invocation);
|
|
968
|
+
else gatherBeneath(node, null, hidden);
|
|
969
|
+
hidden.retryAttempt = null;
|
|
970
|
+
const trouble = items.map(
|
|
971
|
+
(item) => line.expanded ? troubleOf(item.invocation) : troubleWithin(item)
|
|
972
|
+
);
|
|
973
|
+
const stuck = trouble.filter((each) => each.stuck);
|
|
974
|
+
const retrying = trouble.filter((each) => each.retrying);
|
|
975
|
+
line.health = healthOf(state, invocation, hidden, !showsFailure(line.children), {
|
|
976
|
+
retrying: retrying.length,
|
|
977
|
+
stuck: stuck.length
|
|
978
|
+
});
|
|
979
|
+
return line;
|
|
980
|
+
}
|
|
981
|
+
function unreachedSteps(ctx, node, state) {
|
|
982
|
+
const sequence = node.invocation.pipe_type === "PipeSequence" ? joinedSequence(ctx.registry, node) : null;
|
|
983
|
+
const ended = state === SIMPLE_LINE_STATE.FAILED || state === SIMPLE_LINE_STATE.STOPPED;
|
|
984
|
+
if (!sequence || !(state === SIMPLE_LINE_STATE.RUNNING || ended)) {
|
|
985
|
+
return { sequence, steps: [], ended };
|
|
986
|
+
}
|
|
987
|
+
const reached = Math.max(0, ...node.children.map((child) => {
|
|
988
|
+
var _a;
|
|
989
|
+
return (_a = stepNumberOf(child)) != null ? _a : 0;
|
|
990
|
+
}));
|
|
991
|
+
return { sequence, steps: stepsAfter(sequence, reached), ended };
|
|
992
|
+
}
|
|
993
|
+
function childLines(ctx, node, depth, state, unreached = unreachedSteps(ctx, node, state)) {
|
|
994
|
+
var _a;
|
|
995
|
+
let lines = node.children.map((child) => lineOf(ctx, child, node, depth, unreached.sequence));
|
|
996
|
+
for (const step of unreached.steps) {
|
|
997
|
+
const line = upcomingLine(ctx, node.invocation.path, step);
|
|
998
|
+
if (unreached.ended) line.state = SIMPLE_LINE_STATE.NOT_RUN;
|
|
999
|
+
lines.push(line);
|
|
1000
|
+
}
|
|
1001
|
+
if (node.invocation.pipe_type === "PipeParallel" && Math.max(node.children.length, (_a = node.invocation.branch_count) != null ? _a : 0) > ctx.wideParallelThreshold) {
|
|
1002
|
+
lines = foldFinished(node, lines);
|
|
1003
|
+
}
|
|
1004
|
+
return lines;
|
|
1005
|
+
}
|
|
1006
|
+
function foldFinished(node, lines) {
|
|
1007
|
+
const finished = lines.filter((line) => line.state === SIMPLE_LINE_STATE.DONE && !line.expanded);
|
|
1008
|
+
if (finished.length < 2) return lines;
|
|
1009
|
+
const folded = blankLine(
|
|
1010
|
+
`${node.invocation.path}#finished`,
|
|
1011
|
+
SIMPLE_LINE_KIND.FINISHED,
|
|
1012
|
+
SIMPLE_LINE_STATE.DONE,
|
|
1013
|
+
{
|
|
1014
|
+
title: "",
|
|
1015
|
+
fromDescription: false
|
|
1016
|
+
}
|
|
1017
|
+
);
|
|
1018
|
+
folded.foldedCount = finished.length;
|
|
1019
|
+
const kept = [];
|
|
1020
|
+
const folding = new Set(finished);
|
|
1021
|
+
for (const line of lines) {
|
|
1022
|
+
if (!folding.has(line)) kept.push(line);
|
|
1023
|
+
else if (line === finished[0]) kept.push(folded);
|
|
1024
|
+
}
|
|
1025
|
+
return kept;
|
|
1026
|
+
}
|
|
1027
|
+
function lineOf(ctx, node, parent, depth, parentSequence) {
|
|
1028
|
+
var _a, _b, _c, _d;
|
|
1029
|
+
const kind = kindOfNode(node);
|
|
1030
|
+
if (kind === SIMPLE_LINE_KIND.FOR_EACH) {
|
|
1031
|
+
const line2 = forEachLine(ctx, node, depth, parentSequence);
|
|
1032
|
+
line2.outcome = branchOutcome(node, parent);
|
|
1033
|
+
return line2;
|
|
1034
|
+
}
|
|
1035
|
+
const invocation = node.invocation;
|
|
1036
|
+
const state = stateOf(invocation);
|
|
1037
|
+
const line = blankLine(
|
|
1038
|
+
invocation.path,
|
|
1039
|
+
kind,
|
|
1040
|
+
state,
|
|
1041
|
+
titleOf(ctx.registry, invocation.pipe_ref, invocation.pipe_code)
|
|
1042
|
+
);
|
|
1043
|
+
line.invocation = invocation;
|
|
1044
|
+
line.outcome = kind === SIMPLE_LINE_KIND.DECISION && invocation.condition ? { key: invocation.condition.selected_outcome, resolved: true } : branchOutcome(node, parent);
|
|
1045
|
+
if (kind === SIMPLE_LINE_KIND.STEP) {
|
|
1046
|
+
line.health = healthOf(state, invocation, gatherBeneath(node), true);
|
|
1047
|
+
return line;
|
|
1048
|
+
}
|
|
1049
|
+
if (depth >= SIMPLE_MAX_DEPTH) {
|
|
1050
|
+
const now = isActiveState(state) ? nowLine(ctx, node) : null;
|
|
1051
|
+
line.expandable = now !== null;
|
|
1052
|
+
line.expanded = now !== null && ((_a = ctx.expanded[line.key]) != null ? _a : true);
|
|
1053
|
+
const shown = line.expanded ? now : null;
|
|
1054
|
+
if (shown) line.children = [shown.line];
|
|
1055
|
+
const problemShownBeneath = Boolean((_b = shown == null ? void 0 : shown.line.health) == null ? void 0 : _b.problem);
|
|
1056
|
+
line.health = healthOf(
|
|
1057
|
+
state,
|
|
1058
|
+
invocation,
|
|
1059
|
+
gatherBeneath(node, (_c = shown == null ? void 0 : shown.target) != null ? _c : null),
|
|
1060
|
+
!problemShownBeneath
|
|
1061
|
+
);
|
|
1062
|
+
return line;
|
|
1063
|
+
}
|
|
1064
|
+
const unreached = unreachedSteps(ctx, node, state);
|
|
1065
|
+
line.expandable = node.children.length > 0 || unreached.steps.length > 0;
|
|
1066
|
+
line.expanded = line.expandable && ((_d = ctx.expanded[line.key]) != null ? _d : isActiveState(state));
|
|
1067
|
+
if (line.expanded) {
|
|
1068
|
+
const children = childLines(ctx, node, depth + 1, state, unreached);
|
|
1069
|
+
line.children = children;
|
|
1070
|
+
line.health = healthOf(state, invocation, null, !showsFailure(children));
|
|
1071
|
+
} else {
|
|
1072
|
+
line.health = healthOf(state, invocation, gatherBeneath(node), true);
|
|
1073
|
+
}
|
|
1074
|
+
return line;
|
|
1075
|
+
}
|
|
1076
|
+
function previewLines(ctx, entryPipeRef) {
|
|
1077
|
+
const sequence = sequenceOf(ctx.registry, entryPipeRef);
|
|
1078
|
+
if (sequence) {
|
|
1079
|
+
return stepsAfter(sequence, 0).map((step) => upcomingLine(ctx, entryPipeRef, step));
|
|
1080
|
+
}
|
|
1081
|
+
const pipe = pipeOf(ctx.registry, entryPipeRef);
|
|
1082
|
+
if (!pipe) return [];
|
|
1083
|
+
return [
|
|
1084
|
+
blankLine(
|
|
1085
|
+
entryPipeRef,
|
|
1086
|
+
kindOfPipe(pipe, false),
|
|
1087
|
+
SIMPLE_LINE_STATE.UPCOMING,
|
|
1088
|
+
titleOf(ctx.registry, entryPipeRef)
|
|
1089
|
+
)
|
|
1090
|
+
];
|
|
1091
|
+
}
|
|
1092
|
+
function walkLines(lines, visit) {
|
|
1093
|
+
for (const line of lines) {
|
|
1094
|
+
visit(line);
|
|
1095
|
+
walkLines(line.children, visit);
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
function failureOf(status, roots, lines) {
|
|
1099
|
+
var _a, _b, _c, _d, _e;
|
|
1100
|
+
if (status !== RUN_PROGRESS_STATUS.FAILED) return null;
|
|
1101
|
+
const failed = [];
|
|
1102
|
+
const visit = (node) => {
|
|
1103
|
+
if (node.invocation.status === INVOCATION_STATUS.FAILED) failed.push(node.invocation);
|
|
1104
|
+
for (const child of node.children) visit(child);
|
|
1105
|
+
};
|
|
1106
|
+
for (const root of roots) visit(root);
|
|
1107
|
+
let deepest = null;
|
|
1108
|
+
let withProblem = null;
|
|
1109
|
+
for (const invocation of failed) {
|
|
1110
|
+
const depth = invocationPathDepth(invocation.path);
|
|
1111
|
+
if (!deepest || depth > invocationPathDepth(deepest.path)) deepest = invocation;
|
|
1112
|
+
if (((_a = invocation.last_failure) == null ? void 0 : _a.problem) && (!withProblem || depth > invocationPathDepth(withProblem.path))) {
|
|
1113
|
+
withProblem = invocation;
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
const path = (_b = deepest == null ? void 0 : deepest.path) != null ? _b : null;
|
|
1117
|
+
const top = path === null ? void 0 : lines.find(
|
|
1118
|
+
(line) => line.invocation && (path === line.key || path.startsWith(`${line.key}/`))
|
|
1119
|
+
);
|
|
1120
|
+
const problem = (_d = (_c = withProblem == null ? void 0 : withProblem.last_failure) == null ? void 0 : _c.problem) != null ? _d : null;
|
|
1121
|
+
let shownOnLine = false;
|
|
1122
|
+
walkLines(lines, (line) => {
|
|
1123
|
+
var _a2;
|
|
1124
|
+
if (problem && ((_a2 = line.health) == null ? void 0 : _a2.problem) === problem) shownOnLine = true;
|
|
1125
|
+
});
|
|
1126
|
+
return { lineKey: (_e = top == null ? void 0 : top.key) != null ? _e : null, problem, shownOnLine };
|
|
1127
|
+
}
|
|
1128
|
+
function runNoteOf(snapshot, lines) {
|
|
1129
|
+
const degradation = snapshot.degradation;
|
|
1130
|
+
if (!degradation) return null;
|
|
1131
|
+
if (degradation.reason === DEGRADATION_REASON.STATUS_UNAVAILABLE) {
|
|
1132
|
+
return { reason: SIMPLE_RUN_NOTE_REASON.UNREACHABLE, degradation };
|
|
1133
|
+
}
|
|
1134
|
+
if (degradation.reason === DEGRADATION_REASON.WORKFLOW_TASK_FAILING) {
|
|
1135
|
+
let carried = false;
|
|
1136
|
+
walkLines(lines, (line) => {
|
|
1137
|
+
var _a;
|
|
1138
|
+
if ((_a = line.health) == null ? void 0 : _a.degradation) carried = true;
|
|
1139
|
+
});
|
|
1140
|
+
return carried ? null : { reason: SIMPLE_RUN_NOTE_REASON.STUCK, degradation };
|
|
1141
|
+
}
|
|
1142
|
+
return { reason: SIMPLE_RUN_NOTE_REASON.OTHER, degradation };
|
|
1143
|
+
}
|
|
1144
|
+
function buildSimpleProgress(snapshot, options = {}) {
|
|
1145
|
+
var _a, _b, _c;
|
|
1146
|
+
const ctx = {
|
|
1147
|
+
registry: options.pipeRegistry,
|
|
1148
|
+
expanded: (_a = options.expanded) != null ? _a : {},
|
|
1149
|
+
wideParallelThreshold: (_b = options.wideParallelThreshold) != null ? _b : DEFAULT_WIDE_PARALLEL_THRESHOLD
|
|
1150
|
+
};
|
|
1151
|
+
const roots = buildInvocationTree(snapshot);
|
|
1152
|
+
let lines;
|
|
1153
|
+
let retryAttempt = null;
|
|
1154
|
+
if (roots.length === 0) {
|
|
1155
|
+
lines = options.entryPipeRef && !isRunEnded(snapshot.status) ? previewLines(ctx, options.entryPipeRef) : [];
|
|
1156
|
+
} else if (roots.length === 1 && roots[0].invocation.pipe_type === "PipeSequence") {
|
|
1157
|
+
const root = roots[0].invocation;
|
|
1158
|
+
lines = childLines(ctx, roots[0], 0, stateOf(root));
|
|
1159
|
+
if (isRetrying(root)) retryAttempt = (_c = root.attempts) != null ? _c : null;
|
|
1160
|
+
} else {
|
|
1161
|
+
lines = roots.map((root) => lineOf(ctx, root, null, 0, null));
|
|
1162
|
+
}
|
|
1163
|
+
return {
|
|
1164
|
+
status: snapshot.status,
|
|
1165
|
+
mode: snapshot.mode,
|
|
1166
|
+
failure: failureOf(snapshot.status, roots, lines),
|
|
1167
|
+
runNote: runNoteOf(snapshot, lines),
|
|
1168
|
+
retryAttempt,
|
|
1169
|
+
lines
|
|
1170
|
+
};
|
|
1171
|
+
}
|
|
1172
|
+
function simpleProgressChanges(previous, current) {
|
|
1173
|
+
const before = new Map(previous.lines.map((line) => [line.key, line.state]));
|
|
1174
|
+
const change = {
|
|
1175
|
+
done: [],
|
|
1176
|
+
failed: [],
|
|
1177
|
+
started: [],
|
|
1178
|
+
runEnded: !isRunEnded(previous.status) && isRunEnded(current.status)
|
|
1179
|
+
};
|
|
1180
|
+
for (const line of current.lines) {
|
|
1181
|
+
if (before.get(line.key) === line.state) continue;
|
|
1182
|
+
if (line.state === SIMPLE_LINE_STATE.DONE) change.done.push(line.title);
|
|
1183
|
+
else if (line.state === SIMPLE_LINE_STATE.FAILED) change.failed.push(line.title);
|
|
1184
|
+
else if (line.state === SIMPLE_LINE_STATE.RUNNING) change.started.push(line.title);
|
|
1185
|
+
}
|
|
1186
|
+
return change;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
export {
|
|
1190
|
+
PROGRESS_MODE,
|
|
1191
|
+
RUN_PROGRESS_STATUS,
|
|
1192
|
+
INVOCATION_STATUS,
|
|
1193
|
+
DEGRADATION_REASON,
|
|
1194
|
+
isRunEnded,
|
|
1195
|
+
timestampMs,
|
|
1196
|
+
compareTimestamps,
|
|
1197
|
+
PATH_SEGMENT_KIND,
|
|
1198
|
+
splitInvocationPath,
|
|
1199
|
+
invocationPathDepth,
|
|
1200
|
+
parentInvocationPath,
|
|
1201
|
+
lastPathSegment,
|
|
1202
|
+
decodeOutcomeKey,
|
|
1203
|
+
parsePathSegment,
|
|
1204
|
+
isOrdinalSegment,
|
|
1205
|
+
progressStreamKey,
|
|
1206
|
+
isSameProgressStream,
|
|
1207
|
+
fresherSnapshot,
|
|
1208
|
+
compareSiblings,
|
|
1209
|
+
buildInvocationTree,
|
|
1210
|
+
isItemNode,
|
|
1211
|
+
isOutcomeNode,
|
|
1212
|
+
DEFAULT_WIDE_BATCH_THRESHOLD,
|
|
1213
|
+
KEPT_VISIBLE_REASON,
|
|
1214
|
+
buildTimelineRows,
|
|
1215
|
+
readingClockMs,
|
|
1216
|
+
invocationTimes,
|
|
1217
|
+
snapshotTimes,
|
|
1218
|
+
timelineWindowAt,
|
|
1219
|
+
timelineWindow,
|
|
1220
|
+
barFollowsClock,
|
|
1221
|
+
invocationBar,
|
|
1222
|
+
axisPercent,
|
|
1223
|
+
timelineTicks,
|
|
1224
|
+
formatDuration,
|
|
1225
|
+
formatClockTime,
|
|
1226
|
+
TIMELINE_STYLE,
|
|
1227
|
+
TIMELINE_STYLES,
|
|
1228
|
+
TIMELINE_STYLE_IDS,
|
|
1229
|
+
DEFAULT_TIMELINE_STYLE,
|
|
1230
|
+
isTimelineStyleId,
|
|
1231
|
+
resolveTimelineStyle,
|
|
1232
|
+
resolveTimelineStyleMenu,
|
|
1233
|
+
qualifyPipeCode,
|
|
1234
|
+
pipeOf,
|
|
1235
|
+
sequenceOf,
|
|
1236
|
+
stepAt,
|
|
1237
|
+
stepsAfter,
|
|
1238
|
+
stepNumberOf,
|
|
1239
|
+
sequenceMatches,
|
|
1240
|
+
joinedSequence,
|
|
1241
|
+
titleOf,
|
|
1242
|
+
joinBatch,
|
|
1243
|
+
SIMPLE_LINE_KIND,
|
|
1244
|
+
SIMPLE_LINE_STATE,
|
|
1245
|
+
SIMPLE_RUN_NOTE_REASON,
|
|
1246
|
+
DEFAULT_WIDE_PARALLEL_THRESHOLD,
|
|
1247
|
+
SIMPLE_MAX_DEPTH,
|
|
1248
|
+
buildSimpleProgress,
|
|
1249
|
+
simpleProgressChanges
|
|
1250
|
+
};
|
|
1251
|
+
//# sourceMappingURL=chunk-RU3CIXFC.js.map
|