flow

package
v0.1.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package flow runs a sequence of steps the model may name.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format added in v0.1.9

func Format(defs []*Definition) ([]byte, error)

Format writes one task, or a flows list when there are several.

func Lines added in v0.1.9

func Lines(flows map[string]*Definition) []string

Lines returns one index line per task, sorted by name.

func Match added in v0.1.11

func Match(line, query string) bool

Match reports whether a task index line matches the query. The whole query may sit inside the line, or every significant word in the query may appear in it.

func RunFailure added in v0.1.9

func RunFailure(def *Definition, err error) error

RunFailure turns a stopped task run into the sentence the owner reviews.

func TaskRegressions added in v0.1.9

func TaskRegressions(base, next []string) []string

TaskRegressions reports a task the baseline could teach and the current lines cannot.

func Witness added in v0.1.9

func Witness(def *Definition, cat *catalog.Catalog, bodies []string) ([]string, error)

Witness reports what a finished read-only run kept true. The lines name fields and operations. They do not include response values.

Types

type Definition

type Definition struct {
	Name     string   `yaml:"name"`
	Question string   `yaml:"question,omitempty"`
	Answer   []string `yaml:"answer,omitempty"`
	Steps    []Step   `yaml:"steps"`
}

func Find added in v0.1.9

func Find(flows map[string]*Definition, query string) []*Definition

Find returns tasks whose name, question, or answer matches the query.

func Parse

func Parse(data []byte) (*Definition, error)

func ParseFile added in v0.1.9

func ParseFile(data []byte) ([]*Definition, error)

ParseFile reads one flow, or a flows list.

func Propose added in v0.1.9

func Propose(cat *catalog.Catalog) []*Definition

Propose returns a reviewable task for every declared relation between two reads. The question is the relation sentence. The answer lists the last operation's required response fields.

func Review added in v0.1.9

func Review(def *Definition, cat *catalog.Catalog) *Definition

Review returns the task a run confirmed. A binding the relation already supplies is left unset.

func Suggest added in v0.1.9

func Suggest(cat *catalog.Catalog) *Definition

Suggest returns one read-only task the catalog can already teach.

func SuggestIn added in v0.1.11

func SuggestIn(cat *catalog.Catalog, first []string) *Definition

SuggestIn returns one read-only task, preferring a no-argument read whose id is in first, after a declared relation.

func Teach added in v0.1.9

func Teach(def *Definition, cat *catalog.Catalog) (*Definition, error)

Teach fills bindings for a flow that has a question. A flow without a question is returned as parsed when its steps still name operations, fields, and parameters the catalog has.

func (*Definition) Binds added in v0.1.9

func (d *Definition) Binds() []string

Binds lists each value the task copies, as source field to target parameter.

func (*Definition) IndexLine added in v0.1.9

func (d *Definition) IndexLine() string

IndexLine is the task sentence search and the context pack share.

type MissingOutputError added in v0.1.9

type MissingOutputError struct {
	Operation string
	Field     string
}

MissingOutputError is a response that did not include the field the next step needs.

func (MissingOutputError) Error added in v0.1.9

func (e MissingOutputError) Error() string

type Runner

type Runner struct {
	Invoke func(ctx context.Context, operationID string, params map[string]string, approvalID string) (string, string, error)
}

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, def *Definition, params map[string]string) ([]string, error)

type Step

type Step struct {
	Operation string `yaml:"operation"`
	Output    string `yaml:"output,omitempty"` // copied onto the next step's parameter To
	To        string `yaml:"to,omitempty"`
}

func (*Step) UnmarshalYAML

func (s *Step) UnmarshalYAML(value *yaml.Node) error

type StoppedError

type StoppedError struct {
	Status    string
	Operation string
	Why       string
}

func (StoppedError) Error

func (s StoppedError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL