Documentation
¶
Index ¶
- func ValidateTaskInstructions(instructionsFile, instructionsFileSource string) error
- type CallbackPayload
- type CallbackTask
- type CompletionSink
- type DispatchRequest
- type DispatchResult
- type RateLimiter
- type Runner
- func (r *Runner) GenerateReport(project, pathFilter string) ([]string, error)
- func (r *Runner) GetResults(req *global.ResultsRequest) (*global.ResultsResponse, error)
- func (r *Runner) GetTaskStatus(project, path, taskType string) (*TaskStatusResult, error)
- func (r *Runner) IsRunning() bool
- func (r *Runner) Run(ctx context.Context, req *global.RunRequest, notify CompletionSink) (*global.RunResult, error)
- func (r *Runner) RunDispatch(ctx context.Context, req *DispatchRequest, notify CompletionSink) (*DispatchResult, error)
- func (r *Runner) SetHostDispatched(v bool)
- func (r *Runner) Wait()
- type SchemaValidationError
- type TaskStatusInfo
- type TaskStatusResult
- type ValidationErrorDetails
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateTaskInstructions ¶
ValidateTaskInstructions validates task instructions without loading files
Types ¶
type CallbackPayload ¶ added in v0.3.5
type CallbackPayload struct {
Event string `json:"event"` // "completed" or "failed"
Project string `json:"project"`
Path string `json:"path"`
CompletedAt time.Time `json:"completed_at"`
ErrorCode string `json:"error_code,omitempty"` // Machine-readable failure code (event=failed only)
ErrorMessage string `json:"error_message,omitempty"` // Human-readable failure message (event=failed only)
Tasks []CallbackTask `json:"tasks"`
}
CallbackPayload is the JSON document delivered to the CompletionSink when a taskset run finishes.
type CallbackTask ¶ added in v0.3.5
type CallbackTask struct {
ID int `json:"id"`
UUID string `json:"uuid"`
Title string `json:"title"`
Status string `json:"status"`
Error string `json:"error,omitempty"` // Human-readable failure message (empty on success)
ErrorCode string `json:"error_code,omitempty"` // Machine-readable failure code (empty on success)
RetrievalInstruction string `json:"retrieval_instruction"`
}
CallbackTask represents a single task's status in a callback payload.
type CompletionSink ¶ added in v0.3.5
type CompletionSink func(payloadJSON []byte)
CompletionSink receives the JSON-encoded CallbackPayload when a taskset run finishes. An embedding host (e.g. ClawEh) injects one to deliver the completion to the agent; standalone Maestro passes nil (no callback). This replaces the former HTTP callback_url POST.
type DispatchRequest ¶
type DispatchRequest struct {
Project string
Path string // auto-generate "dispatch/<uuid8>" if empty
Title string // default "Dispatched task" if empty
LLMModelID string
Prompt string
InstructionsText string
InstructionsFile string
InstructionsFileSource string
CallbackURL string
}
DispatchRequest holds parameters for a single-task fire-and-forget dispatch
type DispatchResult ¶
type DispatchResult struct {
Project string `json:"project"`
Path string `json:"path"`
UUID string `json:"uuid"`
Title string `json:"title"`
Status string `json:"status"`
RetrievalInstruction string `json:"retrieval_instruction"`
Message string `json:"message"`
}
DispatchResult is returned immediately from RunDispatch
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter implements a token bucket rate limiter
func NewRateLimiter ¶
func NewRateLimiter(maxRequests, periodSeconds int) *RateLimiter
NewRateLimiter creates a new rate limiter
func (*RateLimiter) Available ¶
func (r *RateLimiter) Available() int
Available returns the number of requests available before hitting the limit
func (*RateLimiter) Wait ¶
func (r *RateLimiter) Wait() time.Duration
Wait blocks until the rate limit allows a new request Returns the time waited
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner executes tasks via configured LLMs
func New ¶
func New(cfg *config.Config, logger *logging.Logger, lib *library.Service, playbooksSvc *playbooks.Service, refSvc *reference.Service, llmSvc llm.Dispatcher, tasksSvc *tasks.Service, projectsSvc *projects.Service) *Runner
New creates a new Runner
func (*Runner) GenerateReport ¶
GenerateReport (generateAndSaveReport) generates reports after task execution completes. Supports multiple reports via JSON manifest files. If a taskset's WorkerReportTemplate points to a .json file, it's parsed as a manifest containing multiple {suffix, file} entries. Each suffix produces a separate report file (e.g., Report.md, Internal.md, Summary.md). GenerateReport generates reports for a project's task results. This is the public API for report generation, callable from handlers. Returns the list of generated report filenames.
func (*Runner) GetResults ¶
func (r *Runner) GetResults(req *global.ResultsRequest) (*global.ResultsResponse, error)
GetResults retrieves task results
func (*Runner) GetTaskStatus ¶
func (r *Runner) GetTaskStatus(project, path, taskType string) (*TaskStatusResult, error)
GetTaskStatus returns the current status of tasks in a project
func (*Runner) Run ¶
func (r *Runner) Run(ctx context.Context, req *global.RunRequest, notify CompletionSink) (*global.RunResult, error)
Run executes eligible tasks for a project in the background Returns immediately with the count of tasks queued
func (*Runner) RunDispatch ¶
func (r *Runner) RunDispatch(ctx context.Context, req *DispatchRequest, notify CompletionSink) (*DispatchResult, error)
RunDispatch creates a single-task taskset and executes it asynchronously. Returns immediately with status "running". Fires a callback when complete if CallbackURL is set. Dispatches run concurrently with regular runs and other dispatches. ctx is the caller's request context; its values (not its cancellation) are carried into the asynchronous execution, see detachContext.
func (*Runner) SetHostDispatched ¶ added in v0.3.4
SetHostDispatched marks the runner as driven by a host-injected dispatcher that owns model selection. In that mode the runner does not resolve or validate any Maestro LLM — it dispatches the prompt and lets the host choose the model.
It may be called again while a run is in progress (an embedding host re-registers the provider on the same runner), hence the atomic flag.
type SchemaValidationError ¶
type SchemaValidationError struct {
Phase string // "worker" or "qa"
ValidationErrors []string // User-friendly error messages
ErrorFilename string // Name of the error details file
CanRetry bool // Whether retry is allowed (under limits)
}
SchemaValidationError is returned when a response fails schema validation but can potentially be retried with the error feedback
func IsSchemaValidationError ¶
func IsSchemaValidationError(err error) (*SchemaValidationError, bool)
IsSchemaValidationError checks if an error is a SchemaValidationError
func (*SchemaValidationError) Error ¶
func (e *SchemaValidationError) Error() string
type TaskStatusInfo ¶
TaskStatusInfo represents basic task information for status checking
type TaskStatusResult ¶
type TaskStatusResult struct {
Project string `json:"project"`
TotalTasks int `json:"total_tasks"`
Pending int `json:"pending"`
InProgress int `json:"in_progress"`
Done int `json:"done"`
Failed int `json:"failed"`
RunInProgress bool `json:"run_in_progress"`
Tasks []TaskStatusInfo `json:"tasks"`
}
TaskStatusResult represents the status of tasks in a project
type ValidationErrorDetails ¶
type ValidationErrorDetails struct {
TaskID int `json:"task_id"`
TaskUUID string `json:"task_uuid"`
TaskTitle string `json:"task_title"`
Timestamp time.Time `json:"timestamp"`
Phase string `json:"phase"` // "worker" or "qa"
ErrorType string `json:"error_type"` // "schema_validation" or "parse_error"
Summary string `json:"summary"` // Brief human-readable summary
ValidationErrors []string `json:"validation_errors"` // User-friendly error messages
RawErrors []string `json:"raw_errors,omitempty"` // Original error messages from validator
LLMResponse string `json:"llm_response"` // What the LLM actually returned
LLMStderr string `json:"llm_stderr,omitempty"` // Stderr from LLM command (if any)
ExpectedSchema string `json:"expected_schema"` // The JSON schema that was expected
Invocation int `json:"invocation"` // Which invocation number this was
LLMModelID string `json:"llm_model_id,omitempty"` // Which LLM was used
History []global.Message `json:"history,omitempty"` // Task execution history for debugging
}
ValidationErrorDetails contains detailed information about a schema validation failure