Share source evidence through the selected capture sink
This commit is contained in:
@@ -3,9 +3,31 @@ package pipeline
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/core/source"
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/framework/contracts"
|
||||
)
|
||||
|
||||
// References are logical paths at the selected evidence sink's root.
|
||||
type sourceEvidenceDescriptor struct {
|
||||
Input string
|
||||
Parsed string
|
||||
}
|
||||
|
||||
func (s *sourceEvidenceDescriptor) inputReference() any {
|
||||
return map[string]string{"bundle_root_path": s.Input}
|
||||
}
|
||||
|
||||
func (s *sourceEvidenceDescriptor) parsedReference() any {
|
||||
return map[string]string{"bundle_root_path": s.Parsed}
|
||||
}
|
||||
|
||||
func sourceCaptureProjection(descriptor *sourceEvidenceDescriptor, doc *source.SourceDocument) any {
|
||||
if descriptor == nil {
|
||||
return debugSourceDocumentEnvelope(doc)
|
||||
}
|
||||
return descriptor.parsedReference()
|
||||
}
|
||||
|
||||
func captureOperationInputs(execution contracts.ExecutionOptions, target typedValidationTarget, binding ModuleBinding, incoming []contracts.SerializedArtifact) error {
|
||||
if execution.Capture == nil {
|
||||
return nil
|
||||
@@ -26,9 +48,21 @@ func captureOperationInputs(execution contracts.ExecutionOptions, target typedVa
|
||||
if target.chunk != nil {
|
||||
chunk = debugSourceChunkEnvelope(*target.chunk)
|
||||
}
|
||||
var sourceValue, sourceInput any
|
||||
if target.sourceEvidence != nil {
|
||||
sourceValue = target.sourceEvidence.parsedReference()
|
||||
if target.chunk == nil {
|
||||
sourceInput = target.sourceEvidence.inputReference()
|
||||
}
|
||||
} else {
|
||||
sourceValue = sourceCaptureProjection(nil, target.source)
|
||||
}
|
||||
if sourceInput == nil {
|
||||
sourceInput = debugContentEnvelope(target.sourceInput.Content, target.sourceInput.MediaType, nil, nil)
|
||||
}
|
||||
return execution.RecordEvidence("inputs.json", map[string]any{
|
||||
"source": debugSourceDocumentEnvelope(target.source),
|
||||
"source_input": debugContentEnvelope(target.sourceInput.Content, target.sourceInput.MediaType, nil, nil),
|
||||
"source": sourceValue,
|
||||
"source_input": sourceInput,
|
||||
"chunk": chunk, "chunks": debugSourceChunkEnvelopes(target.chunks), "references": references,
|
||||
"incoming_artifacts": inputs, "module": binding.Module, "llm_profile": binding.LLMProfile, "metadata": target.metadata,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user