feat: persist verified graph synthesis runtime
This commit is contained in:
@@ -25,6 +25,28 @@ type GraphCompleteRequest struct {
|
||||
Succeeded bool `json:"succeeded"`
|
||||
}
|
||||
|
||||
type GraphSynthesisRequest struct {
|
||||
Conflict work.ConflictSet `json:"conflict"`
|
||||
Candidates []work.ResultCandidate `json:"candidates"`
|
||||
SelectedCandidate string `json:"selected_candidate_id"`
|
||||
VerifierRunID work.AgentRunID `json:"verifier_run_id"`
|
||||
VerifierIdentity string `json:"verifier_identity"`
|
||||
EvidenceRefs []work.EvidenceRef `json:"evidence_refs"`
|
||||
Summary string `json:"summary"`
|
||||
Verified bool `json:"verified"`
|
||||
}
|
||||
|
||||
func SynthesizeGraph(ctx context.Context, store ports.GraphResultStore, request GraphSynthesisRequest) (work.ConflictSet, work.GraphSynthesisCandidate, error) {
|
||||
conflict, synthesis, err := domain.BuildVerifiedGraphSynthesis(request.Conflict, request.Candidates, request.SelectedCandidate, request.VerifierRunID, request.VerifierIdentity, request.EvidenceRefs, request.Summary, request.Verified)
|
||||
if err != nil {
|
||||
return work.ConflictSet{}, work.GraphSynthesisCandidate{}, err
|
||||
}
|
||||
if err := store.SaveGraphSynthesis(ctx, conflict, request.Candidates, synthesis); err != nil {
|
||||
return work.ConflictSet{}, work.GraphSynthesisCandidate{}, err
|
||||
}
|
||||
return conflict, synthesis, nil
|
||||
}
|
||||
|
||||
func AdmitAndSchedule(ctx context.Context, store ports.GraphStore, request GraphScheduleRequest) (work.WorkGraph, []work.GraphNodeID, error) {
|
||||
if request.Now < 1 {
|
||||
request.Now = time.Now().UnixMilli()
|
||||
|
||||
@@ -12,3 +12,7 @@ type GraphStore interface {
|
||||
SaveDispatchIntent(context.Context, work.AgentDispatchIntent) error
|
||||
EnqueueDispatch(context.Context, work.AgentDispatchQueueItem) error
|
||||
}
|
||||
|
||||
type GraphResultStore interface {
|
||||
SaveGraphSynthesis(context.Context, work.ConflictSet, []work.ResultCandidate, work.GraphSynthesisCandidate) error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user