@oisincoveney/pipeline 1.10.3 → 1.11.1

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.
package/dist/config.d.ts CHANGED
@@ -222,10 +222,10 @@ declare const configSchema: z.ZodObject<{
222
222
  }, z.core.$strict>>;
223
223
  output: z.ZodOptional<z.ZodObject<{
224
224
  format: z.ZodEnum<{
225
- json_schema: "json_schema";
226
225
  text: "text";
227
226
  json: "json";
228
227
  jsonl: "jsonl";
228
+ json_schema: "json_schema";
229
229
  }>;
230
230
  repair: z.ZodOptional<z.ZodObject<{
231
231
  enabled: z.ZodOptional<z.ZodBoolean>;
@@ -238,7 +238,6 @@ declare const configSchema: z.ZodObject<{
238
238
  runner: z.ZodString;
239
239
  skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
240
240
  tools: z.ZodOptional<z.ZodArray<z.ZodEnum<{
241
- task: "task";
242
241
  read: "read";
243
242
  list: "list";
244
243
  grep: "grep";
@@ -246,6 +245,7 @@ declare const configSchema: z.ZodObject<{
246
245
  bash: "bash";
247
246
  edit: "edit";
248
247
  write: "write";
248
+ task: "task";
249
249
  }>>>;
250
250
  }, z.core.$strict>>>;
251
251
  rules: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -265,15 +265,14 @@ declare const configSchema: z.ZodObject<{
265
265
  disabled: "disabled";
266
266
  }>>>;
267
267
  output_formats: z.ZodOptional<z.ZodArray<z.ZodEnum<{
268
- json_schema: "json_schema";
269
268
  text: "text";
270
269
  json: "json";
271
270
  jsonl: "jsonl";
271
+ json_schema: "json_schema";
272
272
  }>>>;
273
273
  rules: z.ZodOptional<z.ZodBoolean>;
274
274
  skills: z.ZodOptional<z.ZodBoolean>;
275
275
  tools: z.ZodOptional<z.ZodArray<z.ZodEnum<{
276
- task: "task";
277
276
  read: "read";
278
277
  list: "list";
279
278
  grep: "grep";
@@ -281,6 +280,7 @@ declare const configSchema: z.ZodObject<{
281
280
  bash: "bash";
282
281
  edit: "edit";
283
282
  write: "write";
283
+ task: "task";
284
284
  }>>>;
285
285
  }, z.core.$strict>;
286
286
  command: z.ZodOptional<z.ZodString>;
@@ -4,6 +4,7 @@ import { loadPipelineConfig } from "./config.js";
4
4
  import { compileWorkflowPlan } from "./workflow-planner.js";
5
5
  import { artifactExists, runJscpd, runSemgrep, runTests, runTypecheck } from "./gates.js";
6
6
  import { createRunnerLaunchPlan, runLaunchPlan } from "./runner.js";
7
+ import { normalizeRunnerOutput } from "./runner-output.js";
7
8
  import { runtimeActorId } from "./runtime-machines/contracts.js";
8
9
  import { gateEvaluationMachine } from "./runtime-machines/gate-machine.js";
9
10
  import { hookInvocationMachine } from "./runtime-machines/hook-machine.js";
@@ -1143,45 +1144,7 @@ function createOutputRepairPlan(inputs) {
1143
1144
  });
1144
1145
  }
1145
1146
  function normalizeAgentOutput(plan, stdout) {
1146
- if (plan.type === "codex") {
1147
- const text = lastJsonLineValue(stdout, (value) => {
1148
- if (!isRecord(value)) return;
1149
- const item = value.item;
1150
- if (isRecord(item) && item.type === "agent_message") return typeof item.text === "string" ? item.text : void 0;
1151
- if (value.type === "agent_message") return typeof value.text === "string" ? value.text : void 0;
1152
- });
1153
- if (text) return {
1154
- evidence: ["normalized runner output from codex JSONL"],
1155
- output: text
1156
- };
1157
- }
1158
- if (plan.type === "opencode") {
1159
- const text = lastJsonLineValue(stdout, (value) => {
1160
- if (!isRecord(value)) return;
1161
- const part = value.part;
1162
- if (isRecord(part) && part.type === "text") return typeof part.text === "string" ? part.text : void 0;
1163
- });
1164
- if (text) return {
1165
- evidence: ["normalized runner output from opencode JSON events"],
1166
- output: text
1167
- };
1168
- }
1169
- return {
1170
- evidence: [],
1171
- output: stdout
1172
- };
1173
- }
1174
- function lastJsonLineValue(text, extract) {
1175
- let latest;
1176
- for (const line of text.split(LINE_RE)) {
1177
- const trimmed = line.trim();
1178
- if (!trimmed) continue;
1179
- try {
1180
- const extracted = extract(parseJson(trimmed, "runner JSON event"));
1181
- if (extracted) latest = extracted;
1182
- } catch {}
1183
- }
1184
- return latest;
1147
+ return normalizeRunnerOutput(plan, stdout);
1185
1148
  }
1186
1149
  function renderAgentPrompt(node, context) {
1187
1150
  const profile = node.profile ? context.config.profiles[node.profile] : void 0;
@@ -0,0 +1,48 @@
1
+ import { isRecord, parseJson } from "./safe-json.js";
2
+ //#region src/runner-output.ts
3
+ const LINE_RE = /\r?\n/;
4
+ function normalizeRunnerOutput(plan, stdout) {
5
+ if (plan.type === "codex") {
6
+ const output = lastJsonLineValue(stdout, codexAgentMessageText);
7
+ if (output) return {
8
+ evidence: ["normalized runner output from codex JSONL"],
9
+ output
10
+ };
11
+ }
12
+ if (plan.type === "opencode") {
13
+ const output = lastJsonLineValue(stdout, opencodeTextPart);
14
+ if (output) return {
15
+ evidence: ["normalized runner output from opencode JSON events"],
16
+ output
17
+ };
18
+ }
19
+ return {
20
+ evidence: [],
21
+ output: stdout
22
+ };
23
+ }
24
+ function codexAgentMessageText(value) {
25
+ if (!isRecord(value)) return;
26
+ const item = value.item;
27
+ if (isRecord(item) && item.type === "agent_message") return typeof item.text === "string" ? item.text : void 0;
28
+ if (value.type === "agent_message") return typeof value.text === "string" ? value.text : void 0;
29
+ }
30
+ function opencodeTextPart(value) {
31
+ if (!isRecord(value)) return;
32
+ const part = value.part;
33
+ if (isRecord(part) && part.type === "text") return typeof part.text === "string" ? part.text : void 0;
34
+ }
35
+ function lastJsonLineValue(text, extract) {
36
+ let latest;
37
+ for (const line of text.split(LINE_RE)) {
38
+ const trimmed = line.trim();
39
+ if (!trimmed) continue;
40
+ try {
41
+ const extracted = extract(parseJson(trimmed, "runner JSON event"));
42
+ if (extracted) latest = extracted;
43
+ } catch {}
44
+ }
45
+ return latest;
46
+ }
47
+ //#endregion
48
+ export { normalizeRunnerOutput };
package/dist/safe-json.js CHANGED
@@ -8,5 +8,8 @@ function parseJson(value, label = "JSON") {
8
8
  throw new Error(`Failed to parse ${label}: ${message}`);
9
9
  }
10
10
  }
11
+ function isRecord(value) {
12
+ return typeof value === "object" && value !== null && !Array.isArray(value);
13
+ }
11
14
  //#endregion
12
- export { parseJson };
15
+ export { isRecord, parseJson };
@@ -1,6 +1,7 @@
1
1
  import { validatePipelineConfig, workflowSchema } from "./config.js";
2
2
  import { compileWorkflowPlan } from "./workflow-planner.js";
3
3
  import { createRunnerLaunchPlan, runLaunchPlan } from "./runner.js";
4
+ import { normalizeRunnerOutput } from "./runner-output.js";
4
5
  import { dirname, join } from "node:path";
5
6
  import { parseDocument, stringify } from "yaml";
6
7
  import { z } from "zod";
@@ -259,14 +260,16 @@ function implementationTrack(id) {
259
260
  }
260
261
  async function refineScheduleArtifact(baseline, plannerProfile, options) {
261
262
  if (!plannerProfile) return baseline;
262
- const result = await (options.executor ?? runLaunchPlan)(createRunnerLaunchPlan(options.config, {
263
+ const executor = options.executor ?? runLaunchPlan;
264
+ const plan = createRunnerLaunchPlan(options.config, {
263
265
  nodeId: "schedule-plan",
264
266
  profileId: plannerProfile,
265
267
  prompt: plannerPrompt(options.entrypointId, options.task, baseline),
266
268
  worktreePath: options.worktreePath
267
- }), {});
269
+ });
270
+ const result = await executor(plan, {});
268
271
  if (result.exitCode !== 0) throw new ScheduleArtifactError(`schedule planner '${plannerProfile}' failed with exit ${result.exitCode}`);
269
- const source = result.stdout.trim();
272
+ const source = normalizeRunnerOutput(plan, result.stdout).output.trim();
270
273
  if (!source) return baseline;
271
274
  return parseScheduleArtifact(source, "planner output");
272
275
  }
package/package.json CHANGED
@@ -91,7 +91,7 @@
91
91
  "prepack": "bun run build:cli"
92
92
  },
93
93
  "type": "module",
94
- "version": "1.10.3",
94
+ "version": "1.11.1",
95
95
  "description": "Config-driven multi-agent pipeline runner for repository work",
96
96
  "main": "./dist/index.js",
97
97
  "types": "./dist/index.d.ts",