feat(work): schedule task evaluation through work graph
This commit is contained in:
@@ -18,6 +18,12 @@ type GraphScheduleRequest struct {
|
||||
Now int64 `json:"now_unix_millis"`
|
||||
}
|
||||
|
||||
type TaskEvaluationScheduleRequest struct {
|
||||
Plan work.TaskEvaluationGraphRequest `json:"plan"`
|
||||
Intents []work.AgentDispatchIntent `json:"intents"`
|
||||
Now int64 `json:"now_unix_millis"`
|
||||
}
|
||||
|
||||
type GraphCompleteRequest struct {
|
||||
GraphID string `json:"graph_id"`
|
||||
Revision int64 `json:"revision"`
|
||||
@@ -105,6 +111,18 @@ func AdmitAndSchedule(ctx context.Context, store ports.GraphStore, request Graph
|
||||
return next, ready, nil
|
||||
}
|
||||
|
||||
// AdmitAndScheduleTaskEvaluation creates the durable general-first or
|
||||
// bounded-expansion fan-out before handing it to the existing graph scheduler.
|
||||
// The request path only persists/enqueues work; specialist execution happens
|
||||
// independently through the dispatch workers.
|
||||
func AdmitAndScheduleTaskEvaluation(ctx context.Context, store ports.GraphStore, request TaskEvaluationScheduleRequest) (work.WorkGraph, []work.GraphNodeID, error) {
|
||||
graph, err := domain.BuildTaskEvaluationGraph(request.Plan)
|
||||
if err != nil {
|
||||
return work.WorkGraph{}, nil, err
|
||||
}
|
||||
return AdmitAndSchedule(ctx, store, GraphScheduleRequest{Graph: graph, Intents: request.Intents, Now: request.Now})
|
||||
}
|
||||
|
||||
func CompleteGraphNode(ctx context.Context, store ports.GraphStore, graphID string, revision int64, nodeID work.GraphNodeID, success bool) (work.WorkGraph, error) {
|
||||
graph, err := store.LoadWorkGraph(ctx, graphID, revision)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user