lastlight-workflow-engine 0.4.0 → 0.6.0

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.
@@ -16,6 +16,9 @@
16
16
  * generic-loop iteration n → reviewer_iter_n
17
17
  * generic-loop retry of n → reviewer_iter_n_retry
18
18
  * generic-loop check of n → reviewer_iter_n_check
19
+ * fan-out branch b → survey_branch_b
20
+ * fan-out branch b's retry → survey_branch_b_retry
21
+ * fan-out branch b's check → survey_branch_b_check
19
22
  *
20
23
  * `n` is the 1-based cycle; `fix_k` and `recheck_k` pair within a cycle. The
21
24
  * `_retry` suffix is the one-shot re-run of a generic-loop iteration whose first
@@ -27,13 +30,27 @@
27
30
  * therefore visible (with a start time and a duration) while it is in flight.
28
31
  * The legacy bare-numeric re-review form (`reviewer_2`) is dropped entirely —
29
32
  * it is neither produced nor recognized.
33
+ *
34
+ * The three `_branch_` forms are a `type: fanout` phase's branches (WP11c). A
35
+ * fan-out is ONE dag node running N agent sessions concurrently in one
36
+ * provisioned workspace, so the node has one name but N units of work — and each
37
+ * unit needs its own `executions` row for resume, dedup and cost attribution.
38
+ * Keyed by NAME rather than index because a branch is declared, not counted:
39
+ * reordering the `branches:` list must not re-key the ledger and make a resumed
40
+ * run re-pay for work it already did. Branch names are constrained by the schema
41
+ * to `[A-Za-z0-9-]` precisely so these three patterns parse unambiguously
42
+ * against a base that may itself contain underscores.
30
43
  */
31
- export type PhaseKind = "phase" | "fix" | "recheck" | "iter" | "retry" | "check";
44
+ export type PhaseKind = "phase" | "fix" | "recheck" | "iter" | "retry" | "check" | "branch" | "branchRetry" | "branchCheck";
32
45
  export declare class PhaseRef {
33
46
  readonly base: string;
34
47
  readonly kind: PhaseKind;
35
48
  readonly index?: number | undefined;
36
- constructor(base: string, kind?: PhaseKind, index?: number | undefined);
49
+ /** Fan-out branch name — set for the three `branch*` kinds only. */
50
+ readonly branch?: string | undefined;
51
+ constructor(base: string, kind?: PhaseKind, index?: number | undefined,
52
+ /** Fan-out branch name — set for the three `branch*` kinds only. */
53
+ branch?: string | undefined);
37
54
  /** The declared phase, run as-is (no derived suffix). */
38
55
  static review(base: string): PhaseRef;
39
56
  /** The executor fix run for cycle `n`. */
@@ -46,10 +63,17 @@ export declare class PhaseRef {
46
63
  static iterRetry(base: string, n: number): PhaseRef;
47
64
  /** The `until_bash` exit-condition run that follows generic-loop iteration `n`. */
48
65
  static iterCheck(base: string, n: number): PhaseRef;
66
+ /** One branch of a `type: fanout` phase. */
67
+ static branch(base: string, name: string): PhaseRef;
68
+ /** The one-shot retry of a fan-out branch whose first attempt came back soft. */
69
+ static branchRetry(base: string, name: string): PhaseRef;
70
+ /** The `until_bash` exit-condition run that follows a fan-out branch. */
71
+ static branchCheck(base: string, name: string): PhaseRef;
49
72
  format(): string;
50
73
  /**
51
74
  * Parse a label back into a PhaseRef. Recognizes only the generated
52
75
  * `_fix_N` / `_recheck_N` / `_iter_N` / `_iter_N_retry` / `_iter_N_check`
76
+ * and `_branch_<name>` / `_branch_<name>_retry` / `_branch_<name>_check`
53
77
  * suffixes; anything else (including a
54
78
  * bare declared name or the dropped legacy `_N` form) parses as a plain
55
79
  * `phase` whose base is the whole string.
@@ -16,6 +16,9 @@
16
16
  * generic-loop iteration n → reviewer_iter_n
17
17
  * generic-loop retry of n → reviewer_iter_n_retry
18
18
  * generic-loop check of n → reviewer_iter_n_check
19
+ * fan-out branch b → survey_branch_b
20
+ * fan-out branch b's retry → survey_branch_b_retry
21
+ * fan-out branch b's check → survey_branch_b_check
19
22
  *
20
23
  * `n` is the 1-based cycle; `fix_k` and `recheck_k` pair within a cycle. The
21
24
  * `_retry` suffix is the one-shot re-run of a generic-loop iteration whose first
@@ -27,15 +30,29 @@
27
30
  * therefore visible (with a start time and a duration) while it is in flight.
28
31
  * The legacy bare-numeric re-review form (`reviewer_2`) is dropped entirely —
29
32
  * it is neither produced nor recognized.
33
+ *
34
+ * The three `_branch_` forms are a `type: fanout` phase's branches (WP11c). A
35
+ * fan-out is ONE dag node running N agent sessions concurrently in one
36
+ * provisioned workspace, so the node has one name but N units of work — and each
37
+ * unit needs its own `executions` row for resume, dedup and cost attribution.
38
+ * Keyed by NAME rather than index because a branch is declared, not counted:
39
+ * reordering the `branches:` list must not re-key the ledger and make a resumed
40
+ * run re-pay for work it already did. Branch names are constrained by the schema
41
+ * to `[A-Za-z0-9-]` precisely so these three patterns parse unambiguously
42
+ * against a base that may itself contain underscores.
30
43
  */
31
44
  export class PhaseRef {
32
45
  base;
33
46
  kind;
34
47
  index;
35
- constructor(base, kind = "phase", index) {
48
+ branch;
49
+ constructor(base, kind = "phase", index,
50
+ /** Fan-out branch name — set for the three `branch*` kinds only. */
51
+ branch) {
36
52
  this.base = base;
37
53
  this.kind = kind;
38
54
  this.index = index;
55
+ this.branch = branch;
39
56
  }
40
57
  /** The declared phase, run as-is (no derived suffix). */
41
58
  static review(base) {
@@ -61,6 +78,18 @@ export class PhaseRef {
61
78
  static iterCheck(base, n) {
62
79
  return new PhaseRef(base, "check", n);
63
80
  }
81
+ /** One branch of a `type: fanout` phase. */
82
+ static branch(base, name) {
83
+ return new PhaseRef(base, "branch", undefined, name);
84
+ }
85
+ /** The one-shot retry of a fan-out branch whose first attempt came back soft. */
86
+ static branchRetry(base, name) {
87
+ return new PhaseRef(base, "branchRetry", undefined, name);
88
+ }
89
+ /** The `until_bash` exit-condition run that follows a fan-out branch. */
90
+ static branchCheck(base, name) {
91
+ return new PhaseRef(base, "branchCheck", undefined, name);
92
+ }
64
93
  format() {
65
94
  switch (this.kind) {
66
95
  case "phase":
@@ -75,17 +104,37 @@ export class PhaseRef {
75
104
  return `${this.base}_iter_${this.index}_retry`;
76
105
  case "check":
77
106
  return `${this.base}_iter_${this.index}_check`;
107
+ case "branch":
108
+ return `${this.base}_branch_${this.branch}`;
109
+ case "branchRetry":
110
+ return `${this.base}_branch_${this.branch}_retry`;
111
+ case "branchCheck":
112
+ return `${this.base}_branch_${this.branch}_check`;
78
113
  }
79
114
  }
80
115
  /**
81
116
  * Parse a label back into a PhaseRef. Recognizes only the generated
82
117
  * `_fix_N` / `_recheck_N` / `_iter_N` / `_iter_N_retry` / `_iter_N_check`
118
+ * and `_branch_<name>` / `_branch_<name>_retry` / `_branch_<name>_check`
83
119
  * suffixes; anything else (including a
84
120
  * bare declared name or the dropped legacy `_N` form) parses as a plain
85
121
  * `phase` whose base is the whole string.
86
122
  */
87
123
  static parse(label) {
88
- let m = label.match(/^(.*)_iter_(\d+)_retry$/);
124
+ // The branch forms first, and the two SUFFIXED ones before the bare one:
125
+ // `<base>_branch_<name>_retry` is also a syntactically valid bare branch
126
+ // called `…` — except that the schema forbids `_` in a branch name, so the
127
+ // greedy-base / underscore-free-name split below is the only reading.
128
+ let m = label.match(/^(.*)_branch_([A-Za-z0-9-]+)_retry$/);
129
+ if (m)
130
+ return new PhaseRef(m[1], "branchRetry", undefined, m[2]);
131
+ m = label.match(/^(.*)_branch_([A-Za-z0-9-]+)_check$/);
132
+ if (m)
133
+ return new PhaseRef(m[1], "branchCheck", undefined, m[2]);
134
+ m = label.match(/^(.*)_branch_([A-Za-z0-9-]+)$/);
135
+ if (m)
136
+ return new PhaseRef(m[1], "branch", undefined, m[2]);
137
+ m = label.match(/^(.*)_iter_(\d+)_retry$/);
89
138
  if (m)
90
139
  return new PhaseRef(m[1], "retry", Number(m[2]));
91
140
  m = label.match(/^(.*)_iter_(\d+)_check$/);
@@ -1 +1 @@
1
- {"version":3,"file":"phase-ref.js","sourceRoot":"","sources":["../../src/core/phase-ref.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAIH,MAAM,OAAO,QAAQ;IAER,IAAI;IACJ,IAAI;IACJ,KAAK;IAHhB,YACW,IAAY,EACZ,IAAI,GAAc,OAAO,EACzB,KAAc;oBAFd,IAAI;oBACJ,IAAI;qBACJ,KAAK;IACb,CAAC;IAEJ,yDAAyD;IACzD,MAAM,CAAC,MAAM,CAAC,IAA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C,IAAI,CAAC;YAAE,OAAO,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxD,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACpC,IAAI,CAAC;YAAE,OAAO,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACtD,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QACxC,IAAI,CAAC;YAAE,OAAO,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1D,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACrC,IAAI,CAAC;YAAE,OAAO,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvD,OAAO,IAAI,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;CACF"}
@@ -33,7 +33,7 @@ declare const PhaseLoopSchema: z.ZodObject<{
33
33
  declare const GenericLoopSchema: z.ZodObject<{
34
34
  max_iterations: z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
35
35
  from: z.ZodString;
36
- default: z.ZodNumber;
36
+ default: z.ZodOptional<z.ZodNumber>;
37
37
  }, z.core.$strict>]>;
38
38
  until: z.ZodOptional<z.ZodString>;
39
39
  until_bash: z.ZodOptional<z.ZodString>;
@@ -53,6 +53,32 @@ declare const GenericLoopSchema: z.ZodObject<{
53
53
  }>>;
54
54
  }, z.core.$strip>>;
55
55
  }, z.core.$strip>;
56
+ /**
57
+ * One branch of a `type: fanout` phase — a single agent session run
58
+ * CONCURRENTLY with its siblings inside the phase's one provisioned workspace.
59
+ *
60
+ * `name` is deliberately restricted to `[A-Za-z0-9-]` (no underscores). Every
61
+ * branch gets its own `executions` row keyed `<phase>_branch_<name>`, plus
62
+ * `_retry` / `_check` variants, and {@link PhaseRef.parse} has to split those
63
+ * back apart against a BASE phase name that may itself contain underscores
64
+ * (`survey_contract`). Forbidding `_` in the branch half is what makes the split
65
+ * unambiguous rather than heuristic.
66
+ */
67
+ declare const FanoutBranchSchema: z.ZodObject<{
68
+ name: z.ZodString;
69
+ prompt: z.ZodOptional<z.ZodString>;
70
+ skill: z.ZodOptional<z.ZodString>;
71
+ skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
72
+ model: z.ZodOptional<z.ZodString>;
73
+ variant: z.ZodOptional<z.ZodString>;
74
+ until_bash: z.ZodOptional<z.ZodString>;
75
+ timeout_seconds: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
76
+ from: z.ZodString;
77
+ default: z.ZodOptional<z.ZodNumber>;
78
+ }, z.core.$strict>]>>;
79
+ context_file: z.ZodOptional<z.ZodString>;
80
+ }, z.core.$strip>;
81
+ export type FanoutBranch = z.infer<typeof FanoutBranchSchema>;
56
82
  declare const PhaseDefinitionSchema: z.ZodObject<{
57
83
  name: z.ZodString;
58
84
  label: z.ZodOptional<z.ZodString>;
@@ -60,6 +86,7 @@ declare const PhaseDefinitionSchema: z.ZodObject<{
60
86
  agent: "agent";
61
87
  bash: "bash";
62
88
  context: "context";
89
+ fanout: "fanout";
63
90
  "post-review": "post-review";
64
91
  script: "script";
65
92
  }>>;
@@ -72,7 +99,7 @@ declare const PhaseDefinitionSchema: z.ZodObject<{
72
99
  }>>;
73
100
  timeout_seconds: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
74
101
  from: z.ZodString;
75
- default: z.ZodNumber;
102
+ default: z.ZodOptional<z.ZodNumber>;
76
103
  }, z.core.$strict>]>>;
77
104
  prompt: z.ZodOptional<z.ZodString>;
78
105
  skill: z.ZodOptional<z.ZodString>;
@@ -125,7 +152,7 @@ declare const PhaseDefinitionSchema: z.ZodObject<{
125
152
  generic_loop: z.ZodOptional<z.ZodObject<{
126
153
  max_iterations: z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
127
154
  from: z.ZodString;
128
- default: z.ZodNumber;
155
+ default: z.ZodOptional<z.ZodNumber>;
129
156
  }, z.core.$strict>]>;
130
157
  until: z.ZodOptional<z.ZodString>;
131
158
  until_bash: z.ZodOptional<z.ZodString>;
@@ -145,6 +172,31 @@ declare const PhaseDefinitionSchema: z.ZodObject<{
145
172
  }>>;
146
173
  }, z.core.$strip>>;
147
174
  }, z.core.$strip>>;
175
+ branches: z.ZodOptional<z.ZodArray<z.ZodObject<{
176
+ name: z.ZodString;
177
+ prompt: z.ZodOptional<z.ZodString>;
178
+ skill: z.ZodOptional<z.ZodString>;
179
+ skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
180
+ model: z.ZodOptional<z.ZodString>;
181
+ variant: z.ZodOptional<z.ZodString>;
182
+ until_bash: z.ZodOptional<z.ZodString>;
183
+ timeout_seconds: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
184
+ from: z.ZodString;
185
+ default: z.ZodOptional<z.ZodNumber>;
186
+ }, z.core.$strict>]>>;
187
+ context_file: z.ZodOptional<z.ZodString>;
188
+ }, z.core.$strip>>>;
189
+ max_concurrent: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
190
+ from: z.ZodString;
191
+ default: z.ZodOptional<z.ZodNumber>;
192
+ }, z.core.$strict>]>>;
193
+ on_branch_soft_failure: z.ZodOptional<z.ZodObject<{
194
+ retries: z.ZodDefault<z.ZodNumber>;
195
+ then: z.ZodDefault<z.ZodEnum<{
196
+ complete: "complete";
197
+ fail: "fail";
198
+ }>>;
199
+ }, z.core.$strip>>;
148
200
  on_output: z.ZodOptional<z.ZodObject<{
149
201
  contains_BLOCKED: z.ZodOptional<z.ZodObject<{
150
202
  action: z.ZodEnum<{
@@ -216,6 +268,20 @@ export declare const AgentWorkflowSchema: z.ZodObject<{
216
268
  description: z.ZodOptional<z.ZodString>;
217
269
  trigger: z.ZodOptional<z.ZodString>;
218
270
  pr_scoped: z.ZodOptional<z.ZodBoolean>;
271
+ git_access: z.ZodOptional<z.ZodEnum<{
272
+ "issues-write": "issues-write";
273
+ read: "read";
274
+ "repo-write": "repo-write";
275
+ "review-write": "review-write";
276
+ }>>;
277
+ workspace: z.ZodOptional<z.ZodEnum<{
278
+ "per-run": "per-run";
279
+ "per-target-recreate": "per-target-recreate";
280
+ "per-target-reuse": "per-target-reuse";
281
+ }>>;
282
+ prepopulate_synth_branch: z.ZodOptional<z.ZodBoolean>;
283
+ prepopulate_pr_head_ref: z.ZodOptional<z.ZodBoolean>;
284
+ pr_fix_shaped: z.ZodOptional<z.ZodBoolean>;
219
285
  status_checklist: z.ZodOptional<z.ZodBoolean>;
220
286
  final_message: z.ZodOptional<z.ZodString>;
221
287
  variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
@@ -237,6 +303,7 @@ export declare const AgentWorkflowSchema: z.ZodObject<{
237
303
  agent: "agent";
238
304
  bash: "bash";
239
305
  context: "context";
306
+ fanout: "fanout";
240
307
  "post-review": "post-review";
241
308
  script: "script";
242
309
  }>>;
@@ -249,7 +316,7 @@ export declare const AgentWorkflowSchema: z.ZodObject<{
249
316
  }>>;
250
317
  timeout_seconds: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
251
318
  from: z.ZodString;
252
- default: z.ZodNumber;
319
+ default: z.ZodOptional<z.ZodNumber>;
253
320
  }, z.core.$strict>]>>;
254
321
  prompt: z.ZodOptional<z.ZodString>;
255
322
  skill: z.ZodOptional<z.ZodString>;
@@ -302,7 +369,7 @@ export declare const AgentWorkflowSchema: z.ZodObject<{
302
369
  generic_loop: z.ZodOptional<z.ZodObject<{
303
370
  max_iterations: z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
304
371
  from: z.ZodString;
305
- default: z.ZodNumber;
372
+ default: z.ZodOptional<z.ZodNumber>;
306
373
  }, z.core.$strict>]>;
307
374
  until: z.ZodOptional<z.ZodString>;
308
375
  until_bash: z.ZodOptional<z.ZodString>;
@@ -322,6 +389,31 @@ export declare const AgentWorkflowSchema: z.ZodObject<{
322
389
  }>>;
323
390
  }, z.core.$strip>>;
324
391
  }, z.core.$strip>>;
392
+ branches: z.ZodOptional<z.ZodArray<z.ZodObject<{
393
+ name: z.ZodString;
394
+ prompt: z.ZodOptional<z.ZodString>;
395
+ skill: z.ZodOptional<z.ZodString>;
396
+ skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
397
+ model: z.ZodOptional<z.ZodString>;
398
+ variant: z.ZodOptional<z.ZodString>;
399
+ until_bash: z.ZodOptional<z.ZodString>;
400
+ timeout_seconds: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
401
+ from: z.ZodString;
402
+ default: z.ZodOptional<z.ZodNumber>;
403
+ }, z.core.$strict>]>>;
404
+ context_file: z.ZodOptional<z.ZodString>;
405
+ }, z.core.$strip>>>;
406
+ max_concurrent: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
407
+ from: z.ZodString;
408
+ default: z.ZodOptional<z.ZodNumber>;
409
+ }, z.core.$strict>]>>;
410
+ on_branch_soft_failure: z.ZodOptional<z.ZodObject<{
411
+ retries: z.ZodDefault<z.ZodNumber>;
412
+ then: z.ZodDefault<z.ZodEnum<{
413
+ complete: "complete";
414
+ fail: "fail";
415
+ }>>;
416
+ }, z.core.$strip>>;
325
417
  on_output: z.ZodOptional<z.ZodObject<{
326
418
  contains_BLOCKED: z.ZodOptional<z.ZodObject<{
327
419
  action: z.ZodEnum<{