Documentation
¶
Index ¶
- func ApplyRequestOptions(nodes map[idwrap.IDWrap]node.FlowNode, services RunnerServices)
- func RunFlow(ctx context.Context, flowPtr *mflow.Flow, services RunnerServices, ...) (model.FlowRunResult, error)
- func RunMultipleFlows(ctx context.Context, fileData []byte, allFlows []mflow.Flow, ...) error
- type Checks
- type ChecksOptions
- type Cleanup
- type CleanupBuildDeps
- type JSRunner
- type RunnerServices
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyRequestOptions ¶
func ApplyRequestOptions(nodes map[idwrap.IDWrap]node.FlowNode, services RunnerServices)
ApplyRequestOptions sets each request node's stream: and follow_redirects: options from its HTTP request's settings.
func RunFlow ¶
func RunFlow(ctx context.Context, flowPtr *mflow.Flow, services RunnerServices, reporters *reporter.ReporterGroup) (model.FlowRunResult, error)
func RunMultipleFlows ¶
func RunMultipleFlows(ctx context.Context, fileData []byte, allFlows []mflow.Flow, services RunnerServices, logger *slog.Logger, reporters *reporter.ReporterGroup) error
RunMultipleFlows executes multiple flows based on the run field configuration. Flows run sequentially in dependency order (a topological sort of the run: block, ties broken by original list order) rather than run: block declaration order. A flow whose dependency failed, or was itself skipped, is reported as skipped instead of attempted; flows with no such gate still run even if an unrelated earlier flow failed.
Types ¶
type Checks ¶
Checks evaluates the AI checks (expect: blocks) of a command's flows after each flow runs.
func NewChecks ¶
func NewChecks(bundle *ioworkspace.WorkspaceBundle, opts ChecksOptions) (*Checks, error)
NewChecks compiles the bundle's expect: blocks per flow. It returns nil when the file has none.
type ChecksOptions ¶
type ChecksOptions struct {
// Dir resolves expect: schema paths (the flow file's directory).
Dir string
// CachePath is the judge cache file; "" keeps verdicts in memory only.
CachePath string
// Env is where judge API keys are read from.
Env map[string]string
// HTTP is the judge's client; nil uses a client with a 60 s timeout.
HTTP *http.Client
}
ChecksOptions configure NewChecks.
type Cleanup ¶
type Cleanup struct {
// contains filtered or unexported fields
}
Cleanup is a flow's built cleanup: block, ready to run after the flow's normal steps. A nil *Cleanup (the flow has no cleanup block) runs nothing.
func BuildCleanup ¶
func BuildCleanup(ctx context.Context, flow mflow.Flow, services RunnerServices, deps CleanupBuildDeps) (*Cleanup, error)
BuildCleanup builds the node implementations of flow's cleanup block. It returns nil when the flow has none.
func (*Cleanup) DisplayNames ¶
DisplayNames are the cleanup step names as reporters show them.
func (*Cleanup) Run ¶
func (c *Cleanup) Run(ctx context.Context, varMap map[string]any, emit func(reporter.NodeStatusEvent)) ([]model.NodeRunResult, error)
Run executes the cleanup steps one at a time, in order, against the flow's final variable map (which it extends with the cleanup steps' own outputs). Every step is attempted: a failure does not stop the steps after it. A step is skipped instead when a step it reads produced no output, or a cleanup step it depends on did not succeed.
It returns one result per step and, if any step failed, an error naming the first failure. Cleanup stops early only when ctx is cancelled (Ctrl-C).
type CleanupBuildDeps ¶
type CleanupBuildDeps struct {
Timeout time.Duration
HTTPClient httpclient.HttpClient
RespChan chan nrequest.NodeRequestSideResp
GQLRespChan chan ngraphql.NodeGraphQLSideResp
}
CleanupBuildDeps are the per-run resources cleanup nodes share with the flow's normal nodes.
type JSRunner ¶
type JSRunner struct {
// contains filtered or unexported fields
}
JSRunner manages the lifecycle of the Node.js worker process
func NewJSRunner ¶
NewJSRunner checks if Node.js is available and returns a runner instance
func (*JSRunner) Client ¶
func (r *JSRunner) Client() node_js_executorv1connect.NodeJsExecutorServiceClient
Client returns the RPC client for the JS executor
type RunnerServices ¶
type RunnerServices struct {
NodeService sflow.NodeService
EdgeService sflow.EdgeService
FlowVariableService sflow.FlowVariableService
Builder *flowbuilder.Builder
JSClient node_js_executorv1connect.NodeJsExecutorServiceClient
// Cleanups holds each flow's cleanup: block, keyed by owning flow ID. The
// hidden cleanup flows must have been imported (ImportFlowCleanups).
Cleanups map[idwrap.IDWrap]ioworkspace.FlowCleanup
// Streams holds request steps' stream: settings, by HTTP request ID.
Streams map[idwrap.IDWrap]mhttp.HTTPStream
// NoRedirects holds the HTTP requests of steps with follow_redirects: false.
NoRedirects map[idwrap.IDWrap]bool
// Checks evaluates the flows' AI checks after each run; nil when the file has none.
Checks *Checks
}