Move native debug accounting into the CLI capture lifecycle
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"mime"
|
||||
"path"
|
||||
@@ -16,7 +15,6 @@ import (
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/core/source"
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/framework/chunkmap"
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/framework/contracts"
|
||||
"go.maximumdirect.net/promptkit"
|
||||
)
|
||||
|
||||
type Registries struct {
|
||||
@@ -47,18 +45,15 @@ type RunInput struct {
|
||||
// on a hit. Shared observers must synchronize concurrent calls.
|
||||
ObserveCache func(context.Context, contracts.DiagnosticOrigin, contracts.CacheObservation) error
|
||||
Execution contracts.ExecutionOptions
|
||||
// Executions is the invocation's native group. The runner enrolls its
|
||||
// requests; callers may use Snapshot without maintaining copied totals.
|
||||
Executions *promptkit.ExecutionGroup
|
||||
Prepared *PreparedPipeline
|
||||
SourceID string
|
||||
Path string
|
||||
RawInput []byte
|
||||
SessionID string
|
||||
RunID string
|
||||
StartedAt time.Time
|
||||
Metadata map[string]any
|
||||
Diagnostics []contracts.ProducerDiagnostic
|
||||
Prepared *PreparedPipeline
|
||||
SourceID string
|
||||
Path string
|
||||
RawInput []byte
|
||||
SessionID string
|
||||
RunID string
|
||||
StartedAt time.Time
|
||||
Metadata map[string]any
|
||||
Diagnostics []contracts.ProducerDiagnostic
|
||||
|
||||
Debug DebugRecorder
|
||||
// Workers bounds ready extraction and lane-completion jobs together.
|
||||
@@ -115,18 +110,6 @@ func (r *Runner) Run(ctx context.Context, input RunInput) (output RunOutput, err
|
||||
}
|
||||
debugRecorder = synchronizedDebugRecorder(debugRecorder)
|
||||
input.Debug = debugRecorder
|
||||
if input.Executions == nil {
|
||||
input.Executions = &promptkit.ExecutionGroup{}
|
||||
}
|
||||
input.Execution.Observer = promptkit.ComposeObservers(input.Execution.Observer, input.Executions.Observe)
|
||||
defer func() {
|
||||
if debugRecorder.Enabled() {
|
||||
if captureErr := debugRecorder.WriteJSON("executions.json", input.Executions.Snapshot()); captureErr != nil {
|
||||
err = errors.Join(err, &contracts.CaptureError{Cause: captureErr})
|
||||
output = failOutput(output)
|
||||
}
|
||||
}
|
||||
}()
|
||||
inputDiagnostics, diagnosticErr := promoteProducerDiagnostics(input.Diagnostics, contracts.DiagnosticOrigin{Stage: contracts.DiagnosticOriginStageReferences}, nil)
|
||||
if diagnosticErr != nil {
|
||||
return failOutput(output), fmt.Errorf("promote input diagnostics: %w", diagnosticErr)
|
||||
|
||||
Reference in New Issue
Block a user