Documentation
¶
Overview ¶
Package workflow implements the state-machine workflow engine: Definition, State, Transition, GuardFunc, and Engine.Execute — all enforced through the shared perm.Engine (no bespoke permission path).
See TAD §8 and PRD §19.3 for the full specification. Implemented in Phase 4.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Definition ¶
type Definition struct {
DocType string
States []State
Transitions []Transition
OnTransition map[string]Handler // keyed by destination State.Name
}
Definition declares the states, transitions, and handlers for a DocType workflow. See TAD §8.
type Engine ¶
type Engine interface {
Register(def Definition) error
AvailableTransitions(ctx context.Context, docType, currentState string) []Transition
Execute(ctx context.Context, docType, id, action string) error
// DocTypes lists every DocType with a registered workflow definition.
// Consumed by the agent ToolRegistry at compile time to emit exactly one
// execute_action_{doctype} tool per workflowed DocType (TAD §10.1 step 6).
DocTypes() []string
}
Engine manages workflow registration, transition discovery, and execution. See TAD §8.
type State ¶
type State struct {
Name string
Style string // UI hint only: "gray" | "yellow" | "green" | "red" | a hex color
}
State defines a workflow state.
type Transition ¶
type Transition struct {
From string
To string
Action string // verb surfaced as a UI button label and an agent enum value
AllowedRoles []string
Guard GuardFunc // optional; evaluated after the AllowedRoles check
}
Transition defines a valid state change, allowed roles, and optional guard.
Click to show internal directories.
Click to hide internal directories.