@oisincoveney/pipeline 3.1.1 → 3.2.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.
@@ -1,5 +1,6 @@
1
1
  import { loadPipelineConfig } from "../config/load.js";
2
2
  import "../config.js";
3
+ import { flattenNodes } from "../planning/graph.js";
3
4
  import { configureGatewayHosts, localGatewayStatus, reconcileGateway, renderGatewayConfig, runGatewayDoctor, startLocalGateway } from "../mcp/gateway.js";
4
5
  import { createOrchestratorLaunchPlan, createRunnerLaunchPlan } from "../runner.js";
5
6
  import { compileWorkflowPlan } from "../planning/compile.js";
@@ -192,7 +193,7 @@ function resolvedRunControlOptions(input) {
192
193
  function plannedRunStoreNodeIds(inputs) {
193
194
  if (inputs.pipelineRunner) return [];
194
195
  const workflowId = resolveWorkflowSelection(inputs.config, inputs.workflow, inputs.entrypoint);
195
- return compileWorkflowPlan(inputs.config, workflowId).topologicalOrder.map((node) => node.id);
196
+ return flattenNodes(compileWorkflowPlan(inputs.config, workflowId).topologicalOrder, (node) => node.children).map((node) => node.id);
196
197
  }
197
198
  function formatSupervisedRunFollowUp(runId) {
198
199
  return [
@@ -226,8 +226,8 @@ declare const configSchema: z.ZodObject<{
226
226
  policy: z.ZodOptional<z.ZodObject<{
227
227
  commands: z.ZodOptional<z.ZodEnum<{
228
228
  allow: "allow";
229
- "trusted-only": "trusted-only";
230
229
  deny: "deny";
230
+ "trusted-only": "trusted-only";
231
231
  }>>;
232
232
  modules: z.ZodOptional<z.ZodEnum<{
233
233
  allow: "allow";
@@ -255,8 +255,8 @@ declare const configSchema: z.ZodObject<{
255
255
  global: "global";
256
256
  }>>;
257
257
  mode: z.ZodEnum<{
258
- hosted: "hosted";
259
258
  local: "local";
259
+ hosted: "hosted";
260
260
  }>;
261
261
  provider: z.ZodLiteral<"toolhive">;
262
262
  authorization_env: z.ZodDefault<z.ZodString>;
@@ -299,10 +299,10 @@ declare const configSchema: z.ZodObject<{
299
299
  }, z.core.$strict>>;
300
300
  output: z.ZodOptional<z.ZodObject<{
301
301
  format: z.ZodEnum<{
302
+ json_schema: "json_schema";
302
303
  text: "text";
303
304
  json: "json";
304
305
  jsonl: "jsonl";
305
- json_schema: "json_schema";
306
306
  }>;
307
307
  repair: z.ZodOptional<z.ZodObject<{
308
308
  enabled: z.ZodOptional<z.ZodBoolean>;
@@ -371,10 +371,10 @@ declare const configSchema: z.ZodObject<{
371
371
  disabled: "disabled";
372
372
  }>>>;
373
373
  output_formats: z.ZodOptional<z.ZodArray<z.ZodEnum<{
374
+ json_schema: "json_schema";
374
375
  text: "text";
375
376
  json: "json";
376
377
  jsonl: "jsonl";
377
- json_schema: "json_schema";
378
378
  }>>>;
379
379
  rules: z.ZodOptional<z.ZodBoolean>;
380
380
  skills: z.ZodOptional<z.ZodBoolean>;
@@ -9,17 +9,28 @@ function fallbackModelSelection(models, options) {
9
9
  skipped: []
10
10
  };
11
11
  const disabled = disabledModels();
12
- const enabled = models.filter((candidate) => !disabled.has(candidate));
13
- const disabledSkipped = models.filter((candidate) => disabled.has(candidate));
14
- if (!options) {
12
+ const available = options?.available;
13
+ const enabled = models.filter((candidate) => !disabled.has(candidate) && isAvailable(candidate, available));
14
+ const skipped = models.filter((candidate) => disabled.has(candidate) || !isAvailable(candidate, available));
15
+ const sizing = sizingFromOptions(options);
16
+ if (!sizing) {
15
17
  const model = enabled[0];
16
18
  return {
17
19
  model,
18
20
  reason: selectionReason(model),
19
- skipped: disabledSkipped
21
+ skipped
20
22
  };
21
23
  }
22
- return sizedSelection(enabled, disabledSkipped, options);
24
+ return sizedSelection(enabled, skipped, sizing);
25
+ }
26
+ function isAvailable(candidate, available) {
27
+ return available ? available.has(candidate) : true;
28
+ }
29
+ function sizingFromOptions(options) {
30
+ if (options?.budget && typeof options.estimatedTokens === "number") return {
31
+ budget: options.budget,
32
+ estimatedTokens: options.estimatedTokens
33
+ };
23
34
  }
24
35
  function sizedSelection(enabled, disabledSkipped, options) {
25
36
  const { estimatedTokens, budget } = options;
@@ -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";
10
8
  "workflow.success": "workflow.success";
11
9
  "workflow.failure": "workflow.failure";
12
10
  "workflow.complete": "workflow.complete";
11
+ "node.start": "node.start";
13
12
  "node.success": "node.success";
14
13
  "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";
99
97
  "workflow.success": "workflow.success";
100
98
  "workflow.failure": "workflow.failure";
101
99
  "workflow.complete": "workflow.complete";
100
+ "node.start": "node.start";
102
101
  "node.success": "node.success";
103
102
  "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<{
@@ -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";
211
209
  "workflow.success": "workflow.success";
212
210
  "workflow.failure": "workflow.failure";
213
211
  "workflow.complete": "workflow.complete";
212
+ "node.start": "node.start";
214
213
  "node.success": "node.success";
215
214
  "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<{
@@ -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.planned": "workflow.planned";
14
13
  "workflow.start": "workflow.start";
14
+ "workflow.planned": "workflow.planned";
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";
58
60
  "agent.finish": "agent.finish";
59
61
  "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.planned": "workflow.planned";
184
183
  "workflow.start": "workflow.start";
184
+ "workflow.planned": "workflow.planned";
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";
228
230
  "agent.finish": "agent.finish";
229
231
  "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>;
@@ -1,3 +1,4 @@
1
+ import { flattenNodes } from "../../planning/graph.js";
1
2
  import { isRecord } from "../../safe-json.js";
2
3
  import { runtimeActorId } from "../actor-ids.js";
3
4
  import { parseRuntimeOutput, validateJsonSchemaSource } from "../json-validation/json-validation.js";
@@ -125,7 +126,7 @@ function emitWorkflowPlanned(context) {
125
126
  }
126
127
  function emitWorkflowStarted(context) {
127
128
  emit(context, {
128
- nodeIds: context.plan.topologicalOrder.map((node) => node.id),
129
+ nodeIds: flattenNodes(context.plan.topologicalOrder, (node) => node.children).map((node) => node.id),
129
130
  type: "workflow.start",
130
131
  workflowId: context.workflowId
131
132
  });
package/package.json CHANGED
@@ -126,7 +126,7 @@
126
126
  "prepack": "bun run build:cli"
127
127
  },
128
128
  "type": "module",
129
- "version": "3.1.1",
129
+ "version": "3.2.0",
130
130
  "description": "Config-driven multi-agent pipeline runner for repository work",
131
131
  "main": "./dist/index.js",
132
132
  "types": "./dist/index.d.ts",