@atolis-hq/wake 0.4.57 → 0.4.59

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.
Files changed (35) hide show
  1. package/dist/src/activities/contracts/event-schema.d.ts +88 -0
  2. package/dist/src/activities/contracts/event-schema.js +9 -1
  3. package/dist/src/activities/index.d.ts +1 -0
  4. package/dist/src/activities/index.js +1 -0
  5. package/dist/src/activities/pr/activity-support.js +4 -0
  6. package/dist/src/activities/pr/contracts.d.ts +5 -0
  7. package/dist/src/activities/pr/merge-policy-denial.d.ts +19 -0
  8. package/dist/src/activities/pr/merge-policy-denial.js +32 -0
  9. package/dist/src/activities/pr/merge.d.ts +2 -0
  10. package/dist/src/activities/pr/merge.js +21 -3
  11. package/dist/src/activities/pr/policy.js +12 -3
  12. package/dist/src/bootstrap/integration-runtime.js +8 -0
  13. package/dist/src/bootstrap/surface-api-merge-policy.d.ts +19 -0
  14. package/dist/src/bootstrap/surface-api-merge-policy.js +52 -0
  15. package/dist/src/bootstrap/surface-api-work-applications.js +2 -1
  16. package/dist/src/bootstrap/version.js +1 -1
  17. package/dist/src/orchestration/application/orchestration-service.d.ts +2 -0
  18. package/dist/src/orchestration/application/orchestration-service.js +4 -0
  19. package/dist/src/orchestration/application/policy-blocked-merge-recovery.d.ts +7 -0
  20. package/dist/src/orchestration/application/policy-blocked-merge-recovery.js +54 -0
  21. package/dist/src/orchestration/application/pull-request-transition-evidence.js +11 -2
  22. package/dist/src/orchestration/application/resource-transition-evidence.d.ts +2 -0
  23. package/dist/src/orchestration/application/resource-transition-matching.d.ts +3 -1
  24. package/dist/src/orchestration/application/resource-transition-matching.js +3 -0
  25. package/dist/src/surfaces/api/contracts/orchestration.d.ts +13 -0
  26. package/dist/src/surfaces/api/presenters/merge-policy-block.d.ts +9 -0
  27. package/dist/src/surfaces/api/presenters/merge-policy-block.js +23 -0
  28. package/dist/src/surfaces/index.d.ts +1 -0
  29. package/dist/src/surfaces/index.js +1 -0
  30. package/dist/src/surfaces/web-assets/assets/index-CC1TIxyc.js +1131 -0
  31. package/dist/src/surfaces/web-assets/assets/index-EVgZ9q9N.css +1 -0
  32. package/dist/src/surfaces/web-assets/index.html +2 -2
  33. package/package.json +1 -1
  34. package/dist/src/surfaces/web-assets/assets/index-B5-ZKu_w.css +0 -1
  35. package/dist/src/surfaces/web-assets/assets/index-CNG6RzFJ.js +0 -1131
@@ -15,5 +15,7 @@ export interface ResourceTransitionMatch {
15
15
  export declare function matchResourceTransitions(loaded: readonly {
16
16
  readonly view: WorkflowInstanceView;
17
17
  }[], event: PersistedEvent): Promise<readonly ResourceTransitionMatch[]>;
18
- export declare function acceptResourceTransition(repository: OrchestrationRepository, workflows: StartWorkflow, id: WorkflowInstanceId, target: TransitionTarget, evidenceId: string, context: CommandContext): Promise<WorkflowInstanceView | null>;
18
+ export declare function acceptResourceTransition(repository: OrchestrationRepository, workflows: StartWorkflow, id: WorkflowInstanceId, target: TransitionTarget, evidenceId: string, context: CommandContext & {
19
+ readonly expectedSequence?: number;
20
+ }): Promise<WorkflowInstanceView | null>;
19
21
  export {};
@@ -55,6 +55,9 @@ export async function acceptResourceTransition(repository, workflows, id, target
55
55
  const loaded = await repository.load(id);
56
56
  if (loaded.view === null || loaded.view.waitingFor === undefined)
57
57
  return loaded.view;
58
+ if (context.expectedSequence !== undefined &&
59
+ (loaded.sequence !== context.expectedSequence || loaded.view.status !== WorkflowStatus.Waiting))
60
+ return loaded.view;
58
61
  const definition = await workflows.definitionForOperation(loaded.view, loaded.sequence, context);
59
62
  if (definition === null)
60
63
  return loaded.view;
@@ -10,7 +10,20 @@ export interface WorkflowInstanceResponse {
10
10
  readonly blockReason?: string;
11
11
  readonly retryEligible?: boolean;
12
12
  readonly extendEligible?: boolean;
13
+ readonly mergePolicyBlock?: MergePolicyBlockResponse;
13
14
  readonly waitingFor?: {
14
15
  readonly signalKind: string;
15
16
  };
16
17
  }
18
+ export interface MergePolicyBlockResponse {
19
+ readonly status: 'awaiting-human-merge' | 'recovering';
20
+ readonly explanation: string;
21
+ readonly nextAction: string;
22
+ readonly href?: string;
23
+ readonly policy?: {
24
+ readonly blockedPaths?: readonly string[] | undefined;
25
+ readonly matchedPaths?: readonly string[] | undefined;
26
+ readonly maxFilesChanged?: number | undefined;
27
+ readonly filesChanged?: number | undefined;
28
+ };
29
+ }
@@ -0,0 +1,9 @@
1
+ import { type MergePolicyDetails, type PullRequestView } from '../../../activities/index.js';
2
+ import { type WorkflowInstanceView } from '../../../orchestration/index.js';
3
+ import type { MergePolicyBlockResponse } from '../contracts/orchestration.js';
4
+ export declare function presentMergePolicyBlock(input: {
5
+ readonly workflow: WorkflowInstanceView;
6
+ readonly pullRequest: PullRequestView;
7
+ readonly href?: string | undefined;
8
+ readonly policy?: MergePolicyDetails | undefined;
9
+ }): MergePolicyBlockResponse | undefined;
@@ -0,0 +1,23 @@
1
+ import { PullRequestDenialCode, PullRequestState, readMergePolicyDenial, } from '../../../activities/index.js';
2
+ import { WorkflowStatus } from '../../../orchestration/index.js';
3
+ export function presentMergePolicyBlock(input) {
4
+ const denial = readMergePolicyDenial(input.workflow.lastOutcome);
5
+ if (denial === null || input.workflow.status !== WorkflowStatus.Waiting)
6
+ return undefined;
7
+ const policy = denial.policy ?? input.policy;
8
+ const merged = input.pullRequest.state === PullRequestState.Merged;
9
+ const explanation = denial.reason === PullRequestDenialCode.BlockedPathChanged
10
+ ? 'Automatic merge stopped because this PR changes a protected path.'
11
+ : denial.reason === PullRequestDenialCode.TooManyFilesChanged
12
+ ? 'Automatic merge stopped because this PR exceeds the configured file-count limit.'
13
+ : 'Automatic merge stopped because changed-file evidence required by policy is unavailable.';
14
+ return {
15
+ status: merged ? 'recovering' : 'awaiting-human-merge',
16
+ explanation,
17
+ nextAction: merged
18
+ ? 'The PR has merged. Normal control-plane advancement will check the durable evidence and continue the configured completion flow.'
19
+ : 'Review and merge the correlated PR manually. Wake will observe the merge and continue. Approval or a comment only retries automation and does not override this policy.',
20
+ ...(input.href === undefined ? {} : { href: input.href }),
21
+ ...(policy === undefined ? {} : { policy }),
22
+ };
23
+ }
@@ -49,3 +49,4 @@ export * from './mcp/stdio.js';
49
49
  export * from './contracts/config.js';
50
50
  export * from './web-host/asset-source.js';
51
51
  export * from './web-host/packaged-assets.js';
52
+ export * from './api/presenters/merge-policy-block.js';
@@ -49,3 +49,4 @@ export * from './mcp/stdio.js';
49
49
  export * from './contracts/config.js';
50
50
  export * from './web-host/asset-source.js';
51
51
  export * from './web-host/packaged-assets.js';
52
+ export * from './api/presenters/merge-policy-block.js';