@atolis-hq/wake 0.4.47 → 0.4.48

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.
@@ -27,6 +27,8 @@ interface StoredCard {
27
27
  readonly condition: BoardConditionValue;
28
28
  readonly frozen?: boolean;
29
29
  readonly awaitingApproval?: boolean;
30
+ /** Present only while the primary workflow can accept a gate-budget extension. */
31
+ readonly extendEligible?: boolean;
30
32
  readonly workflowName?: string;
31
33
  readonly stage?: string;
32
34
  readonly blockReason?: string;
@@ -93,7 +93,10 @@ function projectWork(view, event, occurredAt) {
93
93
  ...view,
94
94
  cards: {
95
95
  ...view.cards,
96
- [id]: { ...withoutAwaitingApproval(current), condition: BoardCondition.Finished },
96
+ [id]: {
97
+ ...withoutExtendEligible(withoutAwaitingApproval(current)),
98
+ condition: BoardCondition.Finished,
99
+ },
97
100
  },
98
101
  };
99
102
  }
@@ -163,7 +166,7 @@ function projectWorkflowUpdate(view, event, occurredAt) {
163
166
  cards: {
164
167
  ...view.cards,
165
168
  [workId]: {
166
- ...withoutBlockReason(card),
169
+ ...withoutExtendEligible(withoutBlockReason(card)),
167
170
  stage: event.event.payload.stage,
168
171
  dwellSince: occurredAt,
169
172
  condition: BoardCondition.Ready,
@@ -179,15 +182,7 @@ function projectWorkflowUpdate(view, event, occurredAt) {
179
182
  const status = orchestrationStatusTransitions[event.event.eventType];
180
183
  if (status === undefined)
181
184
  return view;
182
- const withCondition = {
183
- ...(event.event.eventType === OrchestrationEventType.InstanceBlocked
184
- ? card
185
- : withoutBlockReason(card)),
186
- condition: boardConditionForStatus(status, card),
187
- ...(event.event.eventType === OrchestrationEventType.InstanceBlocked
188
- ? { blockReason: event.event.payload.reason }
189
- : {}),
190
- };
185
+ const withCondition = cardForWorkflowStatus(card, status, event);
191
186
  if (event.event.eventType === OrchestrationEventType.SignalWaitStarted)
192
187
  return {
193
188
  ...view,
@@ -203,6 +198,20 @@ function projectWorkflowUpdate(view, event, occurredAt) {
203
198
  return { ...view, cards: { ...view.cards, [workId]: withoutAwaitingApproval(withCondition) } };
204
199
  return { ...view, cards: { ...view.cards, [workId]: withCondition } };
205
200
  }
201
+ function cardForWorkflowStatus(card, status, event) {
202
+ if (event.event.eventType !== OrchestrationEventType.InstanceBlocked)
203
+ return {
204
+ ...withoutExtendEligible(withoutBlockReason(card)),
205
+ condition: boardConditionForStatus(status, card),
206
+ };
207
+ const extensionEligible = isExtendEligibleBlock(event.event.payload.reason);
208
+ return {
209
+ ...(extensionEligible ? card : withoutExtendEligible(card)),
210
+ condition: boardConditionForStatus(status, card),
211
+ blockReason: event.event.payload.reason,
212
+ ...(extensionEligible ? { extendEligible: true } : {}),
213
+ };
214
+ }
206
215
  function boardConditionForStatus(status, card) {
207
216
  switch (status) {
208
217
  // Orchestration "active" means outstanding work, not a run in flight —
@@ -460,6 +469,13 @@ function withoutAwaitingApproval(card) {
460
469
  const { awaitingApproval: _awaitingApproval, ...withoutApproval } = card;
461
470
  return withoutApproval;
462
471
  }
472
+ function withoutExtendEligible(card) {
473
+ const { extendEligible: _extendEligible, ...withoutExtension } = card;
474
+ return withoutExtension;
475
+ }
476
+ function isExtendEligibleBlock(reason) {
477
+ return reason.startsWith('watch group budget exhausted for ');
478
+ }
463
479
  function activeRunsFor(view, card, workId) {
464
480
  if (card.activeRuns !== undefined)
465
481
  return Object.fromEntries(Object.entries(card.activeRuns).map(([runId, activeRun]) => [
@@ -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.47";
127
+ export const wakeVersion = "v0.4.48";
128
128
  /** The registry-installable version used by packaged sandbox images. */
129
129
  export const wakePackageVersion = packageVersion(defaultRepoRoot) ?? wakeVersion;
@@ -22,6 +22,8 @@ export interface BoardCardResponse {
22
22
  readonly condition: BoardCardCondition;
23
23
  readonly frozen?: boolean;
24
24
  readonly awaitingApproval?: boolean;
25
+ /** Whether the primary workflow needs a gate-budget extension to continue. */
26
+ readonly extendEligible?: boolean;
25
27
  readonly workflowName?: string;
26
28
  readonly stage?: string;
27
29
  /** Why the primary workflow is blocked, when it requires operator intervention. */