@agimon-ai/po-workflow 0.0.0-alpha.119 → 0.0.0-alpha.120
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/{RecoverWorkflowService-2WMhxaZd.cjs → RecoverWorkflowService-DP1ICYxa.cjs} +197 -12
- package/dist/RecoverWorkflowService-DP1ICYxa.cjs.map +1 -0
- package/dist/{RecoverWorkflowService-ByQ8rI7w.mjs → RecoverWorkflowService-DhSyxVdq.mjs} +197 -12
- package/dist/RecoverWorkflowService-DhSyxVdq.mjs.map +1 -0
- package/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/extensions/server.cjs +17 -5
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.mjs +18 -6
- package/dist/extensions/server.mjs.map +1 -1
- package/package.json +8 -8
- package/dist/RecoverWorkflowService-2WMhxaZd.cjs.map +0 -1
- package/dist/RecoverWorkflowService-ByQ8rI7w.mjs.map +0 -1
|
@@ -57,7 +57,11 @@ const StepArtifactsSchema = zod.z.array(WorkflowRelativePathSchema).min(1).refin
|
|
|
57
57
|
* them (`${{ runConfig.<key> }}`, lists joined with commas) and hands the map to
|
|
58
58
|
* a host executor, which owns and validates the keys it understands.
|
|
59
59
|
*/
|
|
60
|
-
const RunConfigSchema = zod.z.record(zod.z.string(), zod.z.union([
|
|
60
|
+
const RunConfigSchema = zod.z.record(zod.z.string(), zod.z.union([
|
|
61
|
+
zod.z.string(),
|
|
62
|
+
zod.z.array(zod.z.string()),
|
|
63
|
+
zod.z.null()
|
|
64
|
+
])).describe("Host execution settings shared by customRun and command runners.");
|
|
61
65
|
/** What only an in-process host executor needs, beside the shared `runConfig`. */
|
|
62
66
|
const CustomRunEntrySchema = zod.z.object({
|
|
63
67
|
prompt: zod.z.string().min(1).describe("Prompt the host executor runs. Interpolated like a command."),
|
|
@@ -260,7 +264,9 @@ const AcceptanceCriterionSchema = zod.z.object({
|
|
|
260
264
|
artifacts: StepArtifactsSchema.optional()
|
|
261
265
|
}).strict();
|
|
262
266
|
const JobCompletionSchema = zod.z.object({ "max-continuations": zod.z.number().int().nonnegative().default(3) }).strict();
|
|
267
|
+
const JobIdentitySchema = zod.z.object({ roles: zod.z.array(zod.z.string().trim().min(1)).min(1).refine((roles) => new Set(roles).size === roles.length, "Identity roles must be unique.").describe("Roles one member of the run team must hold; every step of the job runs as that member.") }).strict();
|
|
263
268
|
const JobSchema = zod.z.object({
|
|
269
|
+
identity: JobIdentitySchema.optional(),
|
|
264
270
|
tools: WorkflowToolsPathSchema.optional(),
|
|
265
271
|
instructions: WorkflowInstructionsPathSchema.optional(),
|
|
266
272
|
runConfig: RunConfigSchema.optional(),
|
|
@@ -344,6 +350,7 @@ const WorkflowDefinitionSchema = zod.z.object({
|
|
|
344
350
|
instructions: WorkflowInstructionsPathSchema.optional(),
|
|
345
351
|
tags: zod.z.array(zod.z.string().trim().min(1)).optional().describe("Tags used to categorize and filter workflow definitions."),
|
|
346
352
|
workspace: zod.z.string().optional(),
|
|
353
|
+
team: zod.z.string().trim().min(1).optional().describe("Default team role-bound jobs resolve within; a launch may select another."),
|
|
347
354
|
runner: zod.z.string().optional().describe("Default runner key for step command maps when no CLI runner is provided."),
|
|
348
355
|
"default-runner": zod.z.string().optional().describe("Deprecated alias for runner."),
|
|
349
356
|
runners: zod.z.record(zod.z.string(), RunnerSchema).optional().describe("Named custom runners; selecting one lays its runConfig over every customRun step."),
|
|
@@ -370,8 +377,50 @@ const WorkflowDefinitionSchema = zod.z.object({
|
|
|
370
377
|
jobs: zod.z.record(zod.z.string(), JobSchema),
|
|
371
378
|
"child-jobs": zod.z.record(zod.z.string().min(1), JobSchema).optional()
|
|
372
379
|
});
|
|
380
|
+
/** Where a `runConfig` under this value sets a profile, as schema issue paths. */
|
|
381
|
+
function profilePaths(value, path) {
|
|
382
|
+
if (Array.isArray(value)) return value.flatMap((item, index) => profilePaths(item, [...path, index]));
|
|
383
|
+
if (typeof value !== "object" || value === null) return [];
|
|
384
|
+
return Object.entries(value).flatMap(([key, child]) => key === "runConfig" && typeof child === "object" && child !== null && "profile" in child ? [[
|
|
385
|
+
...path,
|
|
386
|
+
key,
|
|
387
|
+
"profile"
|
|
388
|
+
]] : profilePaths(child, [...path, key]));
|
|
389
|
+
}
|
|
373
390
|
const WorkflowSchema = WorkflowDefinitionSchema.superRefine((workflow, context) => {
|
|
374
391
|
const declaredFiles = new Set((workflow["run-directory"]?.entries ?? []).filter((entry) => entry.kind === "file").map((entry) => entry.path));
|
|
392
|
+
const roleJobs = [...["jobs", "child-jobs"].flatMap((catalog) => Object.entries(workflow[catalog] ?? {}).map(([name, job]) => ({
|
|
393
|
+
job,
|
|
394
|
+
path: [catalog, name]
|
|
395
|
+
}))), ...workflow.repair ? [{
|
|
396
|
+
job: workflow.repair,
|
|
397
|
+
path: ["repair"]
|
|
398
|
+
}] : []].filter(({ job }) => job.identity !== void 0);
|
|
399
|
+
for (const { job, path } of roleJobs) {
|
|
400
|
+
const scope = {
|
|
401
|
+
runConfig: job.runConfig,
|
|
402
|
+
preJob: job.preJob,
|
|
403
|
+
steps: job.steps,
|
|
404
|
+
postJob: job.postJob
|
|
405
|
+
};
|
|
406
|
+
for (const issuePath of profilePaths(scope, path)) context.addIssue({
|
|
407
|
+
code: "custom",
|
|
408
|
+
message: "A job that declares identity.roles runs as its resolved member; remove this profile.",
|
|
409
|
+
path: issuePath
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
if (roleJobs.length > 0) {
|
|
413
|
+
const shared = {
|
|
414
|
+
runConfig: workflow.runConfig,
|
|
415
|
+
runners: workflow.runners,
|
|
416
|
+
commands: workflow.commands
|
|
417
|
+
};
|
|
418
|
+
for (const issuePath of profilePaths(shared, [])) context.addIssue({
|
|
419
|
+
code: "custom",
|
|
420
|
+
message: "A profile cannot apply across a workflow whose jobs declare identity.roles.",
|
|
421
|
+
path: issuePath
|
|
422
|
+
});
|
|
423
|
+
}
|
|
375
424
|
for (const catalog of ["jobs", "child-jobs"]) for (const [jobName, job] of Object.entries(workflow[catalog] ?? {})) for (const [stepIndex, step] of job.steps.entries()) {
|
|
376
425
|
const members = step.parallel ? step.parallel.map((child, childIndex) => ({
|
|
377
426
|
step: child,
|
|
@@ -622,6 +671,17 @@ const WorkflowAdmissionIntentSchema = zod.z.object({
|
|
|
622
671
|
requestHash: zod.z.string(),
|
|
623
672
|
rejected: zod.z.array(zod.z.string()).optional()
|
|
624
673
|
});
|
|
674
|
+
/** The member one role-bound job execution was admitted as; names and digests only, never secrets. */
|
|
675
|
+
const JobIdentityBindingSchema = zod.z.object({
|
|
676
|
+
team: zod.z.string().min(1),
|
|
677
|
+
teamRevision: zod.z.string().min(1),
|
|
678
|
+
product: zod.z.string().min(1).optional(),
|
|
679
|
+
roles: zod.z.array(zod.z.string().min(1)).min(1),
|
|
680
|
+
ref: zod.z.string().min(1),
|
|
681
|
+
profile: zod.z.string().min(1),
|
|
682
|
+
contentDigest: zod.z.string().min(1),
|
|
683
|
+
policyDigest: zod.z.string().min(1)
|
|
684
|
+
});
|
|
625
685
|
const WorkflowRunRecordSchema = zod.z.object({
|
|
626
686
|
activeRepairId: zod.z.string().regex(/^\d+$/).optional(),
|
|
627
687
|
admission: WorkflowAdmissionMetadataSchema.optional(),
|
|
@@ -653,6 +713,8 @@ const WorkflowRunRecordSchema = zod.z.object({
|
|
|
653
713
|
command: zod.z.string().optional().describe("Command the launch selected for templated interactiveRun steps."),
|
|
654
714
|
choice: zod.z.string().optional().describe("Choice the launch selected for steps that do not pin one."),
|
|
655
715
|
profile: zod.z.string().optional().describe("Po profile name the launch selected as the default runConfig.profile; never its secrets."),
|
|
716
|
+
team: zod.z.string().min(1).optional().describe("Team pinned at launch; role-bound jobs resolve only within it."),
|
|
717
|
+
identities: zod.z.record(zod.z.string(), JobIdentityBindingSchema).optional().describe("Admitted member of each role-bound job execution, keyed job#matrixIndex."),
|
|
656
718
|
runId: zod.z.string().uuid().optional(),
|
|
657
719
|
resume: zod.z.object({
|
|
658
720
|
reason: zod.z.enum(["released", "host_shutdown"]),
|
|
@@ -1424,6 +1486,8 @@ var WorkflowRegistryService = class {
|
|
|
1424
1486
|
...input.command === void 0 ? {} : { command: input.command },
|
|
1425
1487
|
...input.choice === void 0 ? {} : { choice: input.choice },
|
|
1426
1488
|
...input.profile === void 0 ? {} : { profile: input.profile },
|
|
1489
|
+
...input.team === void 0 ? {} : { team: input.team },
|
|
1490
|
+
...input.identities === void 0 ? {} : { identities: input.identities },
|
|
1427
1491
|
runDirectory: input.runDirectory,
|
|
1428
1492
|
runId,
|
|
1429
1493
|
secretFile: input.secretFile,
|
|
@@ -1996,6 +2060,23 @@ var WorkflowRegistryService = class {
|
|
|
1996
2060
|
});
|
|
1997
2061
|
}
|
|
1998
2062
|
/**
|
|
2063
|
+
* Keep the member a role-bound job execution was admitted as, before any of
|
|
2064
|
+
* its steps runs. Fenced to this generation, so a stale process cannot write.
|
|
2065
|
+
*/
|
|
2066
|
+
async recordIdentity(handle, key, binding) {
|
|
2067
|
+
await this.withRunLock(handle.recordPath, async () => {
|
|
2068
|
+
const current = await this.readRunRecord(handle.recordPath);
|
|
2069
|
+
if (current.stage !== RUNNING_STAGE || current.runId !== handle.runId) throw new Error(`Workflow run is no longer admitting jobs: ${handle.workspace}/${handle.runKey}`);
|
|
2070
|
+
await this.writeRunRecord(handle.recordPath, {
|
|
2071
|
+
...current,
|
|
2072
|
+
identities: {
|
|
2073
|
+
...current.identities,
|
|
2074
|
+
[key]: binding
|
|
2075
|
+
}
|
|
2076
|
+
});
|
|
2077
|
+
});
|
|
2078
|
+
}
|
|
2079
|
+
/**
|
|
1999
2080
|
* Read every stage directory a run key occupies, without validating run.json,
|
|
2000
2081
|
* so a run that listing skips as invalid can still be seen and repaired.
|
|
2001
2082
|
*/
|
|
@@ -2460,7 +2541,7 @@ const singleName = zod.z.string().trim().min(1);
|
|
|
2460
2541
|
const poRunConfigSchema = zod.z.object({
|
|
2461
2542
|
majorMode: singleName.optional().describe("Major mode the step session runs in."),
|
|
2462
2543
|
minorModes: nameList.optional().describe("Minor modes activated in the step session."),
|
|
2463
|
-
profile: singleName.optional().describe("Profile the step session runs as."),
|
|
2544
|
+
profile: singleName.nullable().optional().describe("Profile the step session runs as; null runs it with no profile, never the workspace default."),
|
|
2464
2545
|
domains: nameList.optional().describe("Domains selected for the step session. An empty list selects none."),
|
|
2465
2546
|
model: singleName.optional().describe("Model selector, provider/id."),
|
|
2466
2547
|
thinking: singleName.optional().describe("Thinking level for the model."),
|
|
@@ -3310,7 +3391,7 @@ var WorkflowParserService = class {
|
|
|
3310
3391
|
if (parts[0] === "env" && parts[1]) return observed(context.env[parts[1]] || this.runtime.baseEnvironment[parts[1]] || (Object.hasOwn(context.env, parts[1]) ? "" : void 0));
|
|
3311
3392
|
if (parts[0] === "runConfig" && parts[1]) {
|
|
3312
3393
|
const value = context.runConfig?.[parts[1]];
|
|
3313
|
-
return observed(Array.isArray(value) ? value.join(",") : value);
|
|
3394
|
+
return observed(Array.isArray(value) ? value.join(",") : value ?? void 0);
|
|
3314
3395
|
}
|
|
3315
3396
|
if (parts[0] === "runner" && parts[1] === "os") return observed("macOS");
|
|
3316
3397
|
if (parts[0] === "github" && parts[1] === "sha") return observed(this.githubSha);
|
|
@@ -3366,6 +3447,43 @@ const STEP_PANE_REF_KIND = "pane";
|
|
|
3366
3447
|
const WORKFLOW_RUNS_TYPE = "workflow_runs";
|
|
3367
3448
|
const WORKFLOW_CATALOG_TYPE = "workflow_catalog";
|
|
3368
3449
|
//#endregion
|
|
3450
|
+
//#region src/services/jobIdentity/index.ts
|
|
3451
|
+
/** Whether any job, child job or repair triage declares roles, which binds the workflow to a team. */
|
|
3452
|
+
function declaresRoles(workflow) {
|
|
3453
|
+
return [
|
|
3454
|
+
...Object.values(workflow.jobs),
|
|
3455
|
+
...Object.values(workflow["child-jobs"] ?? {}),
|
|
3456
|
+
workflow.repair
|
|
3457
|
+
].some((job) => job?.identity !== void 0);
|
|
3458
|
+
}
|
|
3459
|
+
/**
|
|
3460
|
+
* Admits each job execution before its first step. The binding is kept in run
|
|
3461
|
+
* state under `job#matrixIndex`; a retry, resume or recovery that finds it
|
|
3462
|
+
* revalidates it and blocks when the team no longer assigns it the same member.
|
|
3463
|
+
*/
|
|
3464
|
+
function createJobIdentityAdmission(options) {
|
|
3465
|
+
const { registry, run, team, teamBound, resolver, dryRun } = options;
|
|
3466
|
+
return async ({ job, matrixIndex, roles }) => {
|
|
3467
|
+
if (roles === void 0) return teamBound ? null : void 0;
|
|
3468
|
+
if (resolver === void 0) throw new Error(`this host binds no identity provider for roles ${roles.join(", ")}.`);
|
|
3469
|
+
if (team === void 0) throw new Error(`no team is selected for roles ${roles.join(", ")}; name one in the workflow or at launch.`);
|
|
3470
|
+
if (dryRun) return void 0;
|
|
3471
|
+
const key = `${job}#${matrixIndex}`;
|
|
3472
|
+
const saved = (await registry.readRunRecord(run.recordPath)).identities?.[key];
|
|
3473
|
+
const admitted = saved ? await resolver.revalidate(saved) : await resolver.resolve({
|
|
3474
|
+
team,
|
|
3475
|
+
roles
|
|
3476
|
+
});
|
|
3477
|
+
if (saved && admitted.ref !== saved.ref) throw new Error(`the member job "${job}" was admitted as no longer holds its roles in team "${team}".`);
|
|
3478
|
+
if (admitted.team !== team || roles.some((role) => !admitted.roles.includes(role))) throw new Error(`the identity provider did not admit roles ${roles.join(", ")} within team "${team}".`);
|
|
3479
|
+
await registry.recordIdentity(run, key, {
|
|
3480
|
+
...admitted,
|
|
3481
|
+
roles: [...admitted.roles]
|
|
3482
|
+
});
|
|
3483
|
+
return admitted.profile;
|
|
3484
|
+
};
|
|
3485
|
+
}
|
|
3486
|
+
//#endregion
|
|
3369
3487
|
//#region src/services/RunDirectoryService/index.ts
|
|
3370
3488
|
/** Which job and step last wrote each declared entry, one change per line. */
|
|
3371
3489
|
const RUN_DIRECTORY_WRITES_FILENAME = "writes.ndjson";
|
|
@@ -4154,15 +4272,26 @@ var JobRunnerService = class {
|
|
|
4154
4272
|
}
|
|
4155
4273
|
const baseline = writesRunDir ? await this.runDirectoryService.recordWrites(writesRunDir, declaredEntries) : void 0;
|
|
4156
4274
|
const writes = writesRunDir && baseline ? this.attemptWrites(writesRunDir, jobName, jobEnv, baseline, declaredEntries) : void 0;
|
|
4275
|
+
let attemptOptions = options;
|
|
4276
|
+
try {
|
|
4277
|
+
const profile = await this.admitIdentity(jobName, job, matrixIndex, context.admitIdentity);
|
|
4278
|
+
if (profile !== void 0) attemptOptions = {
|
|
4279
|
+
...options,
|
|
4280
|
+
profile
|
|
4281
|
+
};
|
|
4282
|
+
} catch (error) {
|
|
4283
|
+
decidedFailure = `Job "${jobName}" was not admitted: ${error instanceof Error ? error.message : String(error)}`;
|
|
4284
|
+
break;
|
|
4285
|
+
}
|
|
4157
4286
|
const decisions = [];
|
|
4158
4287
|
let allStepsPassed = true;
|
|
4159
|
-
if (preJobSteps.length > 0) allStepsPassed = await this.runStepSequence(preJobSteps, stepContext,
|
|
4288
|
+
if (preJobSteps.length > 0) allStepsPassed = await this.runStepSequence(preJobSteps, stepContext, attemptOptions, matrixIndex, attempt, decisions, writes && {
|
|
4160
4289
|
...writes,
|
|
4161
4290
|
outputs: []
|
|
4162
4291
|
});
|
|
4163
|
-
if (allStepsPassed && decisions.length === 0) allStepsPassed = await this.runStepSequence(mainSteps, stepContext,
|
|
4292
|
+
if (allStepsPassed && decisions.length === 0) allStepsPassed = await this.runStepSequence(mainSteps, stepContext, attemptOptions, matrixIndex, attempt, decisions, writes);
|
|
4164
4293
|
if (postJobSteps.length > 0) {
|
|
4165
|
-
const postJobPassed = await this.runStepSequence(postJobSteps, stepContext,
|
|
4294
|
+
const postJobPassed = await this.runStepSequence(postJobSteps, stepContext, attemptOptions, matrixIndex, attempt, decisions, writes && {
|
|
4166
4295
|
...writes,
|
|
4167
4296
|
outputs: []
|
|
4168
4297
|
});
|
|
@@ -4232,6 +4361,19 @@ var JobRunnerService = class {
|
|
|
4232
4361
|
return true;
|
|
4233
4362
|
});
|
|
4234
4363
|
}
|
|
4364
|
+
/** The profile this execution runs as, or undefined where no admission applies. */
|
|
4365
|
+
async admitIdentity(jobName, job, matrixIndex, admit) {
|
|
4366
|
+
const roles = job.identity?.roles;
|
|
4367
|
+
if (admit === void 0) {
|
|
4368
|
+
if (roles) throw new Error(`this host binds no identity provider for roles ${roles.join(", ")}.`);
|
|
4369
|
+
return;
|
|
4370
|
+
}
|
|
4371
|
+
return await admit({
|
|
4372
|
+
job: jobName,
|
|
4373
|
+
matrixIndex,
|
|
4374
|
+
roles
|
|
4375
|
+
});
|
|
4376
|
+
}
|
|
4235
4377
|
/**
|
|
4236
4378
|
* An attempt's outputs, taken from the records at its start, and the record
|
|
4237
4379
|
* each finished step adds. The step that ends the job is reminded only of
|
|
@@ -4916,7 +5058,10 @@ var StepRunnerService = class StepRunnerService {
|
|
|
4916
5058
|
stepEnv[WORKFLOW_STEP_DISPLAY_ENV_KEY] = this.formatStepDisplay(stepEnv[WORKFLOW_JOB_NAME_ENV_KEY], stepName);
|
|
4917
5059
|
const stepRunConfig = resolvedStepCommand?.runConfig ?? step.runConfig;
|
|
4918
5060
|
const launchProfile = this.commandSelection.profile;
|
|
4919
|
-
const runConfig =
|
|
5061
|
+
const runConfig = options.profile !== void 0 ? {
|
|
5062
|
+
...stepRunConfig,
|
|
5063
|
+
[RUN_CONFIG_PROFILE_KEY]: options.profile
|
|
5064
|
+
} : launchProfile === void 0 || stepRunConfig?.[RUN_CONFIG_PROFILE_KEY] !== void 0 ? stepRunConfig : {
|
|
4920
5065
|
...stepRunConfig,
|
|
4921
5066
|
[RUN_CONFIG_PROFILE_KEY]: launchProfile
|
|
4922
5067
|
};
|
|
@@ -7553,6 +7698,22 @@ function createStepExecutor(dependencies) {
|
|
|
7553
7698
|
"WORKFLOW_NAME"
|
|
7554
7699
|
].flatMap((key) => child.context.jobEnvironment[key] === void 0 ? [] : [[key, child.context.jobEnvironment[key]]]));
|
|
7555
7700
|
env.WORKFLOW_PHASE = "job";
|
|
7701
|
+
const registry = new WorkflowRegistryService(runtime);
|
|
7702
|
+
const recordPath = env.WORKFLOW_RUN_DIR === void 0 ? void 0 : (0, node_path.join)(env.WORKFLOW_RUN_DIR, "run.json");
|
|
7703
|
+
const record = recordPath !== void 0 && await (0, _agimon_ai_po_core_platform.pathExists)(runtime.fs, recordPath, runtime.ioContext) ? await registry.readRunRecord(recordPath) : void 0;
|
|
7704
|
+
const admitIdentity = recordPath !== void 0 && record !== void 0 && record.runId === env.WORKFLOW_RUN_ID ? createJobIdentityAdmission({
|
|
7705
|
+
registry,
|
|
7706
|
+
run: {
|
|
7707
|
+
recordPath,
|
|
7708
|
+
runId: env.WORKFLOW_RUN_ID,
|
|
7709
|
+
workspace: record.workspace,
|
|
7710
|
+
runKey: record.runKey
|
|
7711
|
+
},
|
|
7712
|
+
team: record.team,
|
|
7713
|
+
teamBound: record.team !== void 0 || declaresRoles(workflow),
|
|
7714
|
+
resolver: dependencies.resolveIdentity,
|
|
7715
|
+
dryRun: false
|
|
7716
|
+
}) : void 0;
|
|
7556
7717
|
const success = await jobs.runJob(`${child.job}:${child.invocationId}`, child.definition, {
|
|
7557
7718
|
inputs: new Map(Object.entries(child.inputs).map(([key, value]) => [key, String(value)])),
|
|
7558
7719
|
secrets: /* @__PURE__ */ new Map(),
|
|
@@ -7561,6 +7722,7 @@ function createStepExecutor(dependencies) {
|
|
|
7561
7722
|
jobOrder: [child.job],
|
|
7562
7723
|
allJobs: { [child.job]: child.definition },
|
|
7563
7724
|
managedChild: true,
|
|
7725
|
+
admitIdentity,
|
|
7564
7726
|
onFailed: (reason) => {
|
|
7565
7727
|
failure = reason;
|
|
7566
7728
|
}
|
|
@@ -11632,6 +11794,7 @@ var RunWorkflowService = class {
|
|
|
11632
11794
|
registry;
|
|
11633
11795
|
repairService;
|
|
11634
11796
|
runDirectoryService;
|
|
11797
|
+
resolveIdentity;
|
|
11635
11798
|
outputLines = [];
|
|
11636
11799
|
interruptedSignal = null;
|
|
11637
11800
|
launchStdio;
|
|
@@ -11679,6 +11842,7 @@ var RunWorkflowService = class {
|
|
|
11679
11842
|
this.jobRunner = dependencies.jobRunner ?? new JobRunnerService(this.runtime, this.parser, this.stepRunner, this.logger, this.runDirectoryService);
|
|
11680
11843
|
this.triggerService = dependencies.triggerService ?? new TriggerService(this.runtime, this.stepRunner, this.logger);
|
|
11681
11844
|
this.repairService = dependencies.repairService ?? new WorkflowRepairService(this.runtime);
|
|
11845
|
+
this.resolveIdentity = dependencies.resolveIdentity;
|
|
11682
11846
|
}
|
|
11683
11847
|
/**
|
|
11684
11848
|
* Run the workflow from trigger preparation through cleanup.
|
|
@@ -11887,6 +12051,10 @@ var RunWorkflowService = class {
|
|
|
11887
12051
|
const runner = this.resolveRunner(input, parsedWorkflow);
|
|
11888
12052
|
let workflow = this.parser.selectRunner(parsedWorkflow, runner);
|
|
11889
12053
|
this.useCommandSelection(workflow, input);
|
|
12054
|
+
const team = input.team ?? workflow.team;
|
|
12055
|
+
const teamBound = team !== void 0 || declaresRoles(workflow);
|
|
12056
|
+
if (teamBound && input.profile !== void 0) throw new Error("A launch profile cannot apply to a team-bound workflow: role jobs run as their resolved members, others with no profile.");
|
|
12057
|
+
const noProfile = teamBound ? { profile: null } : {};
|
|
11890
12058
|
let registryRun = null;
|
|
11891
12059
|
const configuration = () => ({
|
|
11892
12060
|
workflow: structuredClone(workflow),
|
|
@@ -12015,6 +12183,8 @@ var RunWorkflowService = class {
|
|
|
12015
12183
|
command: input.command,
|
|
12016
12184
|
choice: input.choice,
|
|
12017
12185
|
profile: input.profile,
|
|
12186
|
+
team,
|
|
12187
|
+
identities: input.recovery?.identities,
|
|
12018
12188
|
runDirectory: workflow["run-directory"],
|
|
12019
12189
|
secretFile: input.secretFile,
|
|
12020
12190
|
skipLaunch: input.skipLaunch,
|
|
@@ -12102,7 +12272,8 @@ var RunWorkflowService = class {
|
|
|
12102
12272
|
stopRequestPath: registryRun.stopRequestPath,
|
|
12103
12273
|
workflowDir,
|
|
12104
12274
|
onStepStarted,
|
|
12105
|
-
onExecutionStateChange
|
|
12275
|
+
onExecutionStateChange,
|
|
12276
|
+
...noProfile
|
|
12106
12277
|
}, input.prompt || null)) {
|
|
12107
12278
|
if (this.isInterrupted()) {
|
|
12108
12279
|
result = this.createInterruptedResult();
|
|
@@ -12128,7 +12299,8 @@ var RunWorkflowService = class {
|
|
|
12128
12299
|
stopRequestPath: preStopRequestPath,
|
|
12129
12300
|
workflowDir,
|
|
12130
12301
|
onStepStarted,
|
|
12131
|
-
onExecutionStateChange
|
|
12302
|
+
onExecutionStateChange,
|
|
12303
|
+
...noProfile
|
|
12132
12304
|
}))) {
|
|
12133
12305
|
if (this.isInterrupted()) result = this.createInterruptedResult();
|
|
12134
12306
|
else {
|
|
@@ -12140,6 +12312,14 @@ var RunWorkflowService = class {
|
|
|
12140
12312
|
}
|
|
12141
12313
|
}
|
|
12142
12314
|
}
|
|
12315
|
+
const admitIdentity = createJobIdentityAdmission({
|
|
12316
|
+
registry: this.registry,
|
|
12317
|
+
run: registryRun,
|
|
12318
|
+
team,
|
|
12319
|
+
teamBound,
|
|
12320
|
+
resolver: this.resolveIdentity,
|
|
12321
|
+
dryRun
|
|
12322
|
+
});
|
|
12143
12323
|
const maxRetries = parsePositiveIntegerEnv(workflowEnv.MAX_RETRIES, DEFAULT_MAX_RETRIES);
|
|
12144
12324
|
const maxFixCycles = parsePositiveIntegerEnv(workflowEnv.FIX_LOOP_MAX_CYCLES, DEFAULT_MAX_FIX_CYCLES);
|
|
12145
12325
|
const fixLoopDisabled = envFlagEnabled(workflowEnv[WORKFLOW_FIX_LOOP_DISABLED_ENV]);
|
|
@@ -12195,6 +12375,7 @@ var RunWorkflowService = class {
|
|
|
12195
12375
|
[REPAIR_TRIAGE_JOB_NAME$1]: repair
|
|
12196
12376
|
},
|
|
12197
12377
|
repairTriage: true,
|
|
12378
|
+
admitIdentity,
|
|
12198
12379
|
activeRepairIssue: repairIssueContent,
|
|
12199
12380
|
runDirectory: workflow["run-directory"]
|
|
12200
12381
|
}, {
|
|
@@ -12300,6 +12481,7 @@ var RunWorkflowService = class {
|
|
|
12300
12481
|
maxCycles: maxFixCycles
|
|
12301
12482
|
},
|
|
12302
12483
|
runDirectory: workflow["run-directory"],
|
|
12484
|
+
admitIdentity,
|
|
12303
12485
|
onPromptAssembled: dryRun ? (assembly) => {
|
|
12304
12486
|
dryRunPromptAssemblies.push(assembly);
|
|
12305
12487
|
} : void 0
|
|
@@ -12521,7 +12703,8 @@ var RunWorkflowService = class {
|
|
|
12521
12703
|
dryRun,
|
|
12522
12704
|
continueOnError,
|
|
12523
12705
|
progress,
|
|
12524
|
-
workflowDir
|
|
12706
|
+
workflowDir,
|
|
12707
|
+
...noProfile
|
|
12525
12708
|
}))) {
|
|
12526
12709
|
this.logger.error(`\n${RED}${BOLD}${WORKFLOW_POST_FAILED_TEXT}${RESET}`);
|
|
12527
12710
|
if (!result || result.exitCode === 0 || result.exitCode === WORKFLOW_SKIPPED_EXIT_CODE) result = {
|
|
@@ -13255,6 +13438,7 @@ var RecoverWorkflowService = class {
|
|
|
13255
13438
|
command: record.command,
|
|
13256
13439
|
choice: record.choice,
|
|
13257
13440
|
profile: record.profile,
|
|
13441
|
+
team: record.team,
|
|
13258
13442
|
workflowPath: record.workflowPath,
|
|
13259
13443
|
job: recoveredJob,
|
|
13260
13444
|
inputs: record.inputs,
|
|
@@ -13274,7 +13458,8 @@ var RecoverWorkflowService = class {
|
|
|
13274
13458
|
claimId: recoveryClaimId,
|
|
13275
13459
|
originalJob,
|
|
13276
13460
|
runKey: record.runKey,
|
|
13277
|
-
startJob: recoveredJob
|
|
13461
|
+
startJob: recoveredJob,
|
|
13462
|
+
identities: record.identities
|
|
13278
13463
|
}
|
|
13279
13464
|
};
|
|
13280
13465
|
}
|
|
@@ -13592,4 +13777,4 @@ Object.defineProperty(exports, "workflowShellOutput", {
|
|
|
13592
13777
|
}
|
|
13593
13778
|
});
|
|
13594
13779
|
|
|
13595
|
-
//# sourceMappingURL=RecoverWorkflowService-
|
|
13780
|
+
//# sourceMappingURL=RecoverWorkflowService-DP1ICYxa.cjs.map
|