Capture native execution facts and complete scoped debug evidence
This commit is contained in:
@@ -37,6 +37,7 @@ type CacheObservation struct {
|
||||
Decision string
|
||||
MessageContentHash string
|
||||
Prepared *promptkit.PreparedRun
|
||||
Artifact []byte `json:"-"`
|
||||
Err error
|
||||
ChunkID string
|
||||
ChunkIndex *int
|
||||
@@ -65,8 +66,35 @@ type ExecutionOptions struct {
|
||||
TransientRetries *int
|
||||
Observer promptkit.ExecutionObserver `json:"-"`
|
||||
OnPrepared func(context.Context, promptkit.PreparedRun) `json:"-"`
|
||||
Capture EvidenceWriter `json:"-"`
|
||||
}
|
||||
|
||||
// EvidenceWriter receives optional operation-scoped debug evidence. Modules get
|
||||
// no filesystem root and cannot use capture as an execution or reporting service.
|
||||
type EvidenceWriter interface {
|
||||
WriteJSON(string, any) error
|
||||
WriteBytes(string, []byte) error
|
||||
}
|
||||
|
||||
// RecordEvidence writes available application-owned evidence at an ordinary
|
||||
// operation boundary. A recording failure must not become semantic fallback.
|
||||
func (options ExecutionOptions) RecordEvidence(name string, value any) error {
|
||||
if options.Capture == nil {
|
||||
return nil
|
||||
}
|
||||
if err := options.Capture.WriteJSON(name, value); err != nil {
|
||||
return &CaptureError{Cause: err}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// CaptureError is an ordinary framework failure, not a semantic assessment or a
|
||||
// reason to invoke a model again. Its cause remains available to the caller.
|
||||
type CaptureError struct{ Cause error }
|
||||
|
||||
func (e *CaptureError) Error() string { return "record debug evidence: " + e.Cause.Error() }
|
||||
func (e *CaptureError) Unwrap() error { return e.Cause }
|
||||
|
||||
type AssessmentDecision string
|
||||
|
||||
const (
|
||||
|
||||
Reference in New Issue
Block a user