Documentation
¶
Index ¶
- type API
- func (api *API) Create(ctx context.Context, requester interface{}, request *CreateRequest) (*CreateResponse, error)
- func (api *API) Get(ctx context.Context, requester interface{}, request *GetRequest) (*execution.WorkflowExecution, error)
- func (api *API) List(ctx context.Context, requester interface{}, request *ListRequest) (*ListResponse, error)
- func (api *API) Run(ctx context.Context, requester interface{}, request *CreateRequest) (*RunResponse, error)
- func (api *API) Status(ctx context.Context, requester interface{}, request *GetRequest) (*StatusResponse, error)
- type CreateRequest
- type CreateResponse
- type ExecutionFailedError
- type ExecutionFailureDetails
- type GetRequest
- type ListRequest
- type ListResponse
- type RunResponse
- type StatusResponse
- type WorkflowFailureDetails
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// Observer receives per-node progress for synchronous runs — the
// CLI sets it; servers leave it nil.
Observer workflowruntime.RunObserver
// contains filtered or unexported fields
}
func NewAPI ¶
func NewAPI(ctrl *controller.Controller, rt *runtime.Runtime, worktrees *worktree.Manager, registry *workflowruntime.Registry) *API
func (*API) Create ¶
func (api *API) Create(ctx context.Context, requester interface{}, request *CreateRequest) (*CreateResponse, error)
func (*API) Get ¶
func (api *API) Get(ctx context.Context, requester interface{}, request *GetRequest) (*execution.WorkflowExecution, error)
func (*API) List ¶
func (api *API) List(ctx context.Context, requester interface{}, request *ListRequest) (*ListResponse, error)
func (*API) Run ¶
func (api *API) Run(ctx context.Context, requester interface{}, request *CreateRequest) (*RunResponse, error)
Run executes a workflow synchronously and returns its final output. The CLI uses it so the process stays alive until the run finishes, unlike Create, which detaches the run and only makes sense inside a long-lived process like the REST server.
func (*API) Status ¶
func (api *API) Status(ctx context.Context, requester interface{}, request *GetRequest) (*StatusResponse, error)
type CreateRequest ¶
type CreateRequest struct {
WorkflowSlug string `json:"workflow_slug,omitempty"`
File string `json:"file,omitempty"`
Input map[string]any `json:"input"`
ProjectDir string `json:"project_dir,omitempty"`
// Worktree is a branch name; the run executes in that branch's
// worktree of the ProjectDir repository (created on demand).
Worktree string `json:"worktree,omitempty"`
// Base is the start point when Worktree creates a new branch.
Base string `json:"base,omitempty"`
// ResumeFromExecutionID + ResumeFromNode re-run a prior execution
// from one node: upstream outputs are reused by reference, the node
// and everything downstream of it run again.
ResumeFromExecutionID string `json:"resume_from_execution_id,omitempty"`
ResumeFromNode string `json:"resume_from_node,omitempty"`
// UseCurrentSpec recompiles the workflow's current YAML instead of
// replaying the stored snapshot (e.g. after a prompt edit).
UseCurrentSpec bool `json:"use_current_spec,omitempty"`
}
func (CreateRequest) Validate ¶
func (r CreateRequest) Validate() error
type CreateResponse ¶
type CreateResponse struct {
ExecutionID string `json:"execution_id,omitempty"`
WorkflowSlug string `json:"workflow_slug"`
WorkflowVersion string `json:"workflow_version"`
Status executionmodels.WorkflowExecutionStatus `json:"status"`
}
type ExecutionFailedError ¶
type ExecutionFailedError struct {
Details ExecutionFailureDetails
Err error
}
func (*ExecutionFailedError) Error ¶
func (e *ExecutionFailedError) Error() string
func (*ExecutionFailedError) Unwrap ¶
func (e *ExecutionFailedError) Unwrap() error
type ExecutionFailureDetails ¶
type GetRequest ¶
func (GetRequest) Validate ¶
func (r GetRequest) Validate() error
type ListRequest ¶
type ListRequest struct {
pagination.CursorRequest
WorkflowSlug string `json:"workflow_slug,omitempty"`
}
func (*ListRequest) Validate ¶
func (r *ListRequest) Validate() error
type ListResponse ¶
type ListResponse struct {
pagination.CursorResponse
WorkflowExecutions []execution.WorkflowExecution `json:"workflow_executions"`
}
type RunResponse ¶
type RunResponse struct {
ExecutionID string `json:"execution_id,omitempty"`
WorkflowSlug string `json:"workflow_slug"`
WorkflowVersion string `json:"workflow_version"`
Status executionmodels.WorkflowExecutionStatus `json:"status"`
Output map[string]any `json:"output,omitempty"`
}
RunResponse is the result of a synchronous workflow run.
type StatusResponse ¶
type StatusResponse struct {
ExecutionID string `json:"execution_id"`
WorkflowSlug string `json:"workflow_slug"`
WorkflowVersion string `json:"workflow_version"`
Status executionmodels.WorkflowExecutionStatus `json:"status"`
StartedAt *time.Time `json:"started_at,omitempty"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
Output map[string]any `json:"output,omitempty"`
Failure *WorkflowFailureDetails `json:"failure,omitempty"`
}
type WorkflowFailureDetails ¶
type WorkflowFailureDetails struct {
NodeExecutionID string `json:"node_execution_id,omitempty"`
NodeID string `json:"node_id,omitempty"`
NodeError string `json:"node_error,omitempty"`
ConversationID string `json:"conversation_id,omitempty"`
HarnessExitCode int `json:"harness_exit_code,omitempty"`
HarnessError string `json:"harness_error,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.