@atolis-hq/wake 0.4.76 → 0.4.77
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/composition-root.js +1 -0
- package/dist/src/bootstrap/config/root-schema.d.ts +1 -0
- package/dist/src/bootstrap/initialise.js +1 -0
- package/dist/src/bootstrap/integration-runtime.js +8 -1
- package/dist/src/bootstrap/version.js +1 -1
- package/dist/src/control-plane/application/activation-scheduler-ports.d.ts +1 -0
- package/dist/src/control-plane/application/activation-scheduler.js +4 -0
- package/dist/src/control-plane/application/advance-once-dispatch.d.ts +5 -0
- package/dist/src/control-plane/application/advance-once-dispatch.js +11 -1
- package/dist/src/control-plane/contracts/config.d.ts +2 -0
- package/dist/src/control-plane/contracts/config.js +2 -0
- package/dist/src/control-plane/domain/open-work-policy.d.ts +12 -0
- package/dist/src/control-plane/domain/open-work-policy.js +35 -0
- package/dist/src/control-plane/index.d.ts +1 -0
- package/dist/src/control-plane/index.js +1 -0
- package/dist/src/orchestration/application/advance-workflow.js +1 -0
- package/dist/src/orchestration/contracts/views.d.ts +2 -0
- package/dist/src/orchestration/domain/workflow-instance-events.d.ts +1 -0
- package/dist/src/orchestration/domain/workflow-instance-events.js +2 -0
- package/dist/src/orchestration/domain/workflow-instance.js +9 -1
- package/package.json +1 -1
|
@@ -142,6 +142,7 @@ export async function createCompositionRoot(wakeRoot, options = {}) {
|
|
|
142
142
|
ids,
|
|
143
143
|
dispatchPolicy: new DispatchPolicy({ maxDispatches: config.controlPlane.maxDispatches }),
|
|
144
144
|
maxConcurrentRuns: config.controlPlane.maxConcurrentRuns,
|
|
145
|
+
maxOpenWorkItems: config.controlPlane.maxOpenWorkItems ?? null,
|
|
145
146
|
maxDispatches: config.controlPlane.maxDispatches,
|
|
146
147
|
schedulerSerialiser: createFileActivationSchedulerSerialiser(paths.dataRoot),
|
|
147
148
|
isDispatchPaused: isRuntimePaused,
|
|
@@ -338,6 +338,7 @@ export declare const rootConfigSchema: z.ZodObject<{
|
|
|
338
338
|
controlPlane: z.ZodDefault<z.ZodObject<{
|
|
339
339
|
maxDispatches: z.ZodDefault<z.ZodNumber>;
|
|
340
340
|
maxConcurrentRuns: z.ZodDefault<z.ZodNumber>;
|
|
341
|
+
maxOpenWorkItems: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
|
341
342
|
triggers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
342
343
|
id: z.ZodString;
|
|
343
344
|
workflow: z.ZodString;
|
|
@@ -43,6 +43,7 @@ orchestration:
|
|
|
43
43
|
# Independent workflow invocations need an explicit event and/or UTC cron source.
|
|
44
44
|
# Activity prompts define their tasks. No triggers are enabled by default.
|
|
45
45
|
controlPlane:
|
|
46
|
+
maxOpenWorkItems: null # Unlimited; set a positive integer to finish open work first.
|
|
46
47
|
triggers: []
|
|
47
48
|
|
|
48
49
|
# External providers Wake correlates inbound work with. Empty until you
|
|
@@ -3,7 +3,7 @@ import { withFileLock } from '@atolis-hq/eventing-filesystem';
|
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { ActivityExecutionKind, activityName, } from '../activities/index.js';
|
|
6
|
-
import { ControlEventType, ControlStreamKind, TriggerService, createDurableRunnerIneligibility, createIntakePipeline, createRunnerPipeline, createTriggerReactor, createWorkCancellationPolicy, selectControlEvent, triggerInvocationProjection, triggerInvocationStream, } from '../control-plane/index.js';
|
|
6
|
+
import { ControlEventType, ControlStreamKind, TriggerService, createDurableRunnerIneligibility, createIntakePipeline, createRunnerPipeline, createTriggerReactor, createWorkCancellationPolicy, hasOpenWorkCapacity, readOpenWorkItemIds, selectControlEvent, triggerInvocationProjection, triggerInvocationStream, } from '../control-plane/index.js';
|
|
7
7
|
import { ConversationOriginKind, workItemIdForConversation } from '../conversations/index.js';
|
|
8
8
|
import { ExecutionStreamKind, NoEligibleRunnerError, RunRepository, createRuntimeMemoryProfile, decodeActivationExecutionEvent, isActiveRunStatus, isRunStream, runId, } from '../execution/index.js';
|
|
9
9
|
import { AgentRunPublicationReactor, ArtifactRegistrationReactor, DeliveryOutcomeReactor, DeliveryService, IntegrationStreamKind, PollService, ProviderRegistry, deliveryProjectionDefinitions, fakeProviderDefinition, publishConversationCommandFeedback, } from '../integrations/index.js';
|
|
@@ -123,6 +123,8 @@ export async function composeIntegrationRuntime(input) {
|
|
|
123
123
|
const active = (await input.execution.list()).filter((run) => isActiveRunStatus(run.status));
|
|
124
124
|
if (active.length >= input.config.controlPlane.maxConcurrentRuns)
|
|
125
125
|
return false;
|
|
126
|
+
if (!(await openWorkCapacityAvailable()))
|
|
127
|
+
return false;
|
|
126
128
|
const workflow = input.config.orchestration.workflows[trigger.workflow];
|
|
127
129
|
const stage = workflow.stages[workflow.entry ?? Object.keys(workflow.stages)[0]];
|
|
128
130
|
const pool = stage.execution?.runnerPool ?? input.config.execution.defaultRunnerPool;
|
|
@@ -147,6 +149,11 @@ export async function composeIntegrationRuntime(input) {
|
|
|
147
149
|
orchestration: input.orchestration,
|
|
148
150
|
now: () => input.clock.now().toISOString(),
|
|
149
151
|
});
|
|
152
|
+
async function openWorkCapacityAvailable() {
|
|
153
|
+
const limit = input.config.controlPlane.maxOpenWorkItems ?? null;
|
|
154
|
+
return (limit === null ||
|
|
155
|
+
hasOpenWorkCapacity(await readOpenWorkItemIds(await input.orchestration.listAll(), input.work), limit));
|
|
156
|
+
}
|
|
150
157
|
const triggerReactors = input.config.controlPlane.triggers.map((config) => createTriggerReactor(triggers, config, decodeCanonicalEvent));
|
|
151
158
|
// Registration starts at the current journal boundary; historical facts are not sources.
|
|
152
159
|
const registrationSchema = z.object({ position: z.number().int().nonnegative() }).strict();
|
|
@@ -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.77";
|
|
128
128
|
/** The registry-installable version used by packaged sandbox images. */
|
|
129
129
|
export const wakePackageVersion = packageVersion(defaultRepoRoot) ?? wakeVersion;
|
|
@@ -70,6 +70,7 @@ export interface ActivationSchedulerDependencies {
|
|
|
70
70
|
readonly closedWorkItemIds?: () => Promise<readonly string[]>;
|
|
71
71
|
readonly dispatchPolicy?: DispatchPolicy;
|
|
72
72
|
readonly maxConcurrentRuns?: number;
|
|
73
|
+
readonly maxOpenWorkItems?: number | null;
|
|
73
74
|
readonly maxDispatches?: number;
|
|
74
75
|
readonly schedulerSerialiser?: ActivationSchedulerSerialiser;
|
|
75
76
|
}
|
|
@@ -167,6 +167,8 @@ export function createActivationScheduler(orchestration, execution, resources, c
|
|
|
167
167
|
resources,
|
|
168
168
|
dispatchPolicy,
|
|
169
169
|
maxConcurrentRuns,
|
|
170
|
+
maxOpenWorkItems: dependencies.maxOpenWorkItems ?? null,
|
|
171
|
+
work: dependencies.work,
|
|
170
172
|
maxDispatches,
|
|
171
173
|
runnerIneligibility,
|
|
172
174
|
isDispatchPaused,
|
|
@@ -187,6 +189,8 @@ export function createActivationScheduler(orchestration, execution, resources, c
|
|
|
187
189
|
resources,
|
|
188
190
|
dispatchPolicy,
|
|
189
191
|
maxConcurrentRuns,
|
|
192
|
+
maxOpenWorkItems: dependencies.maxOpenWorkItems ?? null,
|
|
193
|
+
work: dependencies.work,
|
|
190
194
|
maxDispatches,
|
|
191
195
|
runnerIneligibility,
|
|
192
196
|
isDispatchPaused,
|
|
@@ -4,6 +4,7 @@ import type { ActivityActivationView, WorkflowInstanceView } from '../../orchest
|
|
|
4
4
|
import type { ResourceService } from '../../resources/index.js';
|
|
5
5
|
import type { AdvanceResult } from '../contracts/views.js';
|
|
6
6
|
import type { DispatchPolicy } from '../domain/dispatch-policy.js';
|
|
7
|
+
import { type WorkAvailability } from '../domain/open-work-policy.js';
|
|
7
8
|
import type { ExecutionPort, OrchestrationPort } from './activation-scheduler-ports.js';
|
|
8
9
|
export interface DispatchLoopContext {
|
|
9
10
|
readonly orchestration: OrchestrationPort;
|
|
@@ -12,6 +13,10 @@ export interface DispatchLoopContext {
|
|
|
12
13
|
readonly dispatchPolicy: DispatchPolicy;
|
|
13
14
|
readonly maxConcurrentRuns: number;
|
|
14
15
|
readonly maxDispatches: number;
|
|
16
|
+
readonly maxOpenWorkItems: number | null;
|
|
17
|
+
readonly work: {
|
|
18
|
+
get(id: string): Promise<WorkAvailability | null>;
|
|
19
|
+
} | undefined;
|
|
15
20
|
readonly runnerIneligibility: () => Promise<ReadonlySet<string>>;
|
|
16
21
|
readonly isDispatchPaused: () => Promise<boolean>;
|
|
17
22
|
readonly commandContext: (cause: string) => CommandContext;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ActivityFailureCode, ActivityOutcomeKind, } from '../../activities/index.js';
|
|
2
2
|
import { ActivationClaimConflictError, isActiveRunStatus, NoEligibleRunnerError, RunStatus, WorkspaceMode, } from '../../execution/index.js';
|
|
3
3
|
import { WorkflowStatus } from '../../orchestration/index.js';
|
|
4
|
+
import { canDispatchWorkItem, readOpenWorkItemIds, } from '../domain/open-work-policy.js';
|
|
4
5
|
import { isExecutionFailureTerminal } from './execution-reconciliation.js';
|
|
5
6
|
export async function advancementWasDurablyApplied(orchestration, workflowInstanceId, activationId) {
|
|
6
7
|
const current = await orchestration.get?.(workflowInstanceId);
|
|
@@ -55,6 +56,7 @@ export function reportUnappliedRunnerQuotaRetry(result, input) {
|
|
|
55
56
|
export async function runDispatchLoop(pending, ctx) {
|
|
56
57
|
const dispatched = [];
|
|
57
58
|
const dispatchedIds = new Set();
|
|
59
|
+
const startedWorkflowIds = new Set();
|
|
58
60
|
const isolatedIds = new Set();
|
|
59
61
|
let isolated;
|
|
60
62
|
let stopReason;
|
|
@@ -68,8 +70,15 @@ export async function runDispatchLoop(pending, ctx) {
|
|
|
68
70
|
stopReason = { kind: 'no-work' };
|
|
69
71
|
break;
|
|
70
72
|
}
|
|
73
|
+
// Legacy test ports may omit listAll; production supplies the journal-backed inventory.
|
|
74
|
+
const open = ctx.maxOpenWorkItems === null
|
|
75
|
+
? new Set()
|
|
76
|
+
: await readOpenWorkItemIds(((await ctx.orchestration.listAll?.()) ?? pending.map((item) => item.workflow)).map((workflow) => startedWorkflowIds.has(workflow.workflowInstanceId)
|
|
77
|
+
? { ...workflow, hasStartedActivation: true }
|
|
78
|
+
: workflow), ctx.work);
|
|
71
79
|
const selectedCandidate = ctx.dispatchPolicy.select(pending
|
|
72
|
-
.filter((item) => !isolatedIds.has(item.workflow.workflowInstanceId)
|
|
80
|
+
.filter((item) => !isolatedIds.has(item.workflow.workflowInstanceId) &&
|
|
81
|
+
canDispatchWorkItem(item.workflow.workItemId, open, ctx.maxOpenWorkItems))
|
|
73
82
|
.map((item, requestedPosition) => ({
|
|
74
83
|
workItemId: item.workflow.workItemId,
|
|
75
84
|
activationId: item.activation.activationId,
|
|
@@ -102,6 +111,7 @@ export async function runDispatchLoop(pending, ctx) {
|
|
|
102
111
|
break;
|
|
103
112
|
}
|
|
104
113
|
await ctx.orchestration.markActivationStarted(selected.workflow.workflowInstanceId, selected.activation.activationId, ctx.commandContext(selected.activation.activationId));
|
|
114
|
+
startedWorkflowIds.add(selected.workflow.workflowInstanceId);
|
|
105
115
|
const correlated = await ctx.resources.correlationsForWork(selected.workflow.workItemId);
|
|
106
116
|
const resourceViews = (await Promise.all(correlated.map((entry) => ctx.resources.get(entry.resourceId)))).filter((resource) => resource !== null);
|
|
107
117
|
const run = await ctx.execution.attempt(selected.activation, {
|
|
@@ -14,6 +14,7 @@ export interface TriggerConfig {
|
|
|
14
14
|
export interface ControlPlaneConfig {
|
|
15
15
|
readonly maxDispatches: number;
|
|
16
16
|
readonly maxConcurrentRuns: number;
|
|
17
|
+
readonly maxOpenWorkItems?: number | null;
|
|
17
18
|
readonly triggers: readonly TriggerConfig[];
|
|
18
19
|
readonly resident?: {
|
|
19
20
|
readonly pollBackoffMs: number;
|
|
@@ -23,6 +24,7 @@ export interface ControlPlaneConfig {
|
|
|
23
24
|
export declare const controlPlaneConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
24
25
|
maxDispatches: z.ZodDefault<z.ZodNumber>;
|
|
25
26
|
maxConcurrentRuns: z.ZodDefault<z.ZodNumber>;
|
|
27
|
+
maxOpenWorkItems: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
|
26
28
|
triggers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
27
29
|
id: z.ZodString;
|
|
28
30
|
workflow: z.ZodString;
|
|
@@ -42,6 +42,7 @@ export const controlPlaneConfigSchema = z
|
|
|
42
42
|
.object({
|
|
43
43
|
maxDispatches: z.number().int().positive().default(1),
|
|
44
44
|
maxConcurrentRuns: z.number().int().positive().default(1),
|
|
45
|
+
maxOpenWorkItems: z.number().int().positive().nullable().default(null),
|
|
45
46
|
triggers: z.array(triggerSchema).default([]),
|
|
46
47
|
resident: z
|
|
47
48
|
.object({
|
|
@@ -58,6 +59,7 @@ export const controlPlaneConfigSchema = z
|
|
|
58
59
|
.default({
|
|
59
60
|
maxDispatches: 1,
|
|
60
61
|
maxConcurrentRuns: 1,
|
|
62
|
+
maxOpenWorkItems: null,
|
|
61
63
|
triggers: [],
|
|
62
64
|
resident: { pollBackoffMs: 1000 },
|
|
63
65
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type WorkflowInstanceView } from '../../orchestration/index.js';
|
|
2
|
+
export interface WorkAvailability {
|
|
3
|
+
readonly frozen?: boolean;
|
|
4
|
+
readonly deleted?: boolean;
|
|
5
|
+
}
|
|
6
|
+
/** Distinct started items with any nonterminal workflow, including waiting children. */
|
|
7
|
+
export declare function deriveOpenWorkItemIds(workflows: readonly WorkflowInstanceView[], unavailable?: ReadonlySet<string>): ReadonlySet<string>;
|
|
8
|
+
export declare function hasOpenWorkCapacity(open: ReadonlySet<string>, limit: number | null): boolean;
|
|
9
|
+
export declare function canDispatchWorkItem(workItemId: string, open: ReadonlySet<string>, limit: number | null): boolean;
|
|
10
|
+
export declare function readOpenWorkItemIds(workflows: readonly WorkflowInstanceView[], work?: {
|
|
11
|
+
get(id: string): Promise<WorkAvailability | null>;
|
|
12
|
+
}): Promise<ReadonlySet<string>>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ActivityActivationStatus, WorkflowStatus, } from '../../orchestration/index.js';
|
|
2
|
+
/** Distinct started items with any nonterminal workflow, including waiting children. */
|
|
3
|
+
export function deriveOpenWorkItemIds(workflows, unavailable = new Set()) {
|
|
4
|
+
const started = new Set();
|
|
5
|
+
const unfinished = new Set();
|
|
6
|
+
for (const workflow of workflows) {
|
|
7
|
+
if (unavailable.has(workflow.workItemId))
|
|
8
|
+
continue;
|
|
9
|
+
if (workflow.hasStartedActivation === true ||
|
|
10
|
+
workflow.acceptedOutcomes.length > 0 ||
|
|
11
|
+
(workflow.pendingActivation !== undefined &&
|
|
12
|
+
workflow.pendingActivation.status !== ActivityActivationStatus.Pending))
|
|
13
|
+
started.add(workflow.workItemId);
|
|
14
|
+
if (workflow.status !== WorkflowStatus.Completed &&
|
|
15
|
+
workflow.status !== WorkflowStatus.Superseded)
|
|
16
|
+
unfinished.add(workflow.workItemId);
|
|
17
|
+
}
|
|
18
|
+
return new Set([...started].filter((id) => unfinished.has(id)));
|
|
19
|
+
}
|
|
20
|
+
export function hasOpenWorkCapacity(open, limit) {
|
|
21
|
+
return limit === null || open.size < limit;
|
|
22
|
+
}
|
|
23
|
+
export function canDispatchWorkItem(workItemId, open, limit) {
|
|
24
|
+
return open.has(workItemId) || hasOpenWorkCapacity(open, limit);
|
|
25
|
+
}
|
|
26
|
+
export async function readOpenWorkItemIds(workflows, work) {
|
|
27
|
+
const open = deriveOpenWorkItemIds(workflows);
|
|
28
|
+
const unavailable = new Set();
|
|
29
|
+
await Promise.all([...open].map(async (id) => {
|
|
30
|
+
const item = await work?.get(id);
|
|
31
|
+
if (item?.frozen === true || item?.deleted === true)
|
|
32
|
+
unavailable.add(id);
|
|
33
|
+
}));
|
|
34
|
+
return new Set([...open].filter((id) => !unavailable.has(id)));
|
|
35
|
+
}
|
|
@@ -26,3 +26,4 @@ export * from './infrastructure/resident-host.js';
|
|
|
26
26
|
export * from './infrastructure/tick-host.js';
|
|
27
27
|
export * from './application/trigger-invocation-projection.js';
|
|
28
28
|
export * from './application/trigger-projection.js';
|
|
29
|
+
export * from './domain/open-work-policy.js';
|
|
@@ -25,3 +25,4 @@ export * from './infrastructure/resident-host.js';
|
|
|
25
25
|
export * from './infrastructure/tick-host.js';
|
|
26
26
|
export * from './application/trigger-invocation-projection.js';
|
|
27
27
|
export * from './application/trigger-projection.js';
|
|
28
|
+
export * from './domain/open-work-policy.js';
|
|
@@ -203,6 +203,7 @@ export class AdvanceWorkflow {
|
|
|
203
203
|
(signalKind === undefined || view.waitingFor?.signalKind === signalKind))
|
|
204
204
|
.map(({ view }) => view);
|
|
205
205
|
}
|
|
206
|
+
// Scheduler reads replayed journal facts, never potentially stale stored projections.
|
|
206
207
|
async listAll() {
|
|
207
208
|
return (await this.listAllLoaded()).map(({ view }) => view);
|
|
208
209
|
}
|
|
@@ -58,6 +58,8 @@ export interface WorkflowInstanceView {
|
|
|
58
58
|
readonly supplementalQueue: readonly SupplementalActivityView[];
|
|
59
59
|
readonly acceptedSignalIds: readonly string[];
|
|
60
60
|
readonly operatorRetryCommandIds: readonly string[];
|
|
61
|
+
/** Retained after the pending activation is replaced, derived from ActivityStarted facts. */
|
|
62
|
+
readonly hasStartedActivation?: boolean;
|
|
61
63
|
readonly acceptedOutcomes: readonly ActivationId[];
|
|
62
64
|
readonly acceptedChildCompletionIds: readonly WorkflowInstanceId[];
|
|
63
65
|
readonly causalRejectionIds: readonly string[];
|
|
@@ -32,6 +32,7 @@ export type MutableWorkflowInstance = {
|
|
|
32
32
|
supplementalQueue: Array<WorkflowInstanceView['supplementalQueue'][number]>;
|
|
33
33
|
acceptedSignalIds: string[];
|
|
34
34
|
operatorRetryCommandIds: string[];
|
|
35
|
+
hasStartedActivation: boolean;
|
|
35
36
|
acceptedOutcomes: ActivationId[];
|
|
36
37
|
acceptedChildCompletionIds: WorkflowInstanceView['workflowInstanceId'][];
|
|
37
38
|
causalRejectionIds: string[];
|
|
@@ -50,6 +50,7 @@ function applyActivityFact(state, event) {
|
|
|
50
50
|
applyActivityRequested(state, event.payload);
|
|
51
51
|
return;
|
|
52
52
|
case OrchestrationEventType.ActivityStarted:
|
|
53
|
+
state.hasStartedActivation = true;
|
|
53
54
|
updateActivationStatus(state, event.payload.activationId, ActivityActivationStatus.Running);
|
|
54
55
|
return;
|
|
55
56
|
case OrchestrationEventType.ActivityOutcomeAccepted:
|
|
@@ -238,6 +239,7 @@ export function immutableWorkflowInstanceView(state) {
|
|
|
238
239
|
supplementalQueue: state.supplementalQueue,
|
|
239
240
|
acceptedSignalIds: state.acceptedSignalIds,
|
|
240
241
|
operatorRetryCommandIds: state.operatorRetryCommandIds,
|
|
242
|
+
hasStartedActivation: state.hasStartedActivation,
|
|
241
243
|
acceptedOutcomes: state.acceptedOutcomes,
|
|
242
244
|
acceptedChildCompletionIds: state.acceptedChildCompletionIds,
|
|
243
245
|
causalRejectionIds: state.causalRejectionIds,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OrchestrationEventType } from '../contracts/events.js';
|
|
2
|
-
import { WorkflowStatus } from '../contracts/vocabulary.js';
|
|
2
|
+
import { ActivityActivationStatus, WorkflowStatus } from '../contracts/vocabulary.js';
|
|
3
3
|
import { applyWorkflowInstanceEvent, immutableWorkflowInstanceView, orchestrationStatusTransitions, } from './workflow-instance-events.js';
|
|
4
4
|
export { orchestrationStatusTransitions };
|
|
5
5
|
export function foldWorkflowInstance(events) {
|
|
@@ -24,6 +24,7 @@ export function foldWorkflowInstance(events) {
|
|
|
24
24
|
supplementalQueue: [],
|
|
25
25
|
acceptedSignalIds: [],
|
|
26
26
|
operatorRetryCommandIds: [],
|
|
27
|
+
hasStartedActivation: false,
|
|
27
28
|
acceptedOutcomes: [],
|
|
28
29
|
acceptedChildCompletionIds: [],
|
|
29
30
|
causalRejectionIds: [],
|
|
@@ -39,6 +40,7 @@ export function continueWorkflowInstance(previous, event) {
|
|
|
39
40
|
return foldWorkflowInstance([event]);
|
|
40
41
|
const state = {
|
|
41
42
|
...previous,
|
|
43
|
+
hasStartedActivation: previous.hasStartedActivation ?? legacyStartEvidence(previous),
|
|
42
44
|
repeatCounts: { ...previous.repeatCounts },
|
|
43
45
|
retryCounts: { ...previous.retryCounts },
|
|
44
46
|
supplementalQueue: [...previous.supplementalQueue],
|
|
@@ -62,3 +64,9 @@ function optionalChildFields(payload) {
|
|
|
62
64
|
}
|
|
63
65
|
: {};
|
|
64
66
|
}
|
|
67
|
+
// Preserve visible start evidence when continuing a pre-field stored view.
|
|
68
|
+
function legacyStartEvidence(previous) {
|
|
69
|
+
return (previous.acceptedOutcomes.length > 0 ||
|
|
70
|
+
(previous.pendingActivation !== undefined &&
|
|
71
|
+
previous.pendingActivation.status !== ActivityActivationStatus.Pending));
|
|
72
|
+
}
|