| | | 1 | | using NexusLabs.Needlr.AgentFramework.Workflows.Sequential; |
| | | 2 | | |
| | | 3 | | namespace NexusLabs.Needlr.AgentFramework.Workflows.Sequential; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Defines a named group of sequential stages that share runtime configuration. |
| | | 7 | | /// The <see cref="SequentialPipelineRunner"/> applies the phase's policy (lifecycle |
| | | 8 | | /// hooks, token budget) before executing any stage within it. |
| | | 9 | | /// </summary> |
| | | 10 | | /// <remarks> |
| | | 11 | | /// <para> |
| | | 12 | | /// Phases represent runtime configuration boundaries, not logical groupings. |
| | | 13 | | /// The same phase configuration can appear multiple times in a pipeline — each |
| | | 14 | | /// <see cref="PipelinePhase"/> instance is a distinct runtime scope with its own |
| | | 15 | | /// <see cref="PipelinePhasePolicy.OnEnterAsync"/> invocation and budget scope. |
| | | 16 | | /// </para> |
| | | 17 | | /// <para> |
| | | 18 | | /// Empty phases (zero stages) are valid. <see cref="PipelinePhasePolicy.OnEnterAsync"/> |
| | | 19 | | /// and progress events still fire, enabling setup-only phases. |
| | | 20 | | /// </para> |
| | | 21 | | /// </remarks> |
| | | 22 | | /// <param name="Name">Human-readable name for the phase (used in diagnostics, progress events, and result metadata).</p |
| | | 23 | | /// <param name="Stages">The ordered list of stages within this phase.</param> |
| | | 24 | | /// <param name="Policy">Optional <see cref="PipelinePhasePolicy"/> controlling lifecycle hooks and phase-level budget.< |
| | | 25 | | /// <example> |
| | | 26 | | /// <code> |
| | | 27 | | /// var phases = new[] |
| | | 28 | | /// { |
| | | 29 | | /// new PipelinePhase("Analysis", [ |
| | | 30 | | /// new PipelineStage("ParseDiff", diffParser), |
| | | 31 | | /// new PipelineStage("SecurityScan", securityScanner), |
| | | 32 | | /// ]), |
| | | 33 | | /// new PipelinePhase("Synthesis", [ |
| | | 34 | | /// new PipelineStage("GenerateComments", commentGenerator), |
| | | 35 | | /// ], new PipelinePhasePolicy { TokenBudget = 30_000 }), |
| | | 36 | | /// }; |
| | | 37 | | /// |
| | | 38 | | /// await runner.RunPhasedAsync(workspace, phases, options: null, ct); |
| | | 39 | | /// </code> |
| | | 40 | | /// </example> |
| | 43 | 41 | | public sealed record PipelinePhase( |
| | 231 | 42 | | string Name, |
| | 279 | 43 | | IReadOnlyList<PipelineStage> Stages, |
| | 86 | 44 | | PipelinePhasePolicy? Policy = null); |