@oisincoveney/pipeline 2.6.0 → 2.7.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.
@@ -344,8 +344,8 @@ declare const configSchema: z.ZodObject<{
344
344
  rules: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
345
345
  path: z.ZodString;
346
346
  source_root: z.ZodDefault<z.ZodEnum<{
347
- package: "package";
348
347
  project: "project";
348
+ package: "package";
349
349
  }>>;
350
350
  }, z.core.$strict>>>;
351
351
  runners: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -472,8 +472,8 @@ declare const configSchema: z.ZodObject<{
472
472
  schedules: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
473
473
  description: z.ZodOptional<z.ZodString>;
474
474
  baseline: z.ZodEnum<{
475
- execute: "execute";
476
475
  quick: "quick";
476
+ execute: "execute";
477
477
  }>;
478
478
  max_parallel_nodes: z.ZodOptional<z.ZodNumber>;
479
479
  node_catalog: z.ZodOptional<z.ZodString>;
@@ -485,8 +485,8 @@ declare const configSchema: z.ZodObject<{
485
485
  skills: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
486
486
  path: z.ZodString;
487
487
  source_root: z.ZodDefault<z.ZodEnum<{
488
- package: "package";
489
488
  project: "project";
489
+ package: "package";
490
490
  }>>;
491
491
  }, z.core.$strict>>>;
492
492
  task_context: z.ZodOptional<z.ZodObject<{
@@ -5,13 +5,13 @@ import { z } from "zod";
5
5
  //#region src/moka-submit.d.ts
6
6
  declare const mokaSubmitDirectHooksSchema: z.ZodRecord<z.ZodEnum<{
7
7
  "workflow.start": "workflow.start";
8
+ "node.finish": "node.finish";
9
+ "node.start": "node.start";
8
10
  "workflow.success": "workflow.success";
9
11
  "workflow.failure": "workflow.failure";
10
12
  "workflow.complete": "workflow.complete";
11
- "node.start": "node.start";
12
13
  "node.success": "node.success";
13
14
  "node.error": "node.error";
14
- "node.finish": "node.finish";
15
15
  "gate.failure": "gate.failure";
16
16
  }> & z.core.$partial, z.ZodDiscriminatedUnion<[z.ZodObject<{
17
17
  failure: z.ZodDefault<z.ZodEnum<{
@@ -94,13 +94,13 @@ declare const mokaSubmitOptionsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
94
94
  }, z.core.$strict>>;
95
95
  hooks: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
96
96
  "workflow.start": "workflow.start";
97
+ "node.finish": "node.finish";
98
+ "node.start": "node.start";
97
99
  "workflow.success": "workflow.success";
98
100
  "workflow.failure": "workflow.failure";
99
101
  "workflow.complete": "workflow.complete";
100
- "node.start": "node.start";
101
102
  "node.success": "node.success";
102
103
  "node.error": "node.error";
103
- "node.finish": "node.finish";
104
104
  "gate.failure": "gate.failure";
105
105
  }> & z.core.$partial, z.ZodDiscriminatedUnion<[z.ZodObject<{
106
106
  failure: z.ZodDefault<z.ZodEnum<{
@@ -160,8 +160,8 @@ declare const mokaSubmitOptionsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
160
160
  }, z.core.$strict>>;
161
161
  serviceAccountName: z.ZodOptional<z.ZodString>;
162
162
  mode: z.ZodEnum<{
163
- quick: "quick";
164
163
  full: "full";
164
+ quick: "quick";
165
165
  }>;
166
166
  schedulePath: z.ZodOptional<z.ZodString>;
167
167
  scheduleYaml: z.ZodOptional<z.ZodString>;
@@ -206,13 +206,13 @@ declare const mokaSubmitOptionsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
206
206
  }, z.core.$strict>>;
207
207
  hooks: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
208
208
  "workflow.start": "workflow.start";
209
+ "node.finish": "node.finish";
210
+ "node.start": "node.start";
209
211
  "workflow.success": "workflow.success";
210
212
  "workflow.failure": "workflow.failure";
211
213
  "workflow.complete": "workflow.complete";
212
- "node.start": "node.start";
213
214
  "node.success": "node.success";
214
215
  "node.error": "node.error";
215
- "node.finish": "node.finish";
216
216
  "gate.failure": "gate.failure";
217
217
  }> & z.core.$partial, z.ZodDiscriminatedUnion<[z.ZodObject<{
218
218
  failure: z.ZodDefault<z.ZodEnum<{
@@ -43,8 +43,8 @@ declare const runnerDeliverySchema: z.ZodObject<{
43
43
  declare const mokaSubmissionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
44
44
  kind: z.ZodLiteral<"graph">;
45
45
  mode: z.ZodEnum<{
46
- quick: "quick";
47
46
  full: "full";
47
+ quick: "quick";
48
48
  }>;
49
49
  }, z.core.$strict>, z.ZodObject<{
50
50
  argv: z.ZodArray<z.ZodString>;
@@ -104,8 +104,8 @@ declare const runnerCommandPayloadSchema: z.ZodObject<{
104
104
  submission: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
105
105
  kind: z.ZodLiteral<"graph">;
106
106
  mode: z.ZodEnum<{
107
- quick: "quick";
108
107
  full: "full";
108
+ quick: "quick";
109
109
  }>;
110
110
  }, z.core.$strict>, z.ZodObject<{
111
111
  argv: z.ZodArray<z.ZodString>;
@@ -10,8 +10,8 @@ declare const runnerEventRecordSchema: z.ZodUnion<readonly [z.ZodObject<{
10
10
  at: z.ZodOptional<z.ZodString>;
11
11
  sequence: z.ZodNumber;
12
12
  type: z.ZodEnum<{
13
- "workflow.start": "workflow.start";
14
13
  "workflow.planned": "workflow.planned";
14
+ "workflow.start": "workflow.start";
15
15
  }>;
16
16
  workflowPlan: z.ZodObject<{
17
17
  edges: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -55,10 +55,10 @@ declare const runnerEventRecordSchema: z.ZodUnion<readonly [z.ZodObject<{
55
55
  }>;
56
56
  }, z.core.$strip>;
57
57
  type: z.ZodEnum<{
58
- "node.start": "node.start";
59
- "node.finish": "node.finish";
60
58
  "agent.finish": "agent.finish";
61
59
  "agent.start": "agent.start";
60
+ "node.finish": "node.finish";
61
+ "node.start": "node.start";
62
62
  }>;
63
63
  }, z.core.$strip>, z.ZodObject<{
64
64
  at: z.ZodOptional<z.ZodString>;
@@ -180,8 +180,8 @@ declare const runnerEventBatchSchema: z.ZodObject<{
180
180
  at: z.ZodOptional<z.ZodString>;
181
181
  sequence: z.ZodNumber;
182
182
  type: z.ZodEnum<{
183
- "workflow.start": "workflow.start";
184
183
  "workflow.planned": "workflow.planned";
184
+ "workflow.start": "workflow.start";
185
185
  }>;
186
186
  workflowPlan: z.ZodObject<{
187
187
  edges: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -225,10 +225,10 @@ declare const runnerEventBatchSchema: z.ZodObject<{
225
225
  }>;
226
226
  }, z.core.$strip>;
227
227
  type: z.ZodEnum<{
228
- "node.start": "node.start";
229
- "node.finish": "node.finish";
230
228
  "agent.finish": "agent.finish";
231
229
  "agent.start": "agent.start";
230
+ "node.finish": "node.finish";
231
+ "node.start": "node.start";
232
232
  }>;
233
233
  }, z.core.$strip>, z.ZodObject<{
234
234
  at: z.ZodOptional<z.ZodString>;
@@ -91,20 +91,40 @@ function createLinkedAbortController(signal) {
91
91
  controller
92
92
  };
93
93
  }
94
+ function childCategory(childId, fanOut) {
95
+ return fanOut ? Object.keys(fanOut.by_category).find((category) => childId.includes(category)) : void 0;
96
+ }
97
+ function makeCategoryGate(context) {
98
+ const fanOut = context.config.token_budget?.fan_out_width;
99
+ const limits = /* @__PURE__ */ new Map();
100
+ return (childId, run) => {
101
+ const category = childCategory(childId, fanOut);
102
+ if (!(category && fanOut)) return run();
103
+ let limit = limits.get(category);
104
+ if (!limit) {
105
+ limit = pLimit(fanOut.by_category[category]);
106
+ limits.set(category, limit);
107
+ }
108
+ return limit(run);
109
+ };
110
+ }
94
111
  function executeParallelChildren(children, context, runtime) {
95
112
  for (const child of children) runtime.markNodeReady(context, child.id);
96
- if (!context.maxParallelNodes) return Promise.all(children.map((child) => runChildInWorktree(child, context, runtime)));
113
+ const gate = makeCategoryGate(context);
114
+ const runChild = (child) => gate(child.id, () => runChildInWorktree(child, context, runtime));
115
+ if (!context.maxParallelNodes) return Promise.all(children.map((child) => runChild(child)));
97
116
  const limit = pLimit(context.maxParallelNodes);
98
- return Promise.all(children.map((child) => limit(() => runChildInWorktree(child, context, runtime))));
117
+ return Promise.all(children.map((child) => limit(() => runChild(child))));
99
118
  }
100
119
  async function executeFailFastParallelChildren(children, context, abortController, runtime) {
101
120
  for (const child of children) runtime.markNodeReady(context, child.id);
121
+ const gate = makeCategoryGate(context);
102
122
  const limit = pLimit({
103
123
  concurrency: context.maxParallelNodes ?? children.length,
104
124
  rejectOnClear: true
105
125
  });
106
126
  return (await Promise.allSettled(children.map((child) => limit(async () => {
107
- const result = await runChildInWorktree(child, context, runtime);
127
+ const result = await gate(child.id, () => runChildInWorktree(child, context, runtime));
108
128
  if (result.status === "failed") {
109
129
  abortController.abort();
110
130
  limit.clearQueue();
@@ -121,4 +141,4 @@ function parallelOutput(children, results) {
121
141
  return JSON.stringify({ children: Object.fromEntries(children.filter((child) => outputsByNode.has(child.id)).map((child) => [child.id, outputsByNode.get(child.id)])) });
122
142
  }
123
143
  //#endregion
124
- export { executeParallelNode, parallelEvidence, parallelOutput };
144
+ export { childCategory, executeParallelNode, parallelEvidence, parallelOutput };
package/package.json CHANGED
@@ -121,7 +121,7 @@
121
121
  "prepack": "bun run build:cli"
122
122
  },
123
123
  "type": "module",
124
- "version": "2.6.0",
124
+ "version": "2.7.0",
125
125
  "description": "Config-driven multi-agent pipeline runner for repository work",
126
126
  "main": "./dist/index.js",
127
127
  "types": "./dist/index.d.ts",