Share source evidence through the selected capture sink
This commit is contained in:
@@ -66,7 +66,8 @@ type RunInput struct {
|
||||
references map[referenceTargetKey]contracts.ReferenceSet
|
||||
referenceReuseEligibility map[referenceTargetKey]bool
|
||||
// Shared read-only by extraction jobs and cache decoders for this run.
|
||||
sourceIndex *source.DocumentIndex
|
||||
sourceIndex *source.DocumentIndex
|
||||
sourceEvidence *sourceEvidenceDescriptor
|
||||
}
|
||||
|
||||
type RunOutput struct {
|
||||
@@ -103,12 +104,17 @@ func (r *Runner) Run(ctx context.Context, input RunInput) (output RunOutput, err
|
||||
input.pipeline = input.Prepared.resolved
|
||||
|
||||
sessionID := strings.TrimSpace(input.SessionID)
|
||||
debugRecorder := input.Debug
|
||||
if debugRecorder == nil {
|
||||
debugRecorder = NoopDebugRecorder()
|
||||
var debugRecorder DebugRecorder = NoopDebugRecorder()
|
||||
if input.Execution.Capture != nil {
|
||||
debugRecorder = evidenceDebugRecorder{input.Execution.Capture}
|
||||
} else if input.Debug != nil && input.Debug.Enabled() {
|
||||
debugRecorder = synchronizedDebugRecorder(input.Debug)
|
||||
input.Execution.Capture = debugRecorder
|
||||
}
|
||||
debugRecorder = synchronizedDebugRecorder(debugRecorder)
|
||||
input.Debug = debugRecorder
|
||||
if input.Execution.Capture != nil {
|
||||
input.sourceEvidence = &sourceEvidenceDescriptor{Input: "source/input.json", Parsed: "source/output.json"}
|
||||
}
|
||||
inputDiagnostics, diagnosticErr := promoteProducerDiagnostics(input.Diagnostics, contracts.DiagnosticOrigin{Stage: contracts.DiagnosticOriginStageReferences}, nil)
|
||||
if diagnosticErr != nil {
|
||||
return failOutput(output), fmt.Errorf("promote input diagnostics: %w", diagnosticErr)
|
||||
@@ -195,8 +201,8 @@ func (r *Runner) Run(ctx context.Context, input RunInput) (output RunOutput, err
|
||||
StartedAt: chunkStarted,
|
||||
Payload: map[string]any{
|
||||
"cache_mode": input.pipeline.ChunkControls.Cache,
|
||||
"source": debugSourceDocumentEnvelope(doc),
|
||||
"source_input": debugContentEnvelope(sourceInput.Content, sourceInput.MediaType, nil, nil),
|
||||
"source": input.sourceEvidence.parsedReference(),
|
||||
"source_input": input.sourceEvidence.inputReference(),
|
||||
"metadata": input.Metadata,
|
||||
},
|
||||
}); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user