@atolis-hq/wake 0.4.80 → 0.4.82

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 (43) hide show
  1. package/dist/src/activities/contracts/event-schema.d.ts +30 -8
  2. package/dist/src/activities/contracts/event-schema.js +1 -0
  3. package/dist/src/activities/pr/activity-support.js +1 -0
  4. package/dist/src/activities/pr/policy.js +1 -1
  5. package/dist/src/activities/pr/vocabulary.d.ts +1 -0
  6. package/dist/src/activities/pr/vocabulary.js +1 -0
  7. package/dist/src/bootstrap/config/root-schema.d.ts +10 -0
  8. package/dist/src/bootstrap/integration-runtime.js +7 -1
  9. package/dist/src/bootstrap/surface-api-trigger-applications.js +1 -1
  10. package/dist/src/bootstrap/version.js +1 -1
  11. package/dist/src/control-plane/application/activation-scheduler.js +3 -0
  12. package/dist/src/control-plane/application/trigger-diagnostics.d.ts +1 -1
  13. package/dist/src/control-plane/application/trigger-diagnostics.js +6 -3
  14. package/dist/src/control-plane/application/trigger-inspection.d.ts +2 -0
  15. package/dist/src/control-plane/application/trigger-manual-request.js +6 -17
  16. package/dist/src/control-plane/application/trigger-pending.d.ts +16 -0
  17. package/dist/src/control-plane/application/trigger-pending.js +58 -0
  18. package/dist/src/control-plane/application/trigger-projection.d.ts +3 -0
  19. package/dist/src/control-plane/application/trigger-projection.js +72 -12
  20. package/dist/src/control-plane/application/trigger-recovery.js +1 -1
  21. package/dist/src/control-plane/application/trigger-service.js +10 -28
  22. package/dist/src/integrations/delivery/application/delivery-service.js +14 -3
  23. package/dist/src/integrations/delivery/application/merged-delivery-evidence.d.ts +12 -0
  24. package/dist/src/integrations/delivery/application/merged-delivery-evidence.js +67 -0
  25. package/dist/src/integrations/fake/durable-delivery-provider.d.ts +7 -0
  26. package/dist/src/integrations/fake/durable-delivery-provider.js +9 -0
  27. package/dist/src/integrations/github/infrastructure/delivery.d.ts +1 -1
  28. package/dist/src/integrations/github/infrastructure/delivery.js +26 -1
  29. package/dist/src/integrations/github/provider.js +12 -0
  30. package/dist/src/integrations/index.d.ts +1 -0
  31. package/dist/src/integrations/index.js +1 -0
  32. package/dist/src/orchestration/contracts/config.d.ts +15 -0
  33. package/dist/src/orchestration/contracts/config.js +15 -2
  34. package/dist/src/orchestration/contracts/event-decoder.d.ts +1 -0
  35. package/dist/src/orchestration/contracts/event-decoder.js +1 -0
  36. package/dist/src/orchestration/contracts/events.d.ts +1 -0
  37. package/dist/src/orchestration/contracts/views.d.ts +1 -0
  38. package/dist/src/orchestration/domain/retry-policy.js +17 -4
  39. package/dist/src/orchestration/domain/workflow-instance-events.js +1 -0
  40. package/dist/src/surfaces/api/contracts/triggers.d.ts +1 -1
  41. package/dist/src/surfaces/web-assets/assets/{index-QnREfUBG.js → index-BuVkTveW.js} +2 -2
  42. package/dist/src/surfaces/web-assets/index.html +1 -1
  43. package/package.json +1 -1
@@ -45,6 +45,7 @@ export declare const deniedOutcomeSchema: z.ZodObject<{
45
45
  "correlation-conflict": "correlation-conflict";
46
46
  "stale-approval": "stale-approval";
47
47
  "checks-pending": "checks-pending";
48
+ "checks-could-not-be-read": "checks-could-not-be-read";
48
49
  "checks-failing": "checks-failing";
49
50
  "untrusted-actor": "untrusted-actor";
50
51
  "too-many-files-changed": "too-many-files-changed";
@@ -348,6 +349,7 @@ export declare function createResourceFactDraftSchemas(eventTypes: ActivityEvent
348
349
  "correlation-conflict": "correlation-conflict";
349
350
  "stale-approval": "stale-approval";
350
351
  "checks-pending": "checks-pending";
352
+ "checks-could-not-be-read": "checks-could-not-be-read";
351
353
  "checks-failing": "checks-failing";
352
354
  "untrusted-actor": "untrusted-actor";
353
355
  "too-many-files-changed": "too-many-files-changed";
@@ -483,6 +485,7 @@ export declare function createDenialDraftSchemas(eventTypes: ActivityEventTypes)
483
485
  "correlation-conflict": "correlation-conflict";
484
486
  "stale-approval": "stale-approval";
485
487
  "checks-pending": "checks-pending";
488
+ "checks-could-not-be-read": "checks-could-not-be-read";
486
489
  "checks-failing": "checks-failing";
487
490
  "untrusted-actor": "untrusted-actor";
488
491
  "too-many-files-changed": "too-many-files-changed";
@@ -538,6 +541,7 @@ export declare function createDenialDraftSchemas(eventTypes: ActivityEventTypes)
538
541
  "correlation-conflict": "correlation-conflict";
539
542
  "stale-approval": "stale-approval";
540
543
  "checks-pending": "checks-pending";
544
+ "checks-could-not-be-read": "checks-could-not-be-read";
541
545
  "checks-failing": "checks-failing";
542
546
  "untrusted-actor": "untrusted-actor";
543
547
  "too-many-files-changed": "too-many-files-changed";
@@ -853,6 +857,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
853
857
  "correlation-conflict": "correlation-conflict";
854
858
  "stale-approval": "stale-approval";
855
859
  "checks-pending": "checks-pending";
860
+ "checks-could-not-be-read": "checks-could-not-be-read";
856
861
  "checks-failing": "checks-failing";
857
862
  "untrusted-actor": "untrusted-actor";
858
863
  "too-many-files-changed": "too-many-files-changed";
@@ -996,6 +1001,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
996
1001
  "correlation-conflict": "correlation-conflict";
997
1002
  "stale-approval": "stale-approval";
998
1003
  "checks-pending": "checks-pending";
1004
+ "checks-could-not-be-read": "checks-could-not-be-read";
999
1005
  "checks-failing": "checks-failing";
1000
1006
  "untrusted-actor": "untrusted-actor";
1001
1007
  "too-many-files-changed": "too-many-files-changed";
@@ -1051,6 +1057,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
1051
1057
  "correlation-conflict": "correlation-conflict";
1052
1058
  "stale-approval": "stale-approval";
1053
1059
  "checks-pending": "checks-pending";
1060
+ "checks-could-not-be-read": "checks-could-not-be-read";
1054
1061
  "checks-failing": "checks-failing";
1055
1062
  "untrusted-actor": "untrusted-actor";
1056
1063
  "too-many-files-changed": "too-many-files-changed";
@@ -1169,6 +1176,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
1169
1176
  "correlation-conflict": "correlation-conflict";
1170
1177
  "stale-approval": "stale-approval";
1171
1178
  "checks-pending": "checks-pending";
1179
+ "checks-could-not-be-read": "checks-could-not-be-read";
1172
1180
  "checks-failing": "checks-failing";
1173
1181
  "untrusted-actor": "untrusted-actor";
1174
1182
  "too-many-files-changed": "too-many-files-changed";
@@ -1218,6 +1226,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
1218
1226
  "correlation-conflict": "correlation-conflict";
1219
1227
  "stale-approval": "stale-approval";
1220
1228
  "checks-pending": "checks-pending";
1229
+ "checks-could-not-be-read": "checks-could-not-be-read";
1221
1230
  "checks-failing": "checks-failing";
1222
1231
  "untrusted-actor": "untrusted-actor";
1223
1232
  "too-many-files-changed": "too-many-files-changed";
@@ -1381,6 +1390,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
1381
1390
  "correlation-conflict": "correlation-conflict";
1382
1391
  "stale-approval": "stale-approval";
1383
1392
  "checks-pending": "checks-pending";
1393
+ "checks-could-not-be-read": "checks-could-not-be-read";
1384
1394
  "checks-failing": "checks-failing";
1385
1395
  "untrusted-actor": "untrusted-actor";
1386
1396
  "too-many-files-changed": "too-many-files-changed";
@@ -1430,6 +1440,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
1430
1440
  "correlation-conflict": "correlation-conflict";
1431
1441
  "stale-approval": "stale-approval";
1432
1442
  "checks-pending": "checks-pending";
1443
+ "checks-could-not-be-read": "checks-could-not-be-read";
1433
1444
  "checks-failing": "checks-failing";
1434
1445
  "untrusted-actor": "untrusted-actor";
1435
1446
  "too-many-files-changed": "too-many-files-changed";
@@ -1473,7 +1484,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
1473
1484
  payload: {
1474
1485
  activationId: import("./identifiers.js").ActivationId;
1475
1486
  idempotencyKey: string;
1476
- reason: "closed" | "missing-resource" | "ambiguous-resource" | "correlation-conflict" | "stale-approval" | "checks-pending" | "checks-failing" | "untrusted-actor" | "too-many-files-changed" | "blocked-path-changed" | "changed-files-unavailable";
1487
+ reason: "closed" | "missing-resource" | "ambiguous-resource" | "correlation-conflict" | "stale-approval" | "checks-pending" | "checks-could-not-be-read" | "checks-failing" | "untrusted-actor" | "too-many-files-changed" | "blocked-path-changed" | "changed-files-unavailable";
1477
1488
  target?: "primary" | {
1478
1489
  resourceId: import("../../resources/index.js").ResourceId;
1479
1490
  } | undefined;
@@ -1500,7 +1511,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
1500
1511
  outcome: {
1501
1512
  kind: "blocked";
1502
1513
  data: {
1503
- reason: "closed" | "missing-resource" | "ambiguous-resource" | "correlation-conflict" | "stale-approval" | "checks-pending" | "checks-failing" | "untrusted-actor" | "too-many-files-changed" | "blocked-path-changed" | "changed-files-unavailable";
1514
+ reason: "closed" | "missing-resource" | "ambiguous-resource" | "correlation-conflict" | "stale-approval" | "checks-pending" | "checks-could-not-be-read" | "checks-failing" | "untrusted-actor" | "too-many-files-changed" | "blocked-path-changed" | "changed-files-unavailable";
1504
1515
  resourceId?: string | undefined;
1505
1516
  revision?: string | undefined;
1506
1517
  policy?: {
@@ -1518,7 +1529,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
1518
1529
  outcome: {
1519
1530
  kind: "blocked";
1520
1531
  data: {
1521
- reason: "closed" | "missing-resource" | "ambiguous-resource" | "correlation-conflict" | "stale-approval" | "checks-pending" | "checks-failing" | "untrusted-actor" | "too-many-files-changed" | "blocked-path-changed" | "changed-files-unavailable";
1532
+ reason: "closed" | "missing-resource" | "ambiguous-resource" | "correlation-conflict" | "stale-approval" | "checks-pending" | "checks-could-not-be-read" | "checks-failing" | "untrusted-actor" | "too-many-files-changed" | "blocked-path-changed" | "changed-files-unavailable";
1522
1533
  resourceId?: string | undefined;
1523
1534
  revision?: string | undefined;
1524
1535
  policy?: {
@@ -1547,7 +1558,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
1547
1558
  payload: {
1548
1559
  activationId: import("./identifiers.js").ActivationId;
1549
1560
  idempotencyKey: string;
1550
- reason: "closed" | "missing-resource" | "ambiguous-resource" | "correlation-conflict" | "stale-approval" | "checks-pending" | "checks-failing" | "untrusted-actor" | "too-many-files-changed" | "blocked-path-changed" | "changed-files-unavailable";
1561
+ reason: "closed" | "missing-resource" | "ambiguous-resource" | "correlation-conflict" | "stale-approval" | "checks-pending" | "checks-could-not-be-read" | "checks-failing" | "untrusted-actor" | "too-many-files-changed" | "blocked-path-changed" | "changed-files-unavailable";
1551
1562
  target?: "primary" | {
1552
1563
  resourceId: import("../../resources/index.js").ResourceId;
1553
1564
  } | undefined;
@@ -1668,6 +1679,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
1668
1679
  "correlation-conflict": "correlation-conflict";
1669
1680
  "stale-approval": "stale-approval";
1670
1681
  "checks-pending": "checks-pending";
1682
+ "checks-could-not-be-read": "checks-could-not-be-read";
1671
1683
  "checks-failing": "checks-failing";
1672
1684
  "untrusted-actor": "untrusted-actor";
1673
1685
  "too-many-files-changed": "too-many-files-changed";
@@ -1717,6 +1729,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
1717
1729
  "correlation-conflict": "correlation-conflict";
1718
1730
  "stale-approval": "stale-approval";
1719
1731
  "checks-pending": "checks-pending";
1732
+ "checks-could-not-be-read": "checks-could-not-be-read";
1720
1733
  "checks-failing": "checks-failing";
1721
1734
  "untrusted-actor": "untrusted-actor";
1722
1735
  "too-many-files-changed": "too-many-files-changed";
@@ -1890,6 +1903,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
1890
1903
  "correlation-conflict": "correlation-conflict";
1891
1904
  "stale-approval": "stale-approval";
1892
1905
  "checks-pending": "checks-pending";
1906
+ "checks-could-not-be-read": "checks-could-not-be-read";
1893
1907
  "checks-failing": "checks-failing";
1894
1908
  "untrusted-actor": "untrusted-actor";
1895
1909
  "too-many-files-changed": "too-many-files-changed";
@@ -1939,6 +1953,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
1939
1953
  "correlation-conflict": "correlation-conflict";
1940
1954
  "stale-approval": "stale-approval";
1941
1955
  "checks-pending": "checks-pending";
1956
+ "checks-could-not-be-read": "checks-could-not-be-read";
1942
1957
  "checks-failing": "checks-failing";
1943
1958
  "untrusted-actor": "untrusted-actor";
1944
1959
  "too-many-files-changed": "too-many-files-changed";
@@ -1982,7 +1997,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
1982
1997
  payload: {
1983
1998
  activationId: import("./identifiers.js").ActivationId;
1984
1999
  idempotencyKey: string;
1985
- reason: "closed" | "missing-resource" | "ambiguous-resource" | "correlation-conflict" | "stale-approval" | "checks-pending" | "checks-failing" | "untrusted-actor" | "too-many-files-changed" | "blocked-path-changed" | "changed-files-unavailable";
2000
+ reason: "closed" | "missing-resource" | "ambiguous-resource" | "correlation-conflict" | "stale-approval" | "checks-pending" | "checks-could-not-be-read" | "checks-failing" | "untrusted-actor" | "too-many-files-changed" | "blocked-path-changed" | "changed-files-unavailable";
1986
2001
  target?: "primary" | {
1987
2002
  resourceId: import("../../resources/index.js").ResourceId;
1988
2003
  } | undefined;
@@ -2009,7 +2024,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
2009
2024
  outcome: {
2010
2025
  kind: "blocked";
2011
2026
  data: {
2012
- reason: "closed" | "missing-resource" | "ambiguous-resource" | "correlation-conflict" | "stale-approval" | "checks-pending" | "checks-failing" | "untrusted-actor" | "too-many-files-changed" | "blocked-path-changed" | "changed-files-unavailable";
2027
+ reason: "closed" | "missing-resource" | "ambiguous-resource" | "correlation-conflict" | "stale-approval" | "checks-pending" | "checks-could-not-be-read" | "checks-failing" | "untrusted-actor" | "too-many-files-changed" | "blocked-path-changed" | "changed-files-unavailable";
2013
2028
  resourceId?: string | undefined;
2014
2029
  revision?: string | undefined;
2015
2030
  policy?: {
@@ -2027,7 +2042,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
2027
2042
  outcome: {
2028
2043
  kind: "blocked";
2029
2044
  data: {
2030
- reason: "closed" | "missing-resource" | "ambiguous-resource" | "correlation-conflict" | "stale-approval" | "checks-pending" | "checks-failing" | "untrusted-actor" | "too-many-files-changed" | "blocked-path-changed" | "changed-files-unavailable";
2045
+ reason: "closed" | "missing-resource" | "ambiguous-resource" | "correlation-conflict" | "stale-approval" | "checks-pending" | "checks-could-not-be-read" | "checks-failing" | "untrusted-actor" | "too-many-files-changed" | "blocked-path-changed" | "changed-files-unavailable";
2031
2046
  resourceId?: string | undefined;
2032
2047
  revision?: string | undefined;
2033
2048
  policy?: {
@@ -2056,7 +2071,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
2056
2071
  payload: {
2057
2072
  activationId: import("./identifiers.js").ActivationId;
2058
2073
  idempotencyKey: string;
2059
- reason: "closed" | "missing-resource" | "ambiguous-resource" | "correlation-conflict" | "stale-approval" | "checks-pending" | "checks-failing" | "untrusted-actor" | "too-many-files-changed" | "blocked-path-changed" | "changed-files-unavailable";
2074
+ reason: "closed" | "missing-resource" | "ambiguous-resource" | "correlation-conflict" | "stale-approval" | "checks-pending" | "checks-could-not-be-read" | "checks-failing" | "untrusted-actor" | "too-many-files-changed" | "blocked-path-changed" | "changed-files-unavailable";
2060
2075
  target?: "primary" | {
2061
2076
  resourceId: import("../../resources/index.js").ResourceId;
2062
2077
  } | undefined;
@@ -2371,6 +2386,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
2371
2386
  "correlation-conflict": "correlation-conflict";
2372
2387
  "stale-approval": "stale-approval";
2373
2388
  "checks-pending": "checks-pending";
2389
+ "checks-could-not-be-read": "checks-could-not-be-read";
2374
2390
  "checks-failing": "checks-failing";
2375
2391
  "untrusted-actor": "untrusted-actor";
2376
2392
  "too-many-files-changed": "too-many-files-changed";
@@ -2505,6 +2521,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
2505
2521
  "correlation-conflict": "correlation-conflict";
2506
2522
  "stale-approval": "stale-approval";
2507
2523
  "checks-pending": "checks-pending";
2524
+ "checks-could-not-be-read": "checks-could-not-be-read";
2508
2525
  "checks-failing": "checks-failing";
2509
2526
  "untrusted-actor": "untrusted-actor";
2510
2527
  "too-many-files-changed": "too-many-files-changed";
@@ -2560,6 +2577,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
2560
2577
  "correlation-conflict": "correlation-conflict";
2561
2578
  "stale-approval": "stale-approval";
2562
2579
  "checks-pending": "checks-pending";
2580
+ "checks-could-not-be-read": "checks-could-not-be-read";
2563
2581
  "checks-failing": "checks-failing";
2564
2582
  "untrusted-actor": "untrusted-actor";
2565
2583
  "too-many-files-changed": "too-many-files-changed";
@@ -2666,6 +2684,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
2666
2684
  "correlation-conflict": "correlation-conflict";
2667
2685
  "stale-approval": "stale-approval";
2668
2686
  "checks-pending": "checks-pending";
2687
+ "checks-could-not-be-read": "checks-could-not-be-read";
2669
2688
  "checks-failing": "checks-failing";
2670
2689
  "untrusted-actor": "untrusted-actor";
2671
2690
  "too-many-files-changed": "too-many-files-changed";
@@ -2715,6 +2734,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
2715
2734
  "correlation-conflict": "correlation-conflict";
2716
2735
  "stale-approval": "stale-approval";
2717
2736
  "checks-pending": "checks-pending";
2737
+ "checks-could-not-be-read": "checks-could-not-be-read";
2718
2738
  "checks-failing": "checks-failing";
2719
2739
  "untrusted-actor": "untrusted-actor";
2720
2740
  "too-many-files-changed": "too-many-files-changed";
@@ -2836,6 +2856,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
2836
2856
  "correlation-conflict": "correlation-conflict";
2837
2857
  "stale-approval": "stale-approval";
2838
2858
  "checks-pending": "checks-pending";
2859
+ "checks-could-not-be-read": "checks-could-not-be-read";
2839
2860
  "checks-failing": "checks-failing";
2840
2861
  "untrusted-actor": "untrusted-actor";
2841
2862
  "too-many-files-changed": "too-many-files-changed";
@@ -2885,6 +2906,7 @@ export declare function createActivityEventSchemas(eventTypes: ActivityEventType
2885
2906
  "correlation-conflict": "correlation-conflict";
2886
2907
  "stale-approval": "stale-approval";
2887
2908
  "checks-pending": "checks-pending";
2909
+ "checks-could-not-be-read": "checks-could-not-be-read";
2888
2910
  "checks-failing": "checks-failing";
2889
2911
  "untrusted-actor": "untrusted-actor";
2890
2912
  "too-many-files-changed": "too-many-files-changed";
@@ -53,6 +53,7 @@ const denialCodeSchema = z.enum([
53
53
  PullRequestDenialCode.Closed,
54
54
  PullRequestDenialCode.StaleApproval,
55
55
  PullRequestDenialCode.ChecksPending,
56
+ PullRequestDenialCode.ChecksUnavailable,
56
57
  PullRequestDenialCode.ChecksFailing,
57
58
  PullRequestDenialCode.UntrustedActor,
58
59
  PullRequestDenialCode.TooManyFilesChanged,
@@ -40,6 +40,7 @@ export const pullRequestOutcomeSchema = z.union([
40
40
  PullRequestDenialCode.Closed,
41
41
  PullRequestDenialCode.StaleApproval,
42
42
  PullRequestDenialCode.ChecksPending,
43
+ PullRequestDenialCode.ChecksUnavailable,
43
44
  PullRequestDenialCode.ChecksFailing,
44
45
  PullRequestDenialCode.UntrustedActor,
45
46
  PullRequestDenialCode.TooManyFilesChanged,
@@ -139,7 +139,7 @@ function changedFilesAuthority(pullRequest, resource, policy) {
139
139
  }
140
140
  function checkAuthority(pullRequest, allowPendingChecks) {
141
141
  if (pullRequest.checks === PullRequestCheckState.Unknown)
142
- return denied(PullRequestDenialCode.ChecksPending);
142
+ return denied(PullRequestDenialCode.ChecksUnavailable);
143
143
  if (pullRequest.checks === PullRequestCheckState.Pending && !allowPendingChecks)
144
144
  return denied(PullRequestDenialCode.ChecksPending);
145
145
  return pullRequest.checks === PullRequestCheckState.Failing
@@ -31,6 +31,7 @@ export declare const PullRequestDenialCode: {
31
31
  readonly Closed: "closed";
32
32
  readonly StaleApproval: "stale-approval";
33
33
  readonly ChecksPending: "checks-pending";
34
+ readonly ChecksUnavailable: "checks-could-not-be-read";
34
35
  readonly ChecksFailing: "checks-failing";
35
36
  readonly UntrustedActor: "untrusted-actor";
36
37
  readonly TooManyFilesChanged: "too-many-files-changed";
@@ -27,6 +27,7 @@ export const PullRequestDenialCode = defineClosedVocabulary({
27
27
  Closed: 'closed',
28
28
  StaleApproval: 'stale-approval',
29
29
  ChecksPending: 'checks-pending',
30
+ ChecksUnavailable: 'checks-could-not-be-read',
30
31
  ChecksFailing: 'checks-failing',
31
32
  UntrustedActor: 'untrusted-actor',
32
33
  TooManyFilesChanged: 'too-many-files-changed',
@@ -63,6 +63,11 @@ declare const orchestrationConfigSchema: z.ZodDefault<z.ZodObject<{
63
63
  }, z.core.$strict>>;
64
64
  retry: z.ZodOptional<z.ZodObject<{
65
65
  max: z.ZodNumber;
66
+ reasons: z.ZodOptional<z.ZodArray<z.ZodEnum<{
67
+ "checks-pending": "checks-pending";
68
+ "checks-could-not-be-read": "checks-could-not-be-read";
69
+ }>>>;
70
+ delaysMs: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
66
71
  }, z.core.$strict>>;
67
72
  await: z.ZodOptional<z.ZodObject<{
68
73
  signal: z.ZodString;
@@ -219,6 +224,11 @@ export declare const rootConfigSchema: z.ZodObject<{
219
224
  }, z.core.$strict>>;
220
225
  retry: z.ZodOptional<z.ZodObject<{
221
226
  max: z.ZodNumber;
227
+ reasons: z.ZodOptional<z.ZodArray<z.ZodEnum<{
228
+ "checks-pending": "checks-pending";
229
+ "checks-could-not-be-read": "checks-could-not-be-read";
230
+ }>>>;
231
+ delaysMs: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
222
232
  }, z.core.$strict>>;
223
233
  await: z.ZodOptional<z.ZodObject<{
224
234
  signal: z.ZodString;
@@ -6,7 +6,7 @@ import { ActivityExecutionKind, activityName, } from '../activities/index.js';
6
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
- import { AgentRunPublicationReactor, ArtifactRegistrationReactor, DeliveryOutcomeReactor, DeliveryService, IntegrationStreamKind, PollService, ProviderRegistry, deliveryProjectionDefinitions, fakeProviderDefinition, publishConversationCommandFeedback, } from '../integrations/index.js';
9
+ import { AgentRunPublicationReactor, ArtifactRegistrationReactor, DeliveryOutcomeReactor, DeliveryService, IntegrationStreamKind, PollService, ProviderRegistry, deliveryProjectionDefinitions, fakeProviderDefinition, publishConversationCommandFeedback, reconcileMergedDeliveries, } from '../integrations/index.js';
10
10
  import { compileWorkflowSelectors, createConversationCommandReactor, createPullRequestTransitionEvidence, createResourceTransitionReactor, createWatchReactor, createWatchReconciler, isWorkflowInstanceStream, selectWorkflow, workflowInstanceId, workflowName, } from '../orchestration/index.js';
11
11
  import { BuiltInResourceCapability, resourceId, } from '../resources/index.js';
12
12
  import { isWorkItemStream } from '../work/index.js';
@@ -273,6 +273,12 @@ export async function composeIntegrationRuntime(input) {
273
273
  await recoverMergedWaits();
274
274
  await watchReconciler.reconcileOnce();
275
275
  await artifacts.reconcileOnce();
276
+ await reconcileMergedDeliveries({
277
+ journal: input.journal,
278
+ projections: input.projections,
279
+ orchestration: input.orchestration,
280
+ pullRequests: input.pullRequests,
281
+ });
276
282
  await outcomes.reconcileOnce();
277
283
  for (const provider of providers) {
278
284
  await provider.reconciler?.reconcileOnce();
@@ -62,7 +62,7 @@ export function createTriggerApplications(root, now) {
62
62
  : new CronTriggerPolicy().nextOccurrence(definition.on.cron, asOf),
63
63
  pending: Object.values(view.coalesced)
64
64
  .filter((entry) => entry.coordinationKey === coordinationKey)
65
- .map((entry) => ({
65
+ .map(({ manualRequests: _manual, automaticRequests: _automatic, ...entry }) => ({
66
66
  ...entry,
67
67
  activeWorkItemId: activeInvocation?.activeWorkItemId ?? null,
68
68
  })),
@@ -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.80";
127
+ export const wakeVersion = "v0.4.82";
128
128
  /** The registry-installable version used by packaged sandbox images. */
129
129
  export const wakePackageVersion = packageVersion(defaultRepoRoot) ?? wakeVersion;
@@ -91,6 +91,9 @@ export function createActivationScheduler(orchestration, execution, resources, c
91
91
  }
92
92
  const rawPending = await orchestration.listPendingActivations(options.workItemId);
93
93
  const pending = (await Promise.all(rawPending.map(async (candidate) => {
94
+ if (candidate.activation.notBefore !== undefined &&
95
+ Date.parse(candidate.activation.notBefore) > clock.now().getTime())
96
+ return null;
94
97
  const work = await dependencies.work?.get(candidate.workflow.workItemId);
95
98
  return work?.frozen || work?.deleted ? null : candidate;
96
99
  }))).filter((candidate) => candidate !== null);
@@ -32,6 +32,6 @@ export declare class TriggerDiagnostics {
32
32
  reason: "paused" | "own-scope" | "removed" | "dispatch-paused" | "capacity-unavailable" | "pending-source-limit";
33
33
  }[]>;
34
34
  record(triggerId: string, source: TriggerSource, reason: SkipReason): Promise<void>;
35
- ineligibleReason(view: TriggerView, id: string, config: TriggerConfig | undefined, configured: boolean, active?: boolean): Promise<SkipReason | undefined>;
35
+ ineligibleReason(view: TriggerView, id: string, config: TriggerConfig | undefined, configured: boolean, active?: boolean, manual?: boolean): Promise<SkipReason | undefined>;
36
36
  }
37
37
  export {};
@@ -22,17 +22,20 @@ export class TriggerDiagnostics {
22
22
  ].slice(-maximumTriggerDiagnostics),
23
23
  });
24
24
  }
25
- async ineligibleReason(view, id, config, configured, active = false) {
26
- if (view.pauses[id] !== undefined)
25
+ async ineligibleReason(view, id, config, configured, active = false, manual = false) {
26
+ if (!manual && view.pauses[id] !== undefined)
27
27
  return TriggerSkipReason.Paused;
28
28
  if (config === undefined || !configured)
29
29
  return TriggerSkipReason.Removed;
30
30
  if (await this.dependencies.isDispatchPaused())
31
31
  return TriggerSkipReason.DispatchPaused;
32
32
  if (!active &&
33
- config.when?.capacityAvailable === true &&
33
+ requiresCapacity(config, manual) &&
34
34
  !(await this.dependencies.capacityAvailable(config)))
35
35
  return TriggerSkipReason.Capacity;
36
36
  return undefined;
37
37
  }
38
38
  }
39
+ function requiresCapacity(config, manual) {
40
+ return manual || config.when?.capacityAvailable === true;
41
+ }
@@ -28,5 +28,7 @@ export declare function inspectTriggers(view: TriggerView, invocations: readonly
28
28
  requests: readonly import("../index.js").ControlEventPayloads["control-plane.trigger-request-recorded"][];
29
29
  coalesced: Readonly<Record<string, import("../index.js").ControlEventPayloads["control-plane.trigger-request-recorded"] & {
30
30
  readonly sources: readonly import("../index.js").TriggerSource[];
31
+ readonly manualRequests: readonly import("../index.js").ControlEventPayloads["control-plane.trigger-request-recorded"][];
32
+ readonly automaticRequests: readonly import("../index.js").ControlEventPayloads["control-plane.trigger-request-recorded"][];
31
33
  }>>;
32
34
  };
@@ -1,6 +1,6 @@
1
1
  import { ControlEventType, ManualTriggerDisposition, selectControlEvent, TriggerRequestDisposition, TriggerSourceKind, } from '../contracts/events.js';
2
2
  import { TriggerSkipReason } from '../contracts/trigger-diagnostics.js';
3
- import { consumedTriggerRequest, sourceIdentity } from './trigger-facts.js';
3
+ import { sourceIdentity } from './trigger-facts.js';
4
4
  import { maximumTriggerSources } from './trigger-projection.js';
5
5
  import { hasActiveInvocation } from './trigger-rules.js';
6
6
  export async function requestManualTrigger(ports, triggerId, context) {
@@ -17,7 +17,7 @@ export async function requestManualTrigger(ports, triggerId, context) {
17
17
  const view = await ports.view();
18
18
  const config = ports.config;
19
19
  const active = hasActiveInvocation(view, coordinationKey);
20
- const reason = (await ports.diagnostics.ineligibleReason(view, triggerId, config, config !== undefined, active)) ??
20
+ const reason = (await ports.diagnostics.ineligibleReason(view, triggerId, config, config !== undefined, active, true)) ??
21
21
  ((view.coalesced[coordinationKey]?.sources.length ?? 0) >= maximumTriggerSources
22
22
  ? TriggerSkipReason.PendingLimit
23
23
  : undefined);
@@ -55,7 +55,6 @@ async function recoverManualOutcome(ports, triggerId, context) {
55
55
  // Command identity survives changes to the configured coordination scope.
56
56
  let position = 0;
57
57
  let request;
58
- let pauseCleared = false;
59
58
  const latest = await ports.dependencies.journal.latestGlobalPosition();
60
59
  while (position < latest) {
61
60
  const batch = await ports.dependencies.journal.readAll(position, 256);
@@ -64,15 +63,12 @@ async function recoverManualOutcome(ports, triggerId, context) {
64
63
  for (const envelope of batch) {
65
64
  const event = selectControlEvent(envelope);
66
65
  request = matchingManualRequest(event, triggerId, context.commandId) ?? request;
67
- if (event?.event.eventType === ControlEventType.TriggerPaused &&
68
- event.event.payload.coordinationKey === request?.coordinationKey)
69
- pauseCleared = true;
70
66
  position = envelope.globalPosition;
71
67
  }
72
68
  }
73
- return resolvePausedRequest(ports, request, pauseCleared, context);
69
+ return resolveManualRequest(ports, request, context);
74
70
  }
75
- async function resolvePausedRequest(ports, request, pauseCleared, context) {
71
+ async function resolveManualRequest(ports, request, context) {
76
72
  if (request?.manualOutcome === undefined)
77
73
  return undefined;
78
74
  if (settledManualOutcome(request.manualOutcome))
@@ -80,8 +76,7 @@ async function resolvePausedRequest(ports, request, pauseCleared, context) {
80
76
  const history = await ports.dependencies.history();
81
77
  const invocation = history.find((invocation) => invocation.claim.triggerId === request.triggerId &&
82
78
  invocation.claim.sources.some((source) => sourceIdentity(source) === sourceIdentity(request.source)));
83
- if (request.manualOutcome.disposition === ManualTriggerDisposition.Coalesced &&
84
- (!pauseCleared || invocation !== undefined))
79
+ if (request.manualOutcome.disposition === ManualTriggerDisposition.Coalesced)
85
80
  return request.manualOutcome;
86
81
  if (invocation?.startedAt !== undefined) {
87
82
  const outcome = {
@@ -98,13 +93,7 @@ async function resolvePausedRequest(ports, request, pauseCleared, context) {
98
93
  }, context, 'trigger:result:' + request.triggerId + ':' + sourceIdentity(request.source));
99
94
  return outcome;
100
95
  }
101
- if (!pauseCleared || invocation !== undefined)
102
- return request.manualOutcome;
103
- // Pause clears unclaimed requests, but a committed claim still recovers normally.
104
- const fact = consumedTriggerRequest(request, TriggerSkipReason.Paused);
105
- await ports.emit(fact, context, 'trigger:consume:' + request.triggerId + ':' + sourceIdentity(request.source));
106
- await ports.diagnostics.record(request.triggerId, request.source, TriggerSkipReason.Paused);
107
- return { disposition: ManualTriggerDisposition.Skipped, reason: TriggerSkipReason.Paused };
96
+ return request.manualOutcome;
108
97
  }
109
98
  function matchingManualRequest(event, triggerId, commandId) {
110
99
  if (event?.event.eventType === ControlEventType.TriggerRequestRecorded &&
@@ -0,0 +1,16 @@
1
+ import type { CommandContext } from '@atolis-hq/eventing';
2
+ import type { TriggerConfig } from '../contracts/config.js';
3
+ import type { TriggerDiagnostics } from './trigger-diagnostics.js';
4
+ import { type TriggerFactInput } from './trigger-facts.js';
5
+ import type { TriggerView } from './trigger-projection.js';
6
+ import type { TriggerServiceDependencies } from './trigger-service-ports.js';
7
+ interface PendingTriggerPorts {
8
+ readonly dependencies: TriggerServiceDependencies;
9
+ readonly diagnostics: TriggerDiagnostics;
10
+ readonly view: () => Promise<TriggerView>;
11
+ readonly configured: (id: string) => TriggerConfig | undefined;
12
+ readonly emit: (input: TriggerFactInput, context: CommandContext, id: string) => Promise<void>;
13
+ readonly recover: (context: CommandContext) => Promise<void>;
14
+ }
15
+ export declare function advancePendingTriggers(ports: PendingTriggerPorts, context: CommandContext): Promise<void>;
16
+ export {};
@@ -0,0 +1,58 @@
1
+ import { ControlEventType, TriggerSourceKind } from '../contracts/events.js';
2
+ import { TriggerSkipReason } from '../contracts/trigger-diagnostics.js';
3
+ import { consumedTriggerRequest, sourceIdentity } from './trigger-facts.js';
4
+ import { hasActiveInvocation } from './trigger-rules.js';
5
+ export async function advancePendingTriggers(ports, context) {
6
+ const initial = await ports.view();
7
+ for (const first of Object.values(initial.coalesced)) {
8
+ if (hasActiveInvocation(initial, first.coordinationKey))
9
+ continue;
10
+ // Manual admission failures consume only the manual commands; automatic work is judged separately.
11
+ for (const manual of first.manualRequests) {
12
+ const manualConfig = ports.configured(manual.triggerId);
13
+ const manualReason = await ports.diagnostics.ineligibleReason(initial, manual.triggerId, manualConfig, manualConfig !== undefined, false, true);
14
+ if (manualReason !== undefined)
15
+ await consume(ports, manual, manualReason, context);
16
+ }
17
+ const view = await ports.view();
18
+ const request = view.coalesced[first.coordinationKey];
19
+ if (request === undefined)
20
+ continue;
21
+ const config = ports.configured(request.triggerId);
22
+ const identity = `trigger:${request.triggerId}:${sourceIdentity(request.source)}`;
23
+ const reason = await pendingSkipReason(ports, view, request);
24
+ if (reason !== undefined || config === undefined) {
25
+ // Record every manual command's terminal outcome before consuming the shared slot.
26
+ for (const pending of [...request.manualRequests, request])
27
+ await consume(ports, pending, reason ?? TriggerSkipReason.Removed, context);
28
+ continue;
29
+ }
30
+ await ports.emit({
31
+ eventType: ControlEventType.TriggerInvocationClaimed,
32
+ payload: {
33
+ triggerId: config.id,
34
+ coordinationKey: request.coordinationKey,
35
+ source: request.source,
36
+ sources: request.sources,
37
+ workItemId: ports.dependencies.ids.next('work'),
38
+ workflowInstanceId: `workflow-${encodeURIComponent(identity)}`,
39
+ workflowName: config.workflow,
40
+ },
41
+ }, context, `${identity}:claim`);
42
+ await ports.recover(context);
43
+ }
44
+ }
45
+ async function consume(ports, pending, reason, context) {
46
+ await ports.diagnostics.record(pending.triggerId, pending.source, reason);
47
+ await ports.emit(consumedTriggerRequest(pending, reason), context, `trigger:consume:${pending.triggerId}:${sourceIdentity(pending.source)}`);
48
+ }
49
+ async function pendingSkipReason(ports, view, request) {
50
+ // Sibling automatic occurrences cannot erase a manual command's admission controls.
51
+ for (const pending of [request, ...request.manualRequests]) {
52
+ const config = ports.configured(pending.triggerId);
53
+ const reason = await ports.diagnostics.ineligibleReason(view, pending.triggerId, config, config !== undefined, false, pending.source.kind === TriggerSourceKind.Manual);
54
+ if (reason !== undefined)
55
+ return reason;
56
+ }
57
+ return undefined;
58
+ }
@@ -17,6 +17,9 @@ export interface TriggerView {
17
17
  readonly requests: readonly ControlEventPayloads[typeof ControlEventType.TriggerRequestRecorded][];
18
18
  readonly coalesced: Readonly<Record<string, ControlEventPayloads[typeof ControlEventType.TriggerRequestRecorded] & {
19
19
  readonly sources: readonly TriggerSource[];
20
+ readonly manualRequests: readonly ControlEventPayloads[typeof ControlEventType.TriggerRequestRecorded][];
21
+ /** Lets a skipped manual command leave automatic work claimable under its own trigger. */
22
+ readonly automaticRequests: readonly ControlEventPayloads[typeof ControlEventType.TriggerRequestRecorded][];
20
23
  }>>;
21
24
  /** Operational projections contain only active claims; explicit service inspection includes history. */
22
25
  readonly invocations: readonly TriggerInvocationView[];