143 lines
6.3 KiB
Go
143 lines
6.3 KiB
Go
package work
|
|
|
|
import "git.cin.su/m/Assistant/contracts/capability"
|
|
|
|
type GraphNodeID string
|
|
|
|
type GraphState string
|
|
type GraphNodeState string
|
|
type GraphNodePurpose string
|
|
|
|
const (
|
|
GraphNodePurposeTaskEvaluation GraphNodePurpose = "TASK_EVALUATION_SPECIALIST"
|
|
GraphNodePurposeGeneric GraphNodePurpose = "GENERIC"
|
|
|
|
GraphDraft GraphState = "DRAFT"
|
|
GraphAdmitted GraphState = "ADMITTED"
|
|
GraphRunning GraphState = "RUNNING"
|
|
GraphPartial GraphState = "PARTIAL"
|
|
GraphVerifying GraphState = "VERIFYING"
|
|
GraphCompleted GraphState = "COMPLETED"
|
|
GraphFailed GraphState = "FAILED"
|
|
GraphUnknown GraphState = "UNKNOWN"
|
|
|
|
GraphNodeBlocked GraphNodeState = "BLOCKED_PREREQUISITE"
|
|
GraphNodeReady GraphNodeState = "READY"
|
|
GraphNodeLeased GraphNodeState = "LEASED"
|
|
GraphNodeRunning GraphNodeState = "RUNNING"
|
|
GraphNodeSuccess GraphNodeState = "SUCCEEDED"
|
|
GraphNodeFailed GraphNodeState = "FAILED"
|
|
GraphNodeCancel GraphNodeState = "CANCELLED"
|
|
GraphNodeUnknown GraphNodeState = "UNKNOWN"
|
|
)
|
|
|
|
type GraphBudget struct {
|
|
MaxParallel int `json:"max_parallel"`
|
|
MaxAttempts int `json:"max_attempts"`
|
|
}
|
|
|
|
type GraphNode struct {
|
|
ID GraphNodeID `json:"id"`
|
|
DispatchID string `json:"dispatch_id"`
|
|
IdempotencyKey string `json:"idempotency_key"`
|
|
State GraphNodeState `json:"state"`
|
|
Attempts int `json:"attempts"`
|
|
Purpose GraphNodePurpose `json:"purpose,omitempty"`
|
|
TaskProfileID capability.TaskEvaluationProfileID `json:"task_profile_id,omitempty"`
|
|
BindingID capability.CapabilityBindingID `json:"binding_id,omitempty"`
|
|
CaseIDs []string `json:"case_ids,omitempty"`
|
|
TaskProfile *capability.TaskEvaluationProfile `json:"task_profile,omitempty"`
|
|
TaskCases []capability.TaskEvaluationCase `json:"task_cases,omitempty"`
|
|
}
|
|
|
|
type GraphEdge struct {
|
|
From GraphNodeID `json:"from"`
|
|
To GraphNodeID `json:"to"`
|
|
}
|
|
|
|
type WorkGraph struct {
|
|
ID string `json:"id"`
|
|
Revision int64 `json:"revision"`
|
|
State GraphState `json:"state"`
|
|
Nodes []GraphNode `json:"nodes"`
|
|
Edges []GraphEdge `json:"edges"`
|
|
Budget GraphBudget `json:"budget"`
|
|
ParentGraphID string `json:"parent_graph_id,omitempty"`
|
|
ParentGraphRevision int64 `json:"parent_graph_revision,omitempty"`
|
|
TriggerEvidenceRef string `json:"trigger_evidence_ref,omitempty"`
|
|
}
|
|
|
|
// TaskEvaluationGraphRequest describes a durable fan-out. The graph contains
|
|
// one specialist node per binding; each node receives the profile's bounded
|
|
// cases and reports evidence back to Capability for fan-in aggregation.
|
|
type TaskEvaluationGraphRequest struct {
|
|
GraphID string `json:"graph_id"`
|
|
Profile capability.TaskEvaluationProfile `json:"profile"`
|
|
BindingIDs []capability.CapabilityBindingID `json:"binding_ids"`
|
|
DispatchIDs []string `json:"dispatch_ids"`
|
|
IdempotencyPrefix string `json:"idempotency_prefix"`
|
|
Budget GraphBudget `json:"budget"`
|
|
ParentGraphID string `json:"parent_graph_id,omitempty"`
|
|
ParentGraphRevision int64 `json:"parent_graph_revision,omitempty"`
|
|
ParentGraphState GraphState `json:"parent_graph_state,omitempty"`
|
|
TriggerEvidenceRef string `json:"trigger_evidence_ref,omitempty"`
|
|
Cases []capability.TaskEvaluationCase `json:"cases,omitempty"`
|
|
BindingRevision int64 `json:"binding_revision,omitempty"`
|
|
ActorID string `json:"actor_id,omitempty"`
|
|
PrincipalID string `json:"principal_id,omitempty"`
|
|
ScopeID string `json:"scope_id,omitempty"`
|
|
}
|
|
|
|
// TaskEvaluationEvidenceCallback is emitted by a specialist after it has
|
|
// completed the bounded case set. Capability remains the evidence owner;
|
|
// Work only advances its matching graph node after the evidence is accepted.
|
|
type TaskEvaluationEvidenceCallback struct {
|
|
GraphID string `json:"graph_id"`
|
|
Revision int64 `json:"revision"`
|
|
NodeID GraphNodeID `json:"node_id"`
|
|
Evaluation capability.TaskEvaluation `json:"evaluation"`
|
|
Succeeded bool `json:"succeeded"`
|
|
}
|
|
|
|
type ResultCandidate struct {
|
|
ID string `json:"id"`
|
|
GraphID string `json:"graph_id"`
|
|
GraphRevision int64 `json:"graph_revision"`
|
|
NodeID GraphNodeID `json:"node_id"`
|
|
AuthorRunID AgentRunID `json:"author_run_id"`
|
|
ArtifactRefs []EvidenceRef `json:"artifact_refs"`
|
|
EvidenceSummary string `json:"evidence_summary"`
|
|
Summary string `json:"summary"`
|
|
}
|
|
|
|
type ConflictSet struct {
|
|
ID string `json:"id"`
|
|
GraphID string `json:"graph_id"`
|
|
GraphRevision int64 `json:"graph_revision"`
|
|
NodeID GraphNodeID `json:"node_id"`
|
|
CandidateIDs []string `json:"candidate_ids"`
|
|
Resolved bool `json:"resolved"`
|
|
}
|
|
|
|
type GraphSynthesisState string
|
|
|
|
const GraphSynthesisVerified GraphSynthesisState = "VERIFIED"
|
|
|
|
// GraphSynthesisCandidate retains every competing result while recording the
|
|
// independently verified selection. It is a candidate, not an external action
|
|
// or authority grant.
|
|
type GraphSynthesisCandidate struct {
|
|
ID string `json:"id"`
|
|
GraphID string `json:"graph_id"`
|
|
GraphRevision int64 `json:"graph_revision"`
|
|
NodeID GraphNodeID `json:"node_id"`
|
|
CandidateIDs []string `json:"candidate_ids"`
|
|
SelectedCandidateID string `json:"selected_candidate_id"`
|
|
DissentCandidateIDs []string `json:"dissent_candidate_ids"`
|
|
VerifierRunID AgentRunID `json:"verifier_run_id"`
|
|
VerifierIdentity string `json:"verifier_identity"`
|
|
EvidenceRefs []EvidenceRef `json:"evidence_refs"`
|
|
Summary string `json:"summary"`
|
|
State GraphSynthesisState `json:"state"`
|
|
}
|