Run processing from the prepared invocation
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/core/schema"
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/contracts"
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/outcomes"
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/preflight"
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/promptcontext"
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/proposals"
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/structuredoutput"
|
||||
@@ -113,9 +114,7 @@ func selectEvidence(selection *EvidenceSelection) evidenceNeeds {
|
||||
|
||||
// RunInput is the deterministic runner input.
|
||||
type RunInput struct {
|
||||
Sections []chunking.Section
|
||||
Transcript *schema.Transcript
|
||||
ModuleSpecs []contracts.ModuleRunSpec
|
||||
Plan *preflight.Plan
|
||||
Interactions structuredoutput.InteractionSink
|
||||
Evidence *EvidenceSelection
|
||||
Progress func(Progress)
|
||||
@@ -138,16 +137,16 @@ func New(factory ModuleFactory) *Runner {
|
||||
|
||||
func (r *Runner) Run(ctx context.Context, input RunInput) (RunOutput, error) {
|
||||
if err := ctx.Err(); err != nil {
|
||||
return RunOutput{FinalTranscript: input.Transcript.Clone()}, &ExecutionFailure{Phase: "processing", Cause: err}
|
||||
return RunOutput{FinalTranscript: input.Plan.Transcript.Clone()}, &ExecutionFailure{Phase: "processing", Cause: err}
|
||||
}
|
||||
if r == nil || r.factory == nil {
|
||||
return RunOutput{}, &ExecutionFailure{Phase: "setup", Cause: errors.New("runner module factory is required")}
|
||||
}
|
||||
|
||||
results := make([]ModuleResult, 0, len(input.ModuleSpecs))
|
||||
sections := input.Sections
|
||||
results := make([]ModuleResult, 0, len(input.Plan.Specs))
|
||||
sections := input.Plan.Sections
|
||||
evidence := selectEvidence(input.Evidence)
|
||||
totals := outcomes.WorkTotals{Total: len(input.ModuleSpecs) * len(sections)}
|
||||
totals := outcomes.WorkTotals{Total: len(input.Plan.Specs) * len(sections)}
|
||||
var inventory []contracts.SectionMetadata
|
||||
var workUnits []WorkUnitOutcome
|
||||
var candidates []proposals.EnrichedCorrectionProposal
|
||||
@@ -157,7 +156,7 @@ func (r *Runner) Run(ctx context.Context, input RunInput) (RunOutput, error) {
|
||||
inventory[i] = contracts.SectionMetadataFromSection(section)
|
||||
}
|
||||
workUnits = make([]WorkUnitOutcome, 0, totals.Total)
|
||||
for moduleIndex, spec := range input.ModuleSpecs {
|
||||
for moduleIndex, spec := range input.Plan.Specs {
|
||||
for _, section := range inventory {
|
||||
workUnits = append(workUnits, newWorkUnit(spec, section, moduleIndex))
|
||||
}
|
||||
@@ -170,7 +169,7 @@ func (r *Runner) Run(ctx context.Context, input RunInput) (RunOutput, error) {
|
||||
}
|
||||
}
|
||||
|
||||
for moduleIndex, spec := range input.ModuleSpecs {
|
||||
for moduleIndex, spec := range input.Plan.Specs {
|
||||
progress := Progress{ModuleIndex: spec.Index, ModuleKey: spec.ModuleKey, ModuleID: spec.ID}
|
||||
sectionCount := len(sections)
|
||||
progress.emit(input.Progress, "started", nil, §ionCount)
|
||||
|
||||
Reference in New Issue
Block a user