@atolis-hq/wake 0.4.77 → 0.4.79
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/activities/contracts/event-schema.d.ts +30 -0
- package/dist/src/activities/contracts/event-schema.js +8 -2
- package/dist/src/activities/contracts/events.d.ts +3 -1
- package/dist/src/activities/pr/application.js +6 -3
- package/dist/src/activities/pr/contracts.d.ts +3 -1
- package/dist/src/activities/pr/event-data.js +4 -1
- package/dist/src/activities/pr/projection.js +4 -1
- package/dist/src/activities/pr/vocabulary.d.ts +6 -0
- package/dist/src/activities/pr/vocabulary.js +5 -0
- package/dist/src/bootstrap/composition-root.js +2 -2
- package/dist/src/bootstrap/config/root-schema.d.ts +18 -0
- package/dist/src/bootstrap/resource-transition-evidence.js +20 -14
- package/dist/src/bootstrap/version.js +1 -1
- package/dist/src/control-plane/application/activation-scheduler-ports.d.ts +2 -1
- package/dist/src/control-plane/application/advance-once-dispatch.d.ts +2 -1
- package/dist/src/control-plane/application/advance-once-dispatch.js +7 -0
- package/dist/src/control-plane/domain/dispatch-policy.d.ts +6 -0
- package/dist/src/control-plane/domain/dispatch-policy.js +4 -1
- package/dist/src/integrations/application/agent-run-publication-reactor.d.ts +1 -0
- package/dist/src/integrations/application/agent-run-publication-reactor.js +49 -25
- package/dist/src/integrations/application/agent-run-publication-report.d.ts +10 -0
- package/dist/src/integrations/application/agent-run-publication-report.js +53 -0
- package/dist/src/integrations/application/terminal-agent-run-report.d.ts +4 -0
- package/dist/src/integrations/application/terminal-agent-run-report.js +4 -0
- package/dist/src/integrations/delivery/contracts/intents.d.ts +2 -0
- package/dist/src/integrations/delivery/contracts/intents.js +2 -0
- package/dist/src/integrations/github/application/agent-run-comment.d.ts +2 -0
- package/dist/src/integrations/github/application/agent-run-comment.js +26 -5
- package/dist/src/integrations/github/application/pull-request-translation.js +1 -0
- package/dist/src/integrations/github/contracts/events.d.ts +2 -1
- package/dist/src/integrations/github/contracts/events.js +8 -1
- package/dist/src/integrations/github/contracts/payloads.d.ts +1 -0
- package/dist/src/integrations/github/infrastructure/client-reads.d.ts +18 -6
- package/dist/src/integrations/github/infrastructure/client-reads.js +6 -1
- package/dist/src/integrations/github/infrastructure/client.d.ts +18 -6
- package/dist/src/integrations/github/infrastructure/consecutive-pr-observations.d.ts +4 -0
- package/dist/src/integrations/github/infrastructure/consecutive-pr-observations.js +33 -0
- package/dist/src/integrations/github/infrastructure/pr-source.js +6 -1
- package/dist/src/integrations/github/infrastructure/source.d.ts +6 -2
- package/dist/src/integrations/github/infrastructure/source.js +9 -9
- package/dist/src/integrations/github/provider.js +1 -0
- package/dist/src/orchestration/application/advance-workflow.d.ts +4 -5
- package/dist/src/orchestration/application/advance-workflow.js +6 -6
- package/dist/src/orchestration/application/orchestration-service.d.ts +4 -6
- package/dist/src/orchestration/application/orchestration-service.js +3 -3
- package/dist/src/orchestration/application/pending-activations.d.ts +13 -0
- package/dist/src/orchestration/application/pending-activations.js +32 -0
- package/dist/src/orchestration/application/policy-blocked-merge-recovery.d.ts +5 -0
- package/dist/src/orchestration/application/policy-blocked-merge-recovery.js +108 -21
- package/dist/src/orchestration/application/pull-request-transition-evidence.js +22 -1
- package/dist/src/orchestration/application/resource-transition-evidence.d.ts +6 -1
- package/dist/src/orchestration/application/resource-transition-matching.d.ts +5 -0
- package/dist/src/orchestration/application/resource-transition-matching.js +24 -1
- package/dist/src/orchestration/contracts/config.d.ts +43 -1
- package/dist/src/orchestration/contracts/config.js +9 -1
- package/dist/src/orchestration/contracts/event-decoder.d.ts +6 -0
- package/dist/src/orchestration/contracts/event-decoder.js +7 -1
- package/dist/src/orchestration/contracts/events.d.ts +2 -0
- package/dist/src/orchestration/contracts/views.d.ts +1 -0
- package/dist/src/orchestration/domain/compiler.js +4 -13
- package/dist/src/orchestration/domain/decision-events.d.ts +1 -0
- package/dist/src/orchestration/domain/decision-events.js +1 -0
- package/dist/src/orchestration/domain/dispatch-priority.d.ts +9 -0
- package/dist/src/orchestration/domain/dispatch-priority.js +16 -0
- package/dist/src/orchestration/domain/resource-transition-compiler.js +1 -0
- package/dist/src/orchestration/domain/runner-quota-retry-policy.js +1 -0
- package/dist/src/orchestration/domain/signal-policy.d.ts +2 -0
- package/dist/src/orchestration/domain/signal-policy.js +10 -4
- package/dist/src/orchestration/domain/transition-target.d.ts +4 -0
- package/dist/src/orchestration/domain/transition-target.js +14 -0
- package/dist/src/orchestration/domain/transition.d.ts +1 -1
- package/dist/src/orchestration/domain/transition.js +4 -3
- package/dist/src/orchestration/domain/workflow-graph.d.ts +8 -0
- package/dist/src/orchestration/domain/workflow-graph.js +41 -0
- package/dist/src/orchestration/domain/workflow-instance-events.js +1 -0
- package/dist/src/orchestration/index.d.ts +3 -0
- package/dist/src/orchestration/index.js +3 -0
- package/package.json +1 -1
|
@@ -12,5 +12,5 @@ interface DecisionContext {
|
|
|
12
12
|
readonly causationId: string;
|
|
13
13
|
}
|
|
14
14
|
export declare function finishRoute(events: WorkflowOrchestrationEventData[], definition: CompiledWorkflow, state: WorkflowInstanceView, input: TransitionInput, route: CompiledOutcomeRoute): void;
|
|
15
|
-
export declare function resumeToTarget(events: WorkflowOrchestrationEventData[], definition: CompiledWorkflow, state: WorkflowInstanceView, input: DecisionContext, target: TransitionTarget): void;
|
|
15
|
+
export declare function resumeToTarget(events: WorkflowOrchestrationEventData[], definition: CompiledWorkflow, state: WorkflowInstanceView, input: DecisionContext, target: TransitionTarget, watchDriven?: boolean): void;
|
|
16
16
|
export {};
|
|
@@ -62,19 +62,20 @@ export function finishRoute(events, definition, state, input, route) {
|
|
|
62
62
|
}
|
|
63
63
|
pushStageEntry(events, definition, state, input, route.target.stage);
|
|
64
64
|
}
|
|
65
|
-
function pushStageEntry(events, definition, state, input, stageName) {
|
|
65
|
+
function pushStageEntry(events, definition, state, input, stageName, watchDriven = false) {
|
|
66
66
|
const stage = definition.stages[stageName];
|
|
67
67
|
events.push(stateDraft(state, input, { eventType: OrchestrationEventType.StageEntered, payload: { stage: stageName } }, events.length + 1), stateDraft(state, input, {
|
|
68
68
|
eventType: OrchestrationEventType.ActivityRequested,
|
|
69
69
|
payload: activation(state.workflowInstanceId, nextOrdinal(state), stage.activity, stage.with, {
|
|
70
70
|
execution: stage.execution,
|
|
71
71
|
stage: stageName,
|
|
72
|
+
watchDriven,
|
|
72
73
|
}),
|
|
73
74
|
}, events.length + 2));
|
|
74
75
|
}
|
|
75
76
|
// Shared by a route with no gate (target reached directly) and a resumed wait
|
|
76
77
|
// (target reached after an accepted signal); neither carries repeat counting.
|
|
77
|
-
export function resumeToTarget(events, definition, state, input, target) {
|
|
78
|
+
export function resumeToTarget(events, definition, state, input, target, watchDriven = false) {
|
|
78
79
|
if (target.kind === TransitionTargetKind.Complete) {
|
|
79
80
|
events.push(stateDraft(state, input, { eventType: OrchestrationEventType.InstanceCompleted, payload: {} }, events.length + 1));
|
|
80
81
|
return;
|
|
@@ -88,5 +89,5 @@ export function resumeToTarget(events, definition, state, input, target) {
|
|
|
88
89
|
}
|
|
89
90
|
if (target.kind === TransitionTargetKind.ResourceTransitionWait)
|
|
90
91
|
throw new Error('resource-transition wait must be resumed by a resource transition');
|
|
91
|
-
pushStageEntry(events, definition, state, input, target.stage);
|
|
92
|
+
pushStageEntry(events, definition, state, input, target.stage, watchDriven);
|
|
92
93
|
}
|
|
@@ -2,3 +2,11 @@ import type { CompiledStage } from '../contracts/config.js';
|
|
|
2
2
|
import type { StageName } from '../contracts/identifiers.js';
|
|
3
3
|
export declare function assertReachable(entry: StageName, stages: Readonly<Record<StageName, CompiledStage>>): void;
|
|
4
4
|
export declare function assertCyclesBounded(stages: Readonly<Record<StageName, CompiledStage>>): void;
|
|
5
|
+
/** Cost of a stage that cannot reach a terminal stage; finite so it survives JSON. */
|
|
6
|
+
export declare const UnreachableRemainingSteps: number;
|
|
7
|
+
/**
|
|
8
|
+
* Minimum number of agent-running stages from each stage to a terminal stage,
|
|
9
|
+
* counting the stage itself. Costs are non-negative, so loop-backs never lie on
|
|
10
|
+
* a shortest path. Stages with no path to completion get UnreachableRemainingSteps.
|
|
11
|
+
*/
|
|
12
|
+
export declare function remainingAgentSteps(stages: Readonly<Record<StageName, CompiledStage>>, isAgentActivity: (activity: CompiledStage['activity']) => boolean): Readonly<Record<StageName, number>>;
|
|
@@ -31,6 +31,47 @@ export function assertCyclesBounded(stages) {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
+
/** Cost of a stage that cannot reach a terminal stage; finite so it survives JSON. */
|
|
35
|
+
export const UnreachableRemainingSteps = Number.MAX_SAFE_INTEGER;
|
|
36
|
+
function routeTargets(stage) {
|
|
37
|
+
return Object.values(stage.on).flatMap((route) => [
|
|
38
|
+
route.target,
|
|
39
|
+
...(route.await === undefined ? [] : [route.await.resume]),
|
|
40
|
+
...(route.watchGates ?? []).map((gate) => gate.onRejectTarget),
|
|
41
|
+
...(route.resourceTransitions ?? []).map((transition) => transition.target),
|
|
42
|
+
]);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Minimum number of agent-running stages from each stage to a terminal stage,
|
|
46
|
+
* counting the stage itself. Costs are non-negative, so loop-backs never lie on
|
|
47
|
+
* a shortest path. Stages with no path to completion get UnreachableRemainingSteps.
|
|
48
|
+
*/
|
|
49
|
+
export function remainingAgentSteps(stages, isAgentActivity) {
|
|
50
|
+
const names = Object.keys(stages);
|
|
51
|
+
const cost = Object.fromEntries(names.map((name) => [name, UnreachableRemainingSteps]));
|
|
52
|
+
const targetCost = (target) => {
|
|
53
|
+
if (target.kind === TransitionTargetKind.Complete)
|
|
54
|
+
return 0;
|
|
55
|
+
if (target.kind === TransitionTargetKind.Stage)
|
|
56
|
+
return cost[target.stage];
|
|
57
|
+
return UnreachableRemainingSteps;
|
|
58
|
+
};
|
|
59
|
+
for (let changed = true; changed;) {
|
|
60
|
+
changed = false;
|
|
61
|
+
for (const name of names) {
|
|
62
|
+
const stage = stages[name];
|
|
63
|
+
const onward = Math.min(UnreachableRemainingSteps, ...routeTargets(stage).map(targetCost));
|
|
64
|
+
const next = onward >= UnreachableRemainingSteps
|
|
65
|
+
? UnreachableRemainingSteps
|
|
66
|
+
: onward + (isAgentActivity(stage.activity) ? 1 : 0);
|
|
67
|
+
if (next < cost[name]) {
|
|
68
|
+
cost[name] = next;
|
|
69
|
+
changed = true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return cost;
|
|
74
|
+
}
|
|
34
75
|
function canReach(stages, from, target) {
|
|
35
76
|
const seen = new Set();
|
|
36
77
|
const visit = (name) => {
|
|
@@ -213,6 +213,7 @@ function applyActivityRequested(state, payload) {
|
|
|
213
213
|
status: ActivityActivationStatus.Pending,
|
|
214
214
|
...(payload.followOnIndex === undefined ? {} : { followOnIndex: payload.followOnIndex }),
|
|
215
215
|
...(payload.supplemental === true ? { supplemental: true } : {}),
|
|
216
|
+
...(payload.watchDriven === true ? { watchDriven: true } : {}),
|
|
216
217
|
};
|
|
217
218
|
}
|
|
218
219
|
export function immutableWorkflowInstanceView(state) {
|
|
@@ -2,8 +2,10 @@ export * from './application/orchestration-projection.js';
|
|
|
2
2
|
export * from './application/orchestration-repository.js';
|
|
3
3
|
export * from './application/orchestration-service.js';
|
|
4
4
|
export * from './application/advance-workflow.js';
|
|
5
|
+
export * from './application/pending-activations.js';
|
|
5
6
|
export * from './application/durable-append.js';
|
|
6
7
|
export * from './application/pull-request-transition-evidence.js';
|
|
8
|
+
export { isPolicyBlockedMergeWait } from './application/policy-blocked-merge-recovery.js';
|
|
7
9
|
export * from './application/resource-transition-evidence.js';
|
|
8
10
|
export * from './application/resource-transition-matching.js';
|
|
9
11
|
export * from './application/resource-transition-reactor.js';
|
|
@@ -24,6 +26,7 @@ export * from './contracts/streams.js';
|
|
|
24
26
|
export * from './contracts/views.js';
|
|
25
27
|
export * from './contracts/vocabulary.js';
|
|
26
28
|
export * from './domain/compiler.js';
|
|
29
|
+
export * from './domain/dispatch-priority.js';
|
|
27
30
|
export * from './domain/interpreter.js';
|
|
28
31
|
export * from './domain/workflow-instance.js';
|
|
29
32
|
export * from './domain/workflow-selector.js';
|
|
@@ -2,8 +2,10 @@ export * from './application/orchestration-projection.js';
|
|
|
2
2
|
export * from './application/orchestration-repository.js';
|
|
3
3
|
export * from './application/orchestration-service.js';
|
|
4
4
|
export * from './application/advance-workflow.js';
|
|
5
|
+
export * from './application/pending-activations.js';
|
|
5
6
|
export * from './application/durable-append.js';
|
|
6
7
|
export * from './application/pull-request-transition-evidence.js';
|
|
8
|
+
export { isPolicyBlockedMergeWait } from './application/policy-blocked-merge-recovery.js';
|
|
7
9
|
export * from './application/resource-transition-evidence.js';
|
|
8
10
|
export * from './application/resource-transition-matching.js';
|
|
9
11
|
export * from './application/resource-transition-reactor.js';
|
|
@@ -24,6 +26,7 @@ export * from './contracts/streams.js';
|
|
|
24
26
|
export * from './contracts/views.js';
|
|
25
27
|
export * from './contracts/vocabulary.js';
|
|
26
28
|
export * from './domain/compiler.js';
|
|
29
|
+
export * from './domain/dispatch-priority.js';
|
|
27
30
|
export * from './domain/interpreter.js';
|
|
28
31
|
export * from './domain/workflow-instance.js';
|
|
29
32
|
export * from './domain/workflow-selector.js';
|