@oisincoveney/pipeline 1.15.0 → 1.15.2

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 (39) hide show
  1. package/dist/config.d.ts +3 -3
  2. package/dist/hooks.d.ts +1 -1
  3. package/dist/index.js +7 -1
  4. package/dist/install-commands.js +3 -2
  5. package/dist/pipeline-init.js +1 -1
  6. package/dist/pipeline-runtime.d.ts +3 -227
  7. package/dist/pipeline-runtime.js +31 -1614
  8. package/dist/runner-job-contract.d.ts +1 -1
  9. package/dist/runtime/agent-node/agent-node.js +271 -0
  10. package/dist/runtime/agent-node/index.js +2 -0
  11. package/dist/runtime/builtins/builtins.js +48 -0
  12. package/dist/runtime/builtins/index.js +2 -0
  13. package/dist/runtime/changed-files/changed-files.js +34 -0
  14. package/dist/runtime/changed-files/index.js +2 -0
  15. package/dist/runtime/command-executor/command-executor.js +53 -0
  16. package/dist/runtime/command-executor/index.js +2 -0
  17. package/dist/runtime/context/context.js +93 -0
  18. package/dist/runtime/context/index.js +2 -0
  19. package/dist/runtime/contracts/contracts.d.ts +229 -0
  20. package/dist/runtime/contracts/index.d.ts +1 -0
  21. package/dist/runtime/drain-merge/drain-merge.js +154 -0
  22. package/dist/runtime/drain-merge/index.js +2 -0
  23. package/dist/runtime/events/events.js +259 -0
  24. package/dist/runtime/events/index.js +2 -0
  25. package/dist/runtime/gates/gates.js +296 -0
  26. package/dist/runtime/gates/index.js +2 -0
  27. package/dist/runtime/hooks/hooks.js +261 -0
  28. package/dist/runtime/hooks/index.js +2 -0
  29. package/dist/runtime/json-validation/index.js +2 -0
  30. package/dist/runtime/json-validation/json-validation.js +82 -0
  31. package/dist/runtime/parallel-node/index.js +2 -0
  32. package/dist/runtime/parallel-node/parallel-node.js +105 -0
  33. package/dist/runtime/worktrees/index.js +2 -0
  34. package/dist/runtime/worktrees/worktrees.js +55 -0
  35. package/dist/runtime-machines/contracts.d.ts +1 -2
  36. package/dist/runtime-machines/node-machine.d.ts +1 -0
  37. package/dist/runtime-machines/workflow-machine.d.ts +1 -0
  38. package/dist/schedule-planner.js +47 -1
  39. package/package.json +1 -1
package/dist/config.d.ts CHANGED
@@ -222,8 +222,8 @@ declare const configSchema: z.ZodObject<{
222
222
  policy: z.ZodOptional<z.ZodObject<{
223
223
  commands: z.ZodOptional<z.ZodEnum<{
224
224
  allow: "allow";
225
- deny: "deny";
226
225
  "trusted-only": "trusted-only";
226
+ deny: "deny";
227
227
  }>>;
228
228
  modules: z.ZodOptional<z.ZodEnum<{
229
229
  allow: "allow";
@@ -277,10 +277,10 @@ declare const configSchema: z.ZodObject<{
277
277
  }, z.core.$strict>>;
278
278
  output: z.ZodOptional<z.ZodObject<{
279
279
  format: z.ZodEnum<{
280
- json_schema: "json_schema";
281
280
  text: "text";
282
281
  json: "json";
283
282
  jsonl: "jsonl";
283
+ json_schema: "json_schema";
284
284
  }>;
285
285
  repair: z.ZodOptional<z.ZodObject<{
286
286
  enabled: z.ZodOptional<z.ZodBoolean>;
@@ -320,10 +320,10 @@ declare const configSchema: z.ZodObject<{
320
320
  disabled: "disabled";
321
321
  }>>>;
322
322
  output_formats: z.ZodOptional<z.ZodArray<z.ZodEnum<{
323
- json_schema: "json_schema";
324
323
  text: "text";
325
324
  json: "json";
326
325
  jsonl: "jsonl";
326
+ json_schema: "json_schema";
327
327
  }>>>;
328
328
  rules: z.ZodOptional<z.ZodBoolean>;
329
329
  skills: z.ZodOptional<z.ZodBoolean>;
package/dist/hooks.d.ts CHANGED
@@ -13,8 +13,8 @@ declare const hookResultSchema: z.ZodObject<{
13
13
  taskContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
14
14
  }, z.core.$strict>>;
15
15
  status: z.ZodEnum<{
16
- pass: "pass";
17
16
  fail: "fail";
17
+ pass: "pass";
18
18
  skip: "skip";
19
19
  }>;
20
20
  summary: z.ZodOptional<z.ZodString>;
package/dist/index.js CHANGED
@@ -55,7 +55,13 @@ async function runConfiguredPipeline(inputs) {
55
55
  task: inputs.task,
56
56
  worktreePath: inputs.worktreePath
57
57
  });
58
- console.log([`Schedule generated: ${result.path}`, `Run after approval: pipe run --schedule ${result.path}`].join("\n"));
58
+ console.log(`Schedule generated: ${result.path}`);
59
+ const compiled = compileScheduleArtifact(config, result.artifact, inputs.worktreePath);
60
+ await runAndPrintPipeline({
61
+ ...inputs,
62
+ config: compiled.config,
63
+ workflow: compiled.workflowId
64
+ });
59
65
  return;
60
66
  }
61
67
  await runAndPrintPipeline({
@@ -145,6 +145,7 @@ function orchestratorBlock(config) {
145
145
  return [
146
146
  "Configured orchestrator:",
147
147
  grants(orchestratorProfile(config)),
148
+ `hooks: ${Object.keys(config.hooks.functions).join(", ") || "none"}`,
148
149
  "",
149
150
  instructionsPointer(orchestratorProfile(config))
150
151
  ].join("\n");
@@ -172,8 +173,8 @@ function entrypointDispatchBlock(host, config, id, entrypoint) {
172
173
  return [
173
174
  `Generate a schedule for entrypoint \`${id}\` and the user task.`,
174
175
  `The schedule policy is \`${entrypoint.schedule}\`.`,
175
- `Run \`pipe run --entrypoint ${id} <task description>\` to write the schedule artifact, then stop for approval.`,
176
- "Do not execute workflow nodes until the user runs `pipe run --schedule <schedule.yaml>`."
176
+ `Run \`pipe run --entrypoint ${id} <task description>\` to generate and execute the schedule artifact.`,
177
+ "Use `pipe run --schedule <schedule.yaml>` only when rerunning an existing schedule artifact."
177
178
  ].join("\n");
178
179
  }
179
180
  function nativeDispatchBlock(host, routes) {
@@ -568,7 +568,7 @@ const EPIC_TRACK_ITEM_SCHEMA = z.object({
568
568
  title: z.string().optional()
569
569
  });
570
570
  function zodJsonSchema(schema) {
571
- return JSON.stringify(z.toJSONSchema(schema, { target: "draft-07" }), null, 2);
571
+ return JSON.stringify(z.toJSONSchema(schema, { target: "draft-2020-12" }), null, 2);
572
572
  }
573
573
  const RESEARCH_SCHEMA = zodJsonSchema(z.object({
574
574
  ac: STRING_ARRAY_SCHEMA,
@@ -1,231 +1,7 @@
1
- import { HookEvent, PipelineConfig, PipelineConfigError } from "./config.js";
2
- import { HookResult } from "./hooks.js";
3
- import { AgentResult, RunnerExecutionOptions, RunnerLaunchPlan } from "./runner.js";
4
- import { RuntimeActorDescriptor, RuntimeObservabilityEvent } from "./runtime-machines/contracts.js";
5
- import { PlannedWorkflowNode, WorkflowExecutionPlan } from "./workflow-planner.js";
6
-
1
+ import { PipelineConfigError } from "./config.js";
2
+ import { AcceptanceCriterion, HookRuntimePolicy, NodeExecutionState, NodeStatus, PipelineRuntimeEvent, PipelineRuntimeObservabilityLevel, PipelineRuntimeOptions, PipelineRuntimeResult, PipelineTaskContext, RuntimeFailure, RuntimeGateResult, RuntimeNodeResult } from "./runtime/contracts/contracts.js";
7
3
  //#region src/pipeline-runtime.d.ts
8
- interface AcceptanceCriterion {
9
- id: string;
10
- text: string;
11
- }
12
- interface PipelineTaskContext {
13
- acceptanceCriteria?: AcceptanceCriterion[];
14
- description?: string;
15
- id?: string;
16
- title?: string;
17
- }
18
- interface HookRuntimePolicy {
19
- allowCommandHooks?: boolean;
20
- allowUntrustedCommandHooks?: boolean;
21
- env?: Record<string, string>;
22
- envPassthrough?: string[];
23
- outputLimitBytes?: number;
24
- timeoutMs?: number;
25
- }
26
- interface RuntimeFailure {
27
- evidence: string[];
28
- gate: string;
29
- nodeId?: string;
30
- reason: string;
31
- }
32
- interface RuntimeGateResult {
33
- evidence: string[];
34
- gateId: string;
35
- kind: string;
36
- nodeId: string;
37
- passed: boolean;
38
- reason?: string;
39
- }
40
- interface RuntimeNodeResult {
41
- attempts: number;
42
- evidence: string[];
43
- exitCode: number;
44
- nodeId: string;
45
- output: string;
46
- status: "failed" | "passed";
47
- }
48
- type NodeStatus = "cancelled" | "failed" | "gating" | "passed" | "pending" | "ready" | "running" | "skipped";
49
- interface NodeExecutionState {
50
- attempts: number;
51
- evidence: string[];
52
- exitCode?: number;
53
- failure?: RuntimeFailure;
54
- finishedAt?: string;
55
- gates: RuntimeGateResult[];
56
- id: string;
57
- output?: string;
58
- retry?: {
59
- attempt: number;
60
- delayMs: number;
61
- evidence: string[];
62
- exhausted: boolean;
63
- gate: string;
64
- reason: string;
65
- retryReason: string;
66
- scheduled: boolean;
67
- };
68
- startedAt?: string;
69
- status: NodeStatus;
70
- }
71
- interface PipelineRuntimeResult {
72
- agentInvocations: RunnerLaunchPlan[];
73
- failureDetails: RuntimeFailure[];
74
- gates: RuntimeGateResult[];
75
- hookFailures: RuntimeFailure[];
76
- nodeStates: Record<string, NodeExecutionState>;
77
- nodes: RuntimeNodeResult[];
78
- outcome: "CANCELLED" | "FAIL" | "PASS";
79
- plan: WorkflowExecutionPlan;
80
- }
81
- type PipelineRuntimeObservabilityLevel = "info" | "warn";
82
- type PipelineRuntimeEvent = {
83
- parentNodeId?: string;
84
- } & ({
85
- edges: {
86
- source: string;
87
- target: string;
88
- }[];
89
- nodes: {
90
- id: string;
91
- kind: PlannedWorkflowNode["kind"];
92
- needs: string[];
93
- profile?: string;
94
- runnerId?: string;
95
- }[];
96
- type: "workflow.planned";
97
- workflowId: string;
98
- } | {
99
- nodeIds: string[];
100
- type: "workflow.start";
101
- workflowId: string;
102
- } | {
103
- attempt: number;
104
- nodeId: string;
105
- profile?: string;
106
- runnerId?: string;
107
- type: "node.start";
108
- } | {
109
- attempt: number;
110
- exitCode: number;
111
- nodeId: string;
112
- profile?: string;
113
- runnerId?: string;
114
- status: RuntimeNodeResult["status"];
115
- type: "node.finish";
116
- } | {
117
- attempt: number;
118
- format: string;
119
- nodeId: string;
120
- output: unknown;
121
- parseError?: string;
122
- profile?: string;
123
- schemaPath?: string;
124
- type: "node.output.recorded";
125
- } | {
126
- attempt: number;
127
- nodeId: string;
128
- profile?: string;
129
- runnerId?: string;
130
- type: "agent.start";
131
- } | {
132
- attempt: number;
133
- exitCode: number;
134
- nodeId: string;
135
- profile?: string;
136
- runnerId?: string;
137
- type: "agent.finish";
138
- } | {
139
- gateId: string;
140
- kind: string;
141
- nodeId: string;
142
- type: "gate.start";
143
- } | {
144
- evidence?: string[];
145
- gateId: string;
146
- kind: string;
147
- nodeId: string;
148
- passed: boolean;
149
- reason?: string;
150
- type: "gate.finish";
151
- } | {
152
- nodeId: string;
153
- path: string;
154
- required: boolean;
155
- type: "artifact.check.start";
156
- } | {
157
- nodeId: string;
158
- passed: boolean;
159
- path: string;
160
- reason?: string;
161
- required: boolean;
162
- type: "artifact.check.finish";
163
- } | {
164
- event: HookEvent;
165
- functionId: string;
166
- gateId?: string;
167
- hookId: string;
168
- nodeId?: string;
169
- required: boolean;
170
- type: "hook.start";
171
- workflowId: string;
172
- } | {
173
- event: HookEvent;
174
- functionId: string;
175
- gateId?: string;
176
- hookId: string;
177
- nodeId?: string;
178
- passed: boolean;
179
- reason?: string;
180
- required: boolean;
181
- type: "hook.finish";
182
- workflowId: string;
183
- } | {
184
- artifacts?: HookResult["artifacts"];
185
- event: HookEvent;
186
- functionId: string;
187
- gateId?: string;
188
- hookId: string;
189
- nodeId?: string;
190
- outputs?: Record<string, unknown>;
191
- status: HookResult["status"];
192
- summary?: string;
193
- type: "hook.result";
194
- workflowId: string;
195
- } | {
196
- attempt: number;
197
- nodeId: string;
198
- passed: boolean;
199
- reason?: string;
200
- type: "output.repair";
201
- } | {
202
- actor: RuntimeActorDescriptor;
203
- level: PipelineRuntimeObservabilityLevel;
204
- name: RuntimeObservabilityEvent["type"];
205
- nodeId?: string;
206
- summary: string;
207
- type: "runtime.observability";
208
- workflowId: string;
209
- } | {
210
- outcome: PipelineRuntimeResult["outcome"];
211
- type: "workflow.finish";
212
- workflowId: string;
213
- });
214
- interface PipelineRuntimeOptions {
215
- config?: PipelineConfig;
216
- entrypoint?: string;
217
- executor?: (plan: RunnerLaunchPlan, options: RunnerExecutionOptions) => AgentResult | Promise<AgentResult>;
218
- hookPolicy?: HookRuntimePolicy;
219
- maxParallelNodes?: number;
220
- reporter?: (event: PipelineRuntimeEvent) => void;
221
- runId?: string;
222
- signal?: AbortSignal;
223
- task: string;
224
- taskContext?: PipelineTaskContext;
225
- workflowId?: string;
226
- worktreePath?: string;
227
- }
228
4
  declare function runPipelineFromConfig(options: PipelineRuntimeOptions): Promise<PipelineRuntimeResult>;
229
5
  declare function formatConfigError(err: PipelineConfigError): string;
230
6
  //#endregion
231
- export { AcceptanceCriterion, HookRuntimePolicy, NodeExecutionState, NodeStatus, PipelineRuntimeEvent, PipelineRuntimeObservabilityLevel, PipelineRuntimeOptions, PipelineRuntimeResult, PipelineTaskContext, RuntimeFailure, RuntimeGateResult, RuntimeNodeResult, formatConfigError, runPipelineFromConfig };
7
+ export { type AcceptanceCriterion, type HookRuntimePolicy, type NodeExecutionState, type NodeStatus, type PipelineRuntimeEvent, type PipelineRuntimeObservabilityLevel, type PipelineRuntimeOptions, type PipelineRuntimeResult, type PipelineTaskContext, type RuntimeFailure, type RuntimeGateResult, type RuntimeNodeResult, formatConfigError, runPipelineFromConfig };