@atolis-hq/wake 0.4.116 → 0.4.118
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/src/bootstrap/board-projection.d.ts +30 -0
- package/dist/src/bootstrap/board-projection.js +235 -7
- package/dist/src/bootstrap/surface-api-applications.js +7 -2
- package/dist/src/bootstrap/version.js +1 -1
- package/dist/src/integrations/delivery/application/delivery-outcome-reactor.js +5 -1
- package/dist/src/surfaces/api/contracts/board.d.ts +21 -0
- package/dist/src/surfaces/web-assets/assets/index-lG0PPaWe.js +1192 -0
- package/dist/src/surfaces/web-assets/index.html +1 -1
- package/package.json +1 -1
- package/dist/src/surfaces/web-assets/assets/index-KZEn2twL.js +0 -1192
|
@@ -20,6 +20,22 @@ interface StoredActiveRun {
|
|
|
20
20
|
readonly startedAt: string;
|
|
21
21
|
readonly phase?: BoardActiveRunPhase;
|
|
22
22
|
}
|
|
23
|
+
interface StoredDelegatedCohort {
|
|
24
|
+
readonly cohortId: string;
|
|
25
|
+
readonly children: Readonly<Record<string, string>>;
|
|
26
|
+
readonly finished: Readonly<Record<string, true>>;
|
|
27
|
+
readonly needsAttention: Readonly<Record<string, true>>;
|
|
28
|
+
readonly waiting?: true;
|
|
29
|
+
/** The parent's assessment handed a question about its children to a human. */
|
|
30
|
+
readonly escalated?: true;
|
|
31
|
+
}
|
|
32
|
+
/** What a waiting parent's card shows about its cohort. */
|
|
33
|
+
export interface BoardDelegationWait {
|
|
34
|
+
readonly total: number;
|
|
35
|
+
readonly finished: number;
|
|
36
|
+
readonly needsAttention: number;
|
|
37
|
+
readonly escalated?: true;
|
|
38
|
+
}
|
|
23
39
|
interface StoredCard {
|
|
24
40
|
readonly workItemKey: string;
|
|
25
41
|
readonly workItemId: string;
|
|
@@ -39,6 +55,7 @@ interface StoredCard {
|
|
|
39
55
|
readonly parentWorkItemKey?: string;
|
|
40
56
|
/** Delegated children created under this card's work item. */
|
|
41
57
|
readonly childCount?: number;
|
|
58
|
+
readonly delegatedCohort?: StoredDelegatedCohort;
|
|
42
59
|
readonly activeRuns: Readonly<Record<string, StoredActiveRun>>;
|
|
43
60
|
readonly activeRun?: StoredActiveRun;
|
|
44
61
|
readonly lastRunAt?: string;
|
|
@@ -57,7 +74,20 @@ export interface BoardProjectionView {
|
|
|
57
74
|
readonly runs: Readonly<Record<string, string>>;
|
|
58
75
|
readonly children: Readonly<Record<string, string>>;
|
|
59
76
|
readonly childRuns: Readonly<Record<string, true>>;
|
|
77
|
+
readonly delegatedChildren: Readonly<Record<string, string>>;
|
|
60
78
|
}
|
|
61
79
|
export declare const boardProjection: ProjectionDefinition<BoardProjectionView>;
|
|
62
80
|
export declare function boardConditionCounts(view: BoardProjectionView): Partial<Record<BoardConditionValue, number>>;
|
|
81
|
+
export declare function boardDelegationWait(card: {
|
|
82
|
+
readonly delegatedCohort?: StoredDelegatedCohort;
|
|
83
|
+
}): BoardDelegationWait | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Freezing a work item holds its whole delegated subtree (see Work's delivery
|
|
86
|
+
* availability), but descendants record no freeze of their own. Returns the
|
|
87
|
+
* key of the nearest frozen ancestor on the board, if any.
|
|
88
|
+
*/
|
|
89
|
+
export declare function boardFrozenAncestorLookup(view: BoardProjectionView): (card: {
|
|
90
|
+
readonly parentWorkItemKey?: string;
|
|
91
|
+
readonly condition: BoardConditionValue;
|
|
92
|
+
}) => string | undefined;
|
|
63
93
|
export {};
|
|
@@ -33,7 +33,14 @@ export function normalizeBoardActiveRunPhase(phase) {
|
|
|
33
33
|
export const boardProjection = {
|
|
34
34
|
name: 'operator-board',
|
|
35
35
|
select: () => ({ key: 'global' }),
|
|
36
|
-
initial: () => ({
|
|
36
|
+
initial: () => ({
|
|
37
|
+
cards: {},
|
|
38
|
+
workflows: {},
|
|
39
|
+
runs: {},
|
|
40
|
+
children: {},
|
|
41
|
+
childRuns: {},
|
|
42
|
+
delegatedChildren: {},
|
|
43
|
+
}),
|
|
37
44
|
project(previous, envelope) {
|
|
38
45
|
const work = selectWorkEvent(envelope);
|
|
39
46
|
if (work !== null)
|
|
@@ -108,7 +115,7 @@ function projectWork(view, event, occurredAt) {
|
|
|
108
115
|
cards: {
|
|
109
116
|
...view.cards,
|
|
110
117
|
[id]: {
|
|
111
|
-
...withoutExtendEligible(withoutAwaitingApproval(current)),
|
|
118
|
+
...withoutDelegatedCohort(withoutExtendEligible(withoutAwaitingApproval(current))),
|
|
112
119
|
condition: BoardCondition.Finished,
|
|
113
120
|
},
|
|
114
121
|
},
|
|
@@ -125,11 +132,215 @@ function projectWork(view, event, occurredAt) {
|
|
|
125
132
|
function projectWorkflow(view, event, occurredAt) {
|
|
126
133
|
if (isWorkflowEventType(event, OrchestrationEventType.InstanceStarted))
|
|
127
134
|
return projectWorkflowStarted(view, event, occurredAt);
|
|
128
|
-
return projectWorkflowUpdate(view, event, occurredAt);
|
|
135
|
+
return projectDelegation(view, event) ?? projectWorkflowUpdate(view, event, occurredAt);
|
|
129
136
|
}
|
|
130
137
|
function isWorkflowEventType(event, eventType) {
|
|
131
138
|
return event.event.eventType === eventType;
|
|
132
139
|
}
|
|
140
|
+
// Delegation facts land on the root stream (reservation, results) or the
|
|
141
|
+
// parent's stream (wait, child blockers, attention, settlement); each is
|
|
142
|
+
// attributed to the parent card from its payload or the reservation index.
|
|
143
|
+
// Returns undefined for every other event so ordinary handling applies.
|
|
144
|
+
function projectDelegation(view, event) {
|
|
145
|
+
if (isWorkflowEventType(event, OrchestrationEventType.DelegationReserved))
|
|
146
|
+
return projectDelegationReserved(view, event);
|
|
147
|
+
if (isWorkflowEventType(event, OrchestrationEventType.DelegationResultSelected))
|
|
148
|
+
return updateCohort(view, view.delegatedChildren?.[event.event.payload.childWorkItemId], event.event.payload.cohortId, (cohort) => ({
|
|
149
|
+
...cohort,
|
|
150
|
+
finished: { ...cohort.finished, [event.event.payload.childWorkItemId]: true },
|
|
151
|
+
needsAttention: withoutKey(cohort.needsAttention, event.event.payload.childWorkItemId),
|
|
152
|
+
}));
|
|
153
|
+
if (isWorkflowEventType(event, OrchestrationEventType.DelegationChildBlocked))
|
|
154
|
+
return updateCohort(view, view.delegatedChildren?.[event.event.payload.childWorkItemId] ??
|
|
155
|
+
primaryWorkId(view, event.stream.id), undefined, (cohort) => cohort.children[event.event.payload.childWorkItemId] === undefined
|
|
156
|
+
? cohort
|
|
157
|
+
: {
|
|
158
|
+
...cohort,
|
|
159
|
+
needsAttention: {
|
|
160
|
+
...cohort.needsAttention,
|
|
161
|
+
[event.event.payload.childWorkItemId]: true,
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
if (isWorkflowEventType(event, OrchestrationEventType.DelegationWaitStarted))
|
|
165
|
+
return projectDelegationWaitStarted(view, event);
|
|
166
|
+
if (isWorkflowEventType(event, OrchestrationEventType.DelegationAttentionRequested))
|
|
167
|
+
return updateCohort(view, primaryWorkId(view, event.stream.id), event.event.payload.cohortId, withoutEscalation);
|
|
168
|
+
if (isWorkflowEventType(event, OrchestrationEventType.DelegationAttentionResolved))
|
|
169
|
+
return projectDelegationAttentionResolved(view, event);
|
|
170
|
+
if (isWorkflowEventType(event, OrchestrationEventType.DelegationJoined) ||
|
|
171
|
+
isWorkflowEventType(event, OrchestrationEventType.DelegationFailed))
|
|
172
|
+
return projectDelegationSettled(view, event);
|
|
173
|
+
return undefined;
|
|
174
|
+
}
|
|
175
|
+
function projectDelegationReserved(view, event) {
|
|
176
|
+
const reservation = event.event.payload;
|
|
177
|
+
const parentId = reservation.parentWorkItemId;
|
|
178
|
+
const card = view.cards[parentId];
|
|
179
|
+
if (card === undefined || view.children?.[reservation.parentWorkflowInstanceId] !== undefined)
|
|
180
|
+
return view;
|
|
181
|
+
const previous = card.delegatedCohort?.cohortId === reservation.cohortId
|
|
182
|
+
? card.delegatedCohort
|
|
183
|
+
: { cohortId: reservation.cohortId, children: {}, finished: {}, needsAttention: {} };
|
|
184
|
+
const cohort = reservation.children.reduce((current, child) => ({
|
|
185
|
+
...withoutReplacedChild(current, child.replaces),
|
|
186
|
+
children: {
|
|
187
|
+
...withoutReplacedChild(current, child.replaces).children,
|
|
188
|
+
[child.workItemId]: child.assignmentId,
|
|
189
|
+
},
|
|
190
|
+
}), previous);
|
|
191
|
+
return {
|
|
192
|
+
...view,
|
|
193
|
+
delegatedChildren: {
|
|
194
|
+
...view.delegatedChildren,
|
|
195
|
+
...Object.fromEntries(reservation.children.map((child) => [child.workItemId, parentId])),
|
|
196
|
+
},
|
|
197
|
+
cards: { ...view.cards, [parentId]: { ...card, delegatedCohort: cohort } },
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
function withoutReplacedChild(cohort, replaces) {
|
|
201
|
+
if (replaces === undefined || replaces.cohortId !== cohort.cohortId)
|
|
202
|
+
return cohort;
|
|
203
|
+
const replaced = Object.entries(cohort.children).find(([, assignmentId]) => assignmentId === replaces.assignmentId)?.[0];
|
|
204
|
+
if (replaced === undefined)
|
|
205
|
+
return cohort;
|
|
206
|
+
return {
|
|
207
|
+
...cohort,
|
|
208
|
+
children: withoutKey(cohort.children, replaced),
|
|
209
|
+
finished: withoutKey(cohort.finished, replaced),
|
|
210
|
+
needsAttention: withoutKey(cohort.needsAttention, replaced),
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
function projectDelegationWaitStarted(view, event) {
|
|
214
|
+
const workId = primaryWorkId(view, event.stream.id);
|
|
215
|
+
const card = workId === undefined ? undefined : view.cards[workId];
|
|
216
|
+
if (workId === undefined || card === undefined || card.condition === BoardCondition.Finished)
|
|
217
|
+
return view;
|
|
218
|
+
const { cohortId } = event.event.payload;
|
|
219
|
+
const cohort = {
|
|
220
|
+
...(card.delegatedCohort?.cohortId === cohortId
|
|
221
|
+
? card.delegatedCohort
|
|
222
|
+
: { cohortId, children: {}, finished: {}, needsAttention: {} }),
|
|
223
|
+
waiting: true,
|
|
224
|
+
};
|
|
225
|
+
return withCohortCard(view, workId, {
|
|
226
|
+
...withoutExtendEligible(withoutBlockReason(card)),
|
|
227
|
+
delegatedCohort: cohort,
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
function projectDelegationAttentionResolved(view, event) {
|
|
231
|
+
const { cohortId, escalation, assessmentFailure } = event.event.payload;
|
|
232
|
+
const workId = primaryWorkId(view, event.stream.id);
|
|
233
|
+
// A failed assessment run is re-raised by orchestration; keep the Error its
|
|
234
|
+
// run terminal already projected rather than masking it as progress.
|
|
235
|
+
if (assessmentFailure !== undefined)
|
|
236
|
+
return view;
|
|
237
|
+
return updateCohort(view, workId, cohortId, (cohort) => escalation === undefined ? withoutEscalation(cohort) : { ...cohort, escalated: true });
|
|
238
|
+
}
|
|
239
|
+
function projectDelegationSettled(view, event) {
|
|
240
|
+
const workId = primaryWorkId(view, event.stream.id);
|
|
241
|
+
const card = workId === undefined ? undefined : view.cards[workId];
|
|
242
|
+
if (workId === undefined ||
|
|
243
|
+
card?.delegatedCohort === undefined ||
|
|
244
|
+
card.delegatedCohort.cohortId !== event.event.payload.cohortId)
|
|
245
|
+
return view;
|
|
246
|
+
const settled = withoutDelegatedCohort(card);
|
|
247
|
+
// A failed cohort is followed by InstanceBlocked, which decides the condition;
|
|
248
|
+
// a joined one resumes ordinary advancement, so it reads Ready until a Run starts.
|
|
249
|
+
const condition = event.event.eventType === OrchestrationEventType.DelegationFailed ||
|
|
250
|
+
card.condition === BoardCondition.Finished
|
|
251
|
+
? card.condition
|
|
252
|
+
: hasPrimaryActiveRun(view, activeRunsFor(view, card, workId))
|
|
253
|
+
? BoardCondition.Active
|
|
254
|
+
: BoardCondition.Ready;
|
|
255
|
+
return { ...view, cards: { ...view.cards, [workId]: { ...settled, condition } } };
|
|
256
|
+
}
|
|
257
|
+
/** Applies `update` to the parent's cohort when it matches, then re-derives a waiting card's condition. */
|
|
258
|
+
function updateCohort(view, workId, cohortId, update) {
|
|
259
|
+
const card = workId === undefined ? undefined : view.cards[workId];
|
|
260
|
+
const cohort = card?.delegatedCohort;
|
|
261
|
+
if (workId === undefined ||
|
|
262
|
+
card === undefined ||
|
|
263
|
+
cohort === undefined ||
|
|
264
|
+
(cohortId !== undefined && cohort.cohortId !== cohortId))
|
|
265
|
+
return view;
|
|
266
|
+
return withCohortCard(view, workId, { ...card, delegatedCohort: update(cohort) });
|
|
267
|
+
}
|
|
268
|
+
function withCohortCard(view, workId, card) {
|
|
269
|
+
const cohort = card.delegatedCohort;
|
|
270
|
+
const recondition = cohort?.waiting === true &&
|
|
271
|
+
card.condition !== BoardCondition.Finished &&
|
|
272
|
+
card.condition !== BoardCondition.Error;
|
|
273
|
+
return {
|
|
274
|
+
...view,
|
|
275
|
+
cards: {
|
|
276
|
+
...view.cards,
|
|
277
|
+
[workId]: recondition
|
|
278
|
+
? {
|
|
279
|
+
...card,
|
|
280
|
+
condition: hasPrimaryActiveRun(view, activeRunsFor(view, card, workId))
|
|
281
|
+
? BoardCondition.Active
|
|
282
|
+
: cohortCondition(cohort),
|
|
283
|
+
}
|
|
284
|
+
: card,
|
|
285
|
+
},
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
// A waiting parent is progressing through its children, so it reads Active;
|
|
289
|
+
// it needs a human only when a child is blocked or the parent escalated.
|
|
290
|
+
function cohortCondition(cohort) {
|
|
291
|
+
return cohort.escalated === true || Object.keys(cohort.needsAttention).length > 0
|
|
292
|
+
? BoardCondition.NeedsInput
|
|
293
|
+
: BoardCondition.Active;
|
|
294
|
+
}
|
|
295
|
+
export function boardDelegationWait(card) {
|
|
296
|
+
const cohort = card.delegatedCohort;
|
|
297
|
+
if (cohort?.waiting !== true)
|
|
298
|
+
return undefined;
|
|
299
|
+
const children = Object.keys(cohort.children);
|
|
300
|
+
return {
|
|
301
|
+
total: children.length,
|
|
302
|
+
finished: children.filter((id) => cohort.finished[id] === true).length,
|
|
303
|
+
needsAttention: children.filter((id) => cohort.needsAttention[id] === true).length,
|
|
304
|
+
...(cohort.escalated === true ? { escalated: true } : {}),
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Freezing a work item holds its whole delegated subtree (see Work's delivery
|
|
309
|
+
* availability), but descendants record no freeze of their own. Returns the
|
|
310
|
+
* key of the nearest frozen ancestor on the board, if any.
|
|
311
|
+
*/
|
|
312
|
+
export function boardFrozenAncestorLookup(view) {
|
|
313
|
+
const byKey = new Map(Object.values(view.cards).map((card) => [card.workItemKey, card]));
|
|
314
|
+
return (card) => {
|
|
315
|
+
// Finished work has nothing left to pause.
|
|
316
|
+
if (card.condition === BoardCondition.Finished)
|
|
317
|
+
return undefined;
|
|
318
|
+
const seen = new Set();
|
|
319
|
+
for (let parent = card.parentWorkItemKey === undefined ? undefined : byKey.get(card.parentWorkItemKey); parent !== undefined && !seen.has(parent.workItemKey); parent =
|
|
320
|
+
parent.parentWorkItemKey === undefined ? undefined : byKey.get(parent.parentWorkItemKey)) {
|
|
321
|
+
if (parent.frozen === true)
|
|
322
|
+
return parent.workItemKey;
|
|
323
|
+
seen.add(parent.workItemKey);
|
|
324
|
+
}
|
|
325
|
+
return undefined;
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
/** The card a primary (non-watch-child) workflow stream drives. */
|
|
329
|
+
function primaryWorkId(view, streamId) {
|
|
330
|
+
return view.children?.[streamId] === undefined ? view.workflows[streamId] : undefined;
|
|
331
|
+
}
|
|
332
|
+
function withoutEscalation(cohort) {
|
|
333
|
+
const { escalated: _escalated, ...rest } = cohort;
|
|
334
|
+
return rest;
|
|
335
|
+
}
|
|
336
|
+
function withoutDelegatedCohort(card) {
|
|
337
|
+
const { delegatedCohort: _delegatedCohort, ...rest } = card;
|
|
338
|
+
return rest;
|
|
339
|
+
}
|
|
340
|
+
function withoutKey(record, key) {
|
|
341
|
+
const { [key]: _removed, ...rest } = record;
|
|
342
|
+
return rest;
|
|
343
|
+
}
|
|
133
344
|
function projectWorkflowStarted(view, event, occurredAt) {
|
|
134
345
|
const workId = event.event.payload.workItemId;
|
|
135
346
|
const card = view.cards[workId];
|
|
@@ -147,7 +358,7 @@ function projectWorkflowStarted(view, event, occurredAt) {
|
|
|
147
358
|
cards: {
|
|
148
359
|
...view.cards,
|
|
149
360
|
[workId]: {
|
|
150
|
-
...card,
|
|
361
|
+
...withoutDelegatedCohort(card),
|
|
151
362
|
workflowName: event.event.payload.workflowName,
|
|
152
363
|
stage: event.event.payload.entry,
|
|
153
364
|
dwellSince: occurredAt,
|
|
@@ -230,17 +441,26 @@ function projectWorkflowUpdate(view, event, occurredAt) {
|
|
|
230
441
|
function cardForWorkflowStatus(card, status, event) {
|
|
231
442
|
if (event.event.eventType !== OrchestrationEventType.InstanceBlocked)
|
|
232
443
|
return {
|
|
233
|
-
...withoutExtendEligible(withoutBlockReason(card)),
|
|
444
|
+
...withoutExtendEligible(withoutBlockReason(cardForCohortStatus(card, status))),
|
|
234
445
|
condition: boardConditionForStatus(status, card),
|
|
235
446
|
};
|
|
236
447
|
const extensionEligible = isExtendEligibleBlock(event.event.payload.reason);
|
|
448
|
+
const unblocked = withoutDelegatedCohort(card);
|
|
237
449
|
return {
|
|
238
|
-
...(extensionEligible ?
|
|
450
|
+
...(extensionEligible ? unblocked : withoutExtendEligible(unblocked)),
|
|
239
451
|
condition: boardConditionForStatus(status, card),
|
|
240
452
|
blockReason: event.event.payload.reason,
|
|
241
453
|
...(extensionEligible ? { extendEligible: true } : {}),
|
|
242
454
|
};
|
|
243
455
|
}
|
|
456
|
+
// Orchestration drops a delegation wait whenever the instance terminates or blocks.
|
|
457
|
+
function cardForCohortStatus(card, status) {
|
|
458
|
+
return status === WorkflowStatus.Completed ||
|
|
459
|
+
status === WorkflowStatus.Blocked ||
|
|
460
|
+
status === WorkflowStatus.Superseded
|
|
461
|
+
? withoutDelegatedCohort(card)
|
|
462
|
+
: card;
|
|
463
|
+
}
|
|
244
464
|
function boardConditionForStatus(status, card) {
|
|
245
465
|
switch (status) {
|
|
246
466
|
// Orchestration "active" means outstanding work, not a run in flight —
|
|
@@ -377,12 +597,20 @@ function projectRunTerminal(view, event, workId, card) {
|
|
|
377
597
|
? { condition: BoardCondition.Active }
|
|
378
598
|
: terminal === undefined || isChildRun || terminal.condition === undefined
|
|
379
599
|
? {}
|
|
380
|
-
: { condition: terminal.condition }),
|
|
600
|
+
: { condition: settledRunCondition(card, terminal.condition) }),
|
|
381
601
|
totalDurationMs: card.totalDurationMs + runDurationMs,
|
|
382
602
|
},
|
|
383
603
|
},
|
|
384
604
|
};
|
|
385
605
|
}
|
|
606
|
+
// A delegating run's own outcome is held, not routed, while its cohort holds
|
|
607
|
+
// the workflow, so a blocked sentinel there means "waiting on my children",
|
|
608
|
+
// not "a human is needed". Failed or ambiguous runs still read as Error.
|
|
609
|
+
function settledRunCondition(card, condition) {
|
|
610
|
+
return condition === BoardCondition.NeedsInput && card.delegatedCohort?.waiting === true
|
|
611
|
+
? cohortCondition(card.delegatedCohort)
|
|
612
|
+
: condition;
|
|
613
|
+
}
|
|
386
614
|
function hasPrimaryActiveRun(view, activeRuns) {
|
|
387
615
|
return Object.keys(activeRuns).some((runId) => view.childRuns?.[runId] !== true);
|
|
388
616
|
}
|
|
@@ -2,7 +2,7 @@ import { ActivationSchedulerSubscriptionStatus, ControlStreamKind, } from '../co
|
|
|
2
2
|
import { ApiCommandStatus, ApiHealthCheckKind, fromWorkItemKey, presentBoardCard, presentResource, presentStatus, presentWorkflowInstance, redactConfiguration, } from '../surfaces/index.js';
|
|
3
3
|
import { analyticsProjection } from './analytics-projection.js';
|
|
4
4
|
import { createAnalyticsReports } from './analytics-reports.js';
|
|
5
|
-
import { boardConditionCounts, boardProjection, normalizeBoardActiveRunPhase, } from './board-projection.js';
|
|
5
|
+
import { boardConditionCounts, boardDelegationWait, boardFrozenAncestorLookup, boardProjection, normalizeBoardActiveRunPhase, } from './board-projection.js';
|
|
6
6
|
import { primaryExternalRef, primaryRepository } from './external-ref.js';
|
|
7
7
|
import { createSelfUpdateFailureLog, describeSelfUpdateFailure, } from './self-update-failure-log.js';
|
|
8
8
|
import { createExecutionApplications } from './surface-api-execution-applications.js';
|
|
@@ -39,13 +39,18 @@ function createBoardApplications(root, now) {
|
|
|
39
39
|
const cards = Object.values(board.cards).sort((left, right) => cardRecency(right).localeCompare(cardRecency(left)));
|
|
40
40
|
const offset = query.cursor?.position ?? 0;
|
|
41
41
|
const page = cards.slice(offset, offset + query.limit);
|
|
42
|
+
const frozenAncestor = boardFrozenAncestorLookup(board);
|
|
42
43
|
const items = await Promise.all(page.map(async (card) => {
|
|
43
44
|
const externalRef = await primaryExternalRef(root, card.workItemId);
|
|
44
45
|
const repository = await primaryRepository(root, card.workItemId);
|
|
45
|
-
const { activeRun: _legacyActiveRun, activeRuns: _activeRuns, ...withoutActiveRuns } = card;
|
|
46
|
+
const { activeRun: _legacyActiveRun, activeRuns: _activeRuns, delegatedCohort: _delegatedCohort, ...withoutActiveRuns } = card;
|
|
46
47
|
const activeRuns = activeBoardRuns(board, card);
|
|
48
|
+
const delegationWait = boardDelegationWait(card);
|
|
49
|
+
const frozenAncestorWorkItemKey = frozenAncestor(card);
|
|
47
50
|
return presentBoardCard({
|
|
48
51
|
...withoutActiveRuns,
|
|
52
|
+
...(delegationWait === undefined ? {} : { delegationWait }),
|
|
53
|
+
...(frozenAncestorWorkItemKey === undefined ? {} : { frozenAncestorWorkItemKey }),
|
|
49
54
|
totalDurationMs: card.totalDurationMs ?? 0,
|
|
50
55
|
activeRuns: Object.fromEntries(Object.entries(activeRuns).map(([runId, activeRun]) => [
|
|
51
56
|
runId,
|
|
@@ -124,6 +124,6 @@ export function resolveWakeVersion(options = {}) {
|
|
|
124
124
|
return `g${headHash.slice(0, 7)}`;
|
|
125
125
|
return '0.1.0-dev';
|
|
126
126
|
}
|
|
127
|
-
export const wakeVersion = "v0.4.
|
|
127
|
+
export const wakeVersion = "v0.4.118";
|
|
128
128
|
/** The registry-installable version used by packaged sandbox images. */
|
|
129
129
|
export const wakePackageVersion = packageVersion(defaultRepoRoot) ?? wakeVersion;
|
|
@@ -30,7 +30,10 @@ const pendingOutcomeHeaderSchema = z
|
|
|
30
30
|
const pendingDeliveryOutcomeSchema = z.discriminatedUnion('eventType', [
|
|
31
31
|
pendingOutcomeHeaderSchema.extend({
|
|
32
32
|
eventType: z.literal(DeliveryEventType.Confirmed),
|
|
33
|
-
payload: pendingCorrelationSchema.extend({
|
|
33
|
+
payload: pendingCorrelationSchema.extend({
|
|
34
|
+
externalId: z.string().min(1),
|
|
35
|
+
producerId: z.string().min(1).optional(),
|
|
36
|
+
}),
|
|
34
37
|
}),
|
|
35
38
|
pendingOutcomeHeaderSchema.extend({
|
|
36
39
|
eventType: z.literal(DeliveryEventType.Failed),
|
|
@@ -44,6 +47,7 @@ const pendingDeliveryOutcomeSchema = z.discriminatedUnion('eventType', [
|
|
|
44
47
|
payload: pendingCorrelationSchema.extend({
|
|
45
48
|
result: z.literal(DeliveryResultKind.Confirmed),
|
|
46
49
|
externalId: z.string().min(1),
|
|
50
|
+
producerId: z.string().min(1).optional(),
|
|
47
51
|
}),
|
|
48
52
|
}),
|
|
49
53
|
]);
|
|
@@ -15,6 +15,17 @@ export interface BoardCardActiveRun {
|
|
|
15
15
|
readonly elapsedMs: number;
|
|
16
16
|
readonly phase: BoardActiveRunPhase;
|
|
17
17
|
}
|
|
18
|
+
/** Progress of the delegated cohort a parent's workflow is waiting on. */
|
|
19
|
+
export interface BoardCardDelegationWait {
|
|
20
|
+
/** Child work items in the cohort. */
|
|
21
|
+
readonly total: number;
|
|
22
|
+
/** Children whose results the cohort has accepted. */
|
|
23
|
+
readonly finished: number;
|
|
24
|
+
/** Children that failed or stopped and need attention. */
|
|
25
|
+
readonly needsAttention: number;
|
|
26
|
+
/** The parent handed a question about its children to a human. */
|
|
27
|
+
readonly escalated?: boolean;
|
|
28
|
+
}
|
|
18
29
|
export interface BoardCardResponse {
|
|
19
30
|
readonly workItemKey: string;
|
|
20
31
|
readonly workItemId: string;
|
|
@@ -24,7 +35,17 @@ export interface BoardCardResponse {
|
|
|
24
35
|
readonly parentWorkItemKey?: string;
|
|
25
36
|
/** Present on a delegating parent: how many child work items it created. */
|
|
26
37
|
readonly childCount?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Present while the primary workflow waits on delegated children. Such a card
|
|
40
|
+
* is Active unless a child is blocked or the parent escalated (Needs input).
|
|
41
|
+
*/
|
|
42
|
+
readonly delegationWait?: BoardCardDelegationWait;
|
|
27
43
|
readonly frozen?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Present on delegated work held because an ancestor is frozen: the key of the
|
|
46
|
+
* nearest frozen ancestor. Such work records no freeze of its own.
|
|
47
|
+
*/
|
|
48
|
+
readonly frozenAncestorWorkItemKey?: string;
|
|
28
49
|
readonly awaitingApproval?: boolean;
|
|
29
50
|
/** Whether the primary workflow needs a gate-budget extension to continue. */
|
|
30
51
|
readonly extendEligible?: boolean;
|