|
| 1 | +package session |
| 2 | + |
| 3 | +// PipelinePhase identifies the step of the Agentless-style pipeline |
| 4 | +// (localize → repair → validate) that a session turn belongs to. |
| 5 | +// |
| 6 | +// These string constants mirror hawk-core-contracts/sessions.Phase so that |
| 7 | +// cost records emitted by trace can be correlated with hawk's tok.Tracker |
| 8 | +// AggregateByPhase output without importing the contracts package |
| 9 | +// (trace is a standalone CLI, not part of the hawk Go module graph). |
| 10 | +type PipelinePhase string |
| 11 | + |
| 12 | +const ( |
| 13 | + // PipelinePhaseLocalize is the file/symbol identification phase. |
| 14 | + PipelinePhaseLocalize PipelinePhase = "localize" |
| 15 | + // PipelinePhaseRepair is the patch generation phase. |
| 16 | + PipelinePhaseRepair PipelinePhase = "repair" |
| 17 | + // PipelinePhaseValidate is the test/lint verification phase. |
| 18 | + PipelinePhaseValidate PipelinePhase = "validate" |
| 19 | + // PipelinePhaseReview is code review; the most token-intensive phase |
| 20 | + // at 59.4% of total spend (Tokenomics paper, arXiv 2601.14470). |
| 21 | + PipelinePhaseReview PipelinePhase = "review" |
| 22 | + // PipelinePhaseUnknown is the zero value for unattributed turns. |
| 23 | + PipelinePhaseUnknown PipelinePhase = "" |
| 24 | +) |
| 25 | + |
| 26 | +// ParsePipelinePhase returns the PipelinePhase matching s, or |
| 27 | +// PipelinePhaseUnknown if unrecognised. Matching is case-sensitive to |
| 28 | +// stay consistent with the contracts package and JSON encoding. |
| 29 | +func ParsePipelinePhase(s string) PipelinePhase { |
| 30 | + switch PipelinePhase(s) { |
| 31 | + case PipelinePhaseLocalize, PipelinePhaseRepair, |
| 32 | + PipelinePhaseValidate, PipelinePhaseReview: |
| 33 | + return PipelinePhase(s) |
| 34 | + } |
| 35 | + return PipelinePhaseUnknown |
| 36 | +} |
0 commit comments