@atolis-hq/wake 0.4.77 → 0.4.78

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 (49) hide show
  1. package/dist/src/activities/contracts/event-schema.d.ts +30 -0
  2. package/dist/src/activities/contracts/event-schema.js +8 -2
  3. package/dist/src/activities/contracts/events.d.ts +3 -1
  4. package/dist/src/activities/pr/application.js +6 -3
  5. package/dist/src/activities/pr/contracts.d.ts +3 -1
  6. package/dist/src/activities/pr/event-data.js +4 -1
  7. package/dist/src/activities/pr/projection.js +4 -1
  8. package/dist/src/activities/pr/vocabulary.d.ts +6 -0
  9. package/dist/src/activities/pr/vocabulary.js +5 -0
  10. package/dist/src/bootstrap/config/root-schema.d.ts +18 -0
  11. package/dist/src/bootstrap/resource-transition-evidence.js +20 -14
  12. package/dist/src/bootstrap/version.js +1 -1
  13. package/dist/src/integrations/application/agent-run-publication-reactor.d.ts +1 -0
  14. package/dist/src/integrations/application/agent-run-publication-reactor.js +49 -25
  15. package/dist/src/integrations/application/agent-run-publication-report.d.ts +10 -0
  16. package/dist/src/integrations/application/agent-run-publication-report.js +53 -0
  17. package/dist/src/integrations/application/terminal-agent-run-report.d.ts +4 -0
  18. package/dist/src/integrations/application/terminal-agent-run-report.js +4 -0
  19. package/dist/src/integrations/delivery/contracts/intents.d.ts +2 -0
  20. package/dist/src/integrations/delivery/contracts/intents.js +2 -0
  21. package/dist/src/integrations/github/application/agent-run-comment.d.ts +2 -0
  22. package/dist/src/integrations/github/application/agent-run-comment.js +26 -5
  23. package/dist/src/integrations/github/application/pull-request-translation.js +1 -0
  24. package/dist/src/integrations/github/contracts/events.d.ts +2 -1
  25. package/dist/src/integrations/github/contracts/events.js +8 -1
  26. package/dist/src/integrations/github/contracts/payloads.d.ts +1 -0
  27. package/dist/src/integrations/github/infrastructure/client-reads.d.ts +18 -6
  28. package/dist/src/integrations/github/infrastructure/client-reads.js +6 -1
  29. package/dist/src/integrations/github/infrastructure/client.d.ts +18 -6
  30. package/dist/src/integrations/github/infrastructure/consecutive-pr-observations.d.ts +4 -0
  31. package/dist/src/integrations/github/infrastructure/consecutive-pr-observations.js +33 -0
  32. package/dist/src/integrations/github/infrastructure/pr-source.js +6 -1
  33. package/dist/src/integrations/github/infrastructure/source.d.ts +6 -2
  34. package/dist/src/integrations/github/infrastructure/source.js +9 -9
  35. package/dist/src/integrations/github/provider.js +1 -0
  36. package/dist/src/orchestration/application/policy-blocked-merge-recovery.d.ts +5 -0
  37. package/dist/src/orchestration/application/policy-blocked-merge-recovery.js +108 -21
  38. package/dist/src/orchestration/application/pull-request-transition-evidence.js +22 -1
  39. package/dist/src/orchestration/application/resource-transition-evidence.d.ts +6 -1
  40. package/dist/src/orchestration/application/resource-transition-matching.d.ts +5 -0
  41. package/dist/src/orchestration/application/resource-transition-matching.js +23 -1
  42. package/dist/src/orchestration/contracts/config.d.ts +42 -1
  43. package/dist/src/orchestration/contracts/config.js +9 -1
  44. package/dist/src/orchestration/contracts/event-decoder.d.ts +5 -0
  45. package/dist/src/orchestration/contracts/event-decoder.js +6 -1
  46. package/dist/src/orchestration/domain/resource-transition-compiler.js +1 -0
  47. package/dist/src/orchestration/index.d.ts +1 -0
  48. package/dist/src/orchestration/index.js +1 -0
  49. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { ApprovalAuthorityKind } from './vocabulary.js';
3
- import { ActivityEventType, PullRequestCheckState, PullRequestState, type ActivityName } from '../../activities/index.js';
3
+ import { ActivityEventType, PullRequestCheckState, PullRequestMergeability, PullRequestState, type ActivityName } from '../../activities/index.js';
4
4
  import { type WorkspaceMode as WorkspaceModeType } from '../../execution/index.js';
5
5
  import type { CommandName, SignalName, StageName, WatchId, WorkflowName } from './identifiers.js';
6
6
  import type { TransitionTargetKind } from './vocabulary.js';
@@ -23,6 +23,15 @@ declare const watchGateConfigSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObje
23
23
  }, z.core.$strict>>;
24
24
  }, z.core.$strict>]>;
25
25
  declare const resourceTransitionConfigSchema: z.ZodUnion<readonly [z.ZodObject<{
26
+ events: z.ZodTuple<[z.ZodLiteral<"pr.state-changed">], null>;
27
+ where: z.ZodObject<{
28
+ mergeability: z.ZodLiteral<"conflicting">;
29
+ }, z.core.$strict>;
30
+ then: z.ZodString;
31
+ retry: z.ZodObject<{
32
+ max: z.ZodNumber;
33
+ }, z.core.$strict>;
34
+ }, z.core.$strict>, z.ZodObject<{
26
35
  events: z.ZodTuple<[z.ZodLiteral<"pr.review-accepted">], null>;
27
36
  then: z.ZodOptional<z.ZodString>;
28
37
  }, z.core.$strict>, z.ZodObject<{
@@ -96,6 +105,15 @@ export declare const outcomeRouteConfigSchema: z.ZodObject<{
96
105
  }, z.core.$strict>>;
97
106
  }, z.core.$strict>]>>>;
98
107
  resourceTransitions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
108
+ events: z.ZodTuple<[z.ZodLiteral<"pr.state-changed">], null>;
109
+ where: z.ZodObject<{
110
+ mergeability: z.ZodLiteral<"conflicting">;
111
+ }, z.core.$strict>;
112
+ then: z.ZodString;
113
+ retry: z.ZodObject<{
114
+ max: z.ZodNumber;
115
+ }, z.core.$strict>;
116
+ }, z.core.$strict>, z.ZodObject<{
99
117
  events: z.ZodTuple<[z.ZodLiteral<"pr.review-accepted">], null>;
100
118
  then: z.ZodOptional<z.ZodString>;
101
119
  }, z.core.$strict>, z.ZodObject<{
@@ -150,6 +168,15 @@ export declare const stageConfigSchema: z.ZodObject<{
150
168
  }, z.core.$strict>>;
151
169
  }, z.core.$strict>]>>>;
152
170
  resourceTransitions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
171
+ events: z.ZodTuple<[z.ZodLiteral<"pr.state-changed">], null>;
172
+ where: z.ZodObject<{
173
+ mergeability: z.ZodLiteral<"conflicting">;
174
+ }, z.core.$strict>;
175
+ then: z.ZodString;
176
+ retry: z.ZodObject<{
177
+ max: z.ZodNumber;
178
+ }, z.core.$strict>;
179
+ }, z.core.$strict>, z.ZodObject<{
153
180
  events: z.ZodTuple<[z.ZodLiteral<"pr.review-accepted">], null>;
154
181
  then: z.ZodOptional<z.ZodString>;
155
182
  }, z.core.$strict>, z.ZodObject<{
@@ -248,6 +275,15 @@ export declare const workflowDefinitionConfigSchema: z.ZodObject<{
248
275
  }, z.core.$strict>>;
249
276
  }, z.core.$strict>]>>>;
250
277
  resourceTransitions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
278
+ events: z.ZodTuple<[z.ZodLiteral<"pr.state-changed">], null>;
279
+ where: z.ZodObject<{
280
+ mergeability: z.ZodLiteral<"conflicting">;
281
+ }, z.core.$strict>;
282
+ then: z.ZodString;
283
+ retry: z.ZodObject<{
284
+ max: z.ZodNumber;
285
+ }, z.core.$strict>;
286
+ }, z.core.$strict>, z.ZodObject<{
251
287
  events: z.ZodTuple<[z.ZodLiteral<"pr.review-accepted">], null>;
252
288
  then: z.ZodOptional<z.ZodString>;
253
289
  }, z.core.$strict>, z.ZodObject<{
@@ -334,7 +370,12 @@ export interface CompiledOutcomeRoute extends Omit<OutcomeRouteConfig, 'activiti
334
370
  }
335
371
  export interface CompiledResourceTransition {
336
372
  readonly event: typeof ActivityEventType.PrReviewAccepted | typeof ActivityEventType.PrStateChanged | typeof ActivityEventType.PrChecksChanged;
373
+ readonly retry?: {
374
+ readonly max: number;
375
+ };
337
376
  readonly where?: {
377
+ readonly mergeability: typeof PullRequestMergeability.Conflicting;
378
+ } | {
338
379
  readonly state: typeof PullRequestState.Merged;
339
380
  } | {
340
381
  readonly checks: typeof PullRequestCheckState.Failing;
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { ApprovalAuthorityKind, ConversationSurfaceCapability, WorkflowStatus, } from './vocabulary.js';
3
- import { ActivityEventType, PullRequestCheckState, PullRequestState, } from '../../activities/index.js';
3
+ import { ActivityEventType, PullRequestCheckState, PullRequestMergeability, PullRequestState, } from '../../activities/index.js';
4
4
  import { WorkspaceMode } from '../../execution/index.js';
5
5
  import { MatchMode } from '../../kernel/index.js';
6
6
  const identifier = z.string().trim().min(1);
@@ -33,6 +33,14 @@ const watchGateConfigSchema = z.union([
33
33
  .strict(),
34
34
  ]);
35
35
  const resourceTransitionConfigSchema = z.union([
36
+ z
37
+ .object({
38
+ events: z.tuple([z.literal(ActivityEventType.PrStateChanged)]),
39
+ where: z.object({ mergeability: z.literal(PullRequestMergeability.Conflicting) }).strict(),
40
+ then: identifier,
41
+ retry: z.object({ max: z.number().int().min(1).max(2) }).strict(),
42
+ })
43
+ .strict(),
36
44
  z
37
45
  .object({
38
46
  events: z.tuple([z.literal(ActivityEventType.PrReviewAccepted)]),
@@ -113,6 +113,8 @@ export declare const expectationSchema: z.ZodObject<{
113
113
  "pr.review-accepted": "pr.review-accepted";
114
114
  }>;
115
115
  where: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
116
+ mergeability: z.ZodLiteral<"conflicting">;
117
+ }, z.core.$strict>, z.ZodObject<{
116
118
  state: z.ZodLiteral<"merged">;
117
119
  }, z.core.$strict>, z.ZodObject<{
118
120
  checks: z.ZodLiteral<"failing">;
@@ -128,6 +130,9 @@ export declare const expectationSchema: z.ZodObject<{
128
130
  }, z.core.$strict>, z.ZodObject<{
129
131
  kind: z.ZodLiteral<"resource-transition-wait">;
130
132
  }, z.core.$strict>], "kind">;
133
+ retry: z.ZodOptional<z.ZodObject<{
134
+ max: z.ZodNumber;
135
+ }, z.core.$strict>>;
131
136
  }, z.core.$strict>>>;
132
137
  }, z.core.$strict>;
133
138
  export declare const signalSchema: z.ZodObject<{
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { eventDataSchema, eventEnvelopeSchema } from '@atolis-hq/eventing';
3
- import { activationId, ActivityEventType, activityName, ActivityOutcomeKind, PullRequestCheckState, PullRequestState, } from '../../activities/index.js';
3
+ import { activationId, ActivityEventType, activityName, ActivityOutcomeKind, PullRequestCheckState, PullRequestMergeability, PullRequestState, } from '../../activities/index.js';
4
4
  import { WorkspaceMode } from '../../execution/index.js';
5
5
  import { brandedStringSchema } from '../../kernel/index.js';
6
6
  import { workItemId } from '../../work/index.js';
@@ -111,11 +111,16 @@ const resourceTransitionSchema = z
111
111
  ]),
112
112
  where: z
113
113
  .union([
114
+ z.object({ mergeability: z.literal(PullRequestMergeability.Conflicting) }).strict(),
114
115
  z.object({ state: z.literal(PullRequestState.Merged) }).strict(),
115
116
  z.object({ checks: z.literal(PullRequestCheckState.Failing) }).strict(),
116
117
  ])
117
118
  .optional(),
118
119
  target: transitionTargetSchema,
120
+ retry: z
121
+ .object({ max: z.number().int().min(1).max(2) })
122
+ .strict()
123
+ .optional(),
119
124
  })
120
125
  .strict();
121
126
  export const expectationSchema = z
@@ -9,6 +9,7 @@ export function compileResourceTransitions(entries, context, allStages, isReserv
9
9
  throw new Error(`Unknown resourceTransitions target: ${then}`);
10
10
  return Object.freeze({
11
11
  event: entry.events[0],
12
+ ...(!('retry' in entry) ? {} : { retry: entry.retry }),
12
13
  ...(!('where' in entry) || entry.where === undefined ? {} : { where: entry.where }),
13
14
  target: compileTarget(then, context.outcomeKind),
14
15
  });
@@ -4,6 +4,7 @@ export * from './application/orchestration-service.js';
4
4
  export * from './application/advance-workflow.js';
5
5
  export * from './application/durable-append.js';
6
6
  export * from './application/pull-request-transition-evidence.js';
7
+ export { isPolicyBlockedMergeWait } from './application/policy-blocked-merge-recovery.js';
7
8
  export * from './application/resource-transition-evidence.js';
8
9
  export * from './application/resource-transition-matching.js';
9
10
  export * from './application/resource-transition-reactor.js';
@@ -4,6 +4,7 @@ export * from './application/orchestration-service.js';
4
4
  export * from './application/advance-workflow.js';
5
5
  export * from './application/durable-append.js';
6
6
  export * from './application/pull-request-transition-evidence.js';
7
+ export { isPolicyBlockedMergeWait } from './application/policy-blocked-merge-recovery.js';
7
8
  export * from './application/resource-transition-evidence.js';
8
9
  export * from './application/resource-transition-matching.js';
9
10
  export * from './application/resource-transition-reactor.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atolis-hq/wake",
3
- "version": "0.4.77",
3
+ "version": "0.4.78",
4
4
  "description": "Local autonomous agent control plane for software development",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {