@oisincoveney/pipeline 3.19.0 → 3.19.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.
@@ -34,8 +34,41 @@ declare const submitRunnerArgoWorkflowOptionsSchema: z.ZodObject<{
34
34
  name: z.ZodOptional<z.ZodString>;
35
35
  namespace: z.ZodString;
36
36
  payloadJson: z.ZodString;
37
+ serviceAccountName: z.ZodOptional<z.ZodString>;
37
38
  scheduleYaml: z.ZodString;
39
+ }, z.core.$strict>;
40
+ declare const submitDynamicRunnerArgoWorkflowOptionsSchema: z.ZodObject<{
41
+ brokerAuth: z.ZodObject<{
42
+ secretKey: z.ZodDefault<z.ZodString>;
43
+ secretName: z.ZodString;
44
+ url: z.ZodDefault<z.ZodString>;
45
+ }, z.core.$strict>;
46
+ dbAuth: z.ZodOptional<z.ZodObject<{
47
+ secretKey: z.ZodDefault<z.ZodString>;
48
+ secretName: z.ZodString;
49
+ }, z.core.$strict>>;
50
+ eventAuthSecretKey: z.ZodOptional<z.ZodString>;
51
+ eventAuthSecretName: z.ZodOptional<z.ZodString>;
52
+ generateName: z.ZodOptional<z.ZodString>;
53
+ gitCredentialsSecretName: z.ZodOptional<z.ZodString>;
54
+ githubAuthSecretName: z.ZodOptional<z.ZodString>;
55
+ image: z.ZodOptional<z.ZodString>;
56
+ imagePullPolicy: z.ZodOptional<z.ZodEnum<{
57
+ Always: "Always";
58
+ IfNotPresent: "IfNotPresent";
59
+ Never: "Never";
60
+ }>>;
61
+ imagePullSecretName: z.ZodOptional<z.ZodString>;
62
+ kubeconfigPath: z.ZodOptional<z.ZodString>;
63
+ mcpGatewayAuth: z.ZodOptional<z.ZodObject<{
64
+ secretKey: z.ZodDefault<z.ZodString>;
65
+ secretName: z.ZodString;
66
+ }, z.core.$strict>>;
67
+ name: z.ZodOptional<z.ZodString>;
68
+ namespace: z.ZodString;
69
+ payloadJson: z.ZodString;
38
70
  serviceAccountName: z.ZodOptional<z.ZodString>;
71
+ workflowId: z.ZodString;
39
72
  }, z.core.$strict>;
40
73
  declare const commandScheduleOptionsSchema: z.ZodObject<{
41
74
  command: z.ZodArray<z.ZodString>;
@@ -53,8 +86,8 @@ interface SubmitRunnerArgoWorkflowDependencies {
53
86
  kubeConfig?: KubernetesArgoIoDependencies["kubeConfig"];
54
87
  workflowApi?: WorkflowApi;
55
88
  }
56
- type SubmitDynamicRunnerArgoWorkflowOptions = Omit<SubmitRunnerArgoWorkflowOptions, "scheduleYaml"> & {
57
- workflowId: string;
89
+ type SubmitDynamicRunnerArgoWorkflowOptions = z.input<typeof submitDynamicRunnerArgoWorkflowOptionsSchema> & {
90
+ config: PipelineConfig;
58
91
  };
59
92
  declare function submitRunnerArgoWorkflow(rawOptions: SubmitRunnerArgoWorkflowOptions, dependencies?: SubmitRunnerArgoWorkflowDependencies): Promise<SubmitRunnerArgoWorkflowResult>;
60
93
  declare function submitDynamicRunnerArgoWorkflow(rawOptions: SubmitDynamicRunnerArgoWorkflowOptions, dependencies?: SubmitRunnerArgoWorkflowDependencies): Promise<SubmitRunnerArgoWorkflowResult>;
@@ -28,7 +28,7 @@ const createdWorkflowSchema = z.object({ metadata: z.object({
28
28
  name: z.string().min(1).optional(),
29
29
  uid: z.string().min(1).optional()
30
30
  }).passthrough() }).passthrough();
31
- const submitRunnerArgoWorkflowOptionsSchema = z.object({
31
+ const submitRunnerArgoWorkflowBaseOptionShape = {
32
32
  brokerAuth: brokerAuthOptionSchema,
33
33
  dbAuth: dbAuthOptionSchema.optional(),
34
34
  eventAuthSecretKey: z.string().min(1).optional(),
@@ -48,15 +48,25 @@ const submitRunnerArgoWorkflowOptionsSchema = z.object({
48
48
  name: z.string().min(1).optional(),
49
49
  namespace: z.string().min(1),
50
50
  payloadJson: z.string().min(1),
51
- scheduleYaml: z.string().min(1),
52
51
  serviceAccountName: z.string().min(1).optional()
53
- }).strict().refine((options) => options.name !== void 0 || options.generateName !== void 0, { message: "Argo submit options must declare name or generateName" });
52
+ };
53
+ const submitRunnerArgoWorkflowOptionsSchema = z.object({
54
+ ...submitRunnerArgoWorkflowBaseOptionShape,
55
+ scheduleYaml: z.string().min(1)
56
+ }).strict().refine(hasWorkflowName, { message: "Argo submit options must declare name or generateName" });
57
+ const submitDynamicRunnerArgoWorkflowOptionsSchema = z.object({
58
+ ...submitRunnerArgoWorkflowBaseOptionShape,
59
+ workflowId: z.string().min(1)
60
+ }).strict().refine(hasWorkflowName, { message: "Argo submit options must declare name or generateName" });
54
61
  const commandScheduleOptionsSchema = z.object({
55
62
  command: z.array(z.string().min(1)).min(1),
56
63
  generatedAt: z.date().default(() => /* @__PURE__ */ new Date()),
57
64
  scheduleId: scheduleIdSchema.optional(),
58
65
  task: z.string().min(1)
59
66
  }).strict();
67
+ function hasWorkflowName(options) {
68
+ return options.name !== void 0 || options.generateName !== void 0;
69
+ }
60
70
  function submitRunnerArgoWorkflow(rawOptions, dependencies = {}) {
61
71
  return Effect.runPromise(Effect.provide(Effect.suspend(() => submitRunnerArgoWorkflowEffect(rawOptions, dependencies)), KubernetesArgoServiceLive));
62
72
  }
@@ -170,22 +180,19 @@ function submitRunnerArgoWorkflowEffect(rawOptions, dependencies) {
170
180
  });
171
181
  }
172
182
  function submitDynamicRunnerArgoWorkflowEffect(rawOptions, dependencies) {
173
- const { config: _config, workflowId, ...schemaOptions } = rawOptions;
174
- const options = submitRunnerArgoWorkflowOptionsSchema.omit({ scheduleYaml: true }).extend({ workflowId: z.string().min(1) }).parse({
175
- ...schemaOptions,
176
- workflowId
177
- });
183
+ const { config: _config, ...schemaOptions } = rawOptions;
184
+ const options = submitDynamicRunnerArgoWorkflowOptionsSchema.parse(schemaOptions);
178
185
  const { payload, payloadJson } = normalizeRunnerPayloadForSubmit({
179
186
  payload: runnerCommandPayloadSchema.parse(parseRunnerCommandPayload(options.payloadJson)),
180
187
  payloadJson: options.payloadJson
181
188
  });
182
- if (payload.workflow.id !== workflowId) throw new Error(`Runner payload workflow '${payload.workflow.id}' does not match dynamic workflow '${workflowId}'`);
189
+ if (payload.workflow.id !== options.workflowId) throw new Error(`Runner payload workflow '${payload.workflow.id}' does not match dynamic workflow '${options.workflowId}'`);
183
190
  const payloadConfigMapName = `pipeline-payload-${randomBytes(6).toString("hex")}`;
184
191
  const labels = {
185
192
  "pipeline.oisin.dev/project": payload.run.project,
186
193
  "pipeline.oisin.dev/run-id": payload.run.id,
187
194
  "pipeline.oisin.dev/source": "argo-workflow",
188
- "pipeline.oisin.dev/workflow": workflowId
195
+ "pipeline.oisin.dev/workflow": options.workflowId
189
196
  };
190
197
  const workflow = buildDynamicRunnerArgoWorkflowManifest({
191
198
  annotations: payload.task.kind === "ticket" ? {
@@ -203,12 +210,13 @@ function submitDynamicRunnerArgoWorkflowEffect(rawOptions, dependencies) {
203
210
  image: options.image,
204
211
  imagePullPolicy: options.imagePullPolicy,
205
212
  imagePullSecretName: options.imagePullSecretName,
213
+ mcpGatewayAuth: options.mcpGatewayAuth,
206
214
  labels,
207
215
  name: options.name,
208
216
  namespace: options.namespace,
209
217
  payloadConfigMapName,
210
218
  serviceAccountName: options.serviceAccountName,
211
- workflowId
219
+ workflowId: options.workflowId
212
220
  });
213
221
  return Effect.gen(function* () {
214
222
  const service = yield* KubernetesArgoService;
@@ -35,8 +35,8 @@ const DEFAULT_RUNNER_RESOURCES = {
35
35
  memory: "12Gi"
36
36
  },
37
37
  requests: {
38
- cpu: "1",
39
- memory: "5Gi"
38
+ cpu: "500m",
39
+ memory: "1Gi"
40
40
  }
41
41
  };
42
42
  const DEFAULT_RUNNER_DEADLINE_SECONDS = 5400;
@@ -55,11 +55,21 @@ function runPreSchedulePhase(rawOptions = {}) {
55
55
  function runPreSchedulePhaseEffect(options) {
56
56
  return Effect.gen(function* () {
57
57
  const context = yield* preScheduleContextEffect(options);
58
+ yield* ensurePreScheduleRunRecordEffect(context);
58
59
  const result = options.phase === "generate-schedule" ? yield* generateSchedulePhaseEffect(context) : yield* runAgentPhaseEffect(options, context);
59
60
  yield* recordPhaseResultEffect(context, result);
60
61
  return result.status === "passed" ? DYNAMIC_COMMAND_EXIT.pass : DYNAMIC_COMMAND_EXIT.fail;
61
62
  }).pipe(Effect.catch((error) => Effect.sync(() => dynamicRunnerCommandErrorExit(error, options.stderr))));
62
63
  }
64
+ function ensurePreScheduleRunRecordEffect(context) {
65
+ return context.persistence.runControlStore.createRun({
66
+ effort: "normal",
67
+ mode: "write",
68
+ nodeIds: [...preScheduleNodeIds()],
69
+ runId: context.payload.run.id,
70
+ target: "remote"
71
+ }).pipe(Effect.asVoid);
72
+ }
63
73
  function preScheduleContextEffect(options) {
64
74
  return Effect.gen(function* () {
65
75
  const { config, payload, persistence, worktreePath } = yield* dynamicRunnerContextEffect(options);
package/package.json CHANGED
@@ -132,7 +132,7 @@
132
132
  "prepack": "nub run build:cli"
133
133
  },
134
134
  "type": "module",
135
- "version": "3.19.0",
135
+ "version": "3.19.2",
136
136
  "description": "Config-driven multi-agent pipeline runner for repository work",
137
137
  "main": "./dist/index.js",
138
138
  "types": "./dist/index.d.ts",