workflows

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RunStatusRunning   = "running"
	RunStatusSucceeded = "succeeded"
	RunStatusFailed    = "failed"
	RunStatusSkipped   = "skipped"
	RunStatusCanceled  = "canceled"
)
View Source
const ContainerActionV1 = "action-v1"
View Source
const DefaultDefinitionsDir = "workflows"
View Source
const DurableExternalInputV1 = "durable-external-input-v1"
View Source
const DurableTaskStateV1 = "durable-task-state-v1"
View Source
const GitHubContainersV1 = "github-containers-v1"
View Source
const MaxCommandOutput = 16 << 20
View Source
const MaxHelperBytes int64 = 32 << 20
View Source
const MaxHelperFiles = 4096
View Source
const OrderedDynamicIterationV1 = "ordered-dynamic-iteration-v1"

Capabilities reports library contracts, independently of configured actions.

View Source
const RegisteredGoActionsV1 = "registered-go-actions-v1"
View Source
const RunStatusInterrupted = "interrupted"
View Source
const RunStatusNeedsAttention = "needs_attention"
View Source
const RunStatusQueued = "queued"
View Source
const RunStatusWaiting = "waiting"
View Source
const StructuredContainersV1 = "structured-containers-v1"

Variables

View Source
var ErrActionIntegrity = errors.New("registered action recovery requires attention")
View Source
var ErrExternalInput = errors.New("external input conflict")
View Source
var ErrExternalInputCanceled = fmt.Errorf("%w: execution canceled", ErrExternalInput)

ErrExternalInputCanceled identifies a durable Cancel that alone prevented answer consumption. It wraps ErrExternalInput; journals may wrap the signal, while joined genuine failures must remain observable.

View Source
var ErrExternalInputPaused = fmt.Errorf("%w: execution paused", ErrExternalInput)

ErrExternalInputPaused identifies a durable pause that prevented consumption of an accepted answer. It wraps ErrExternalInput. Journals may wrap this signal; joining a genuine failure preserves that failure instead of suspending it.

View Source
var ErrProviderFailure = errors.New("classified provider failure")

Adapters must classify provider failures explicitly. Arbitrary execution, storage, instruction, checkout, ownership and cleanup errors never skip items.

View Source
var ErrStaleExecution = errors.New("execution generation changed")
View Source
var ErrUncertainTool = errors.New("external tool outcome is uncertain; inspect before explicit recovery")
View Source
var ErrUsageExhausted = errors.New("provider usage exhausted")

Functions

func AgentTaskPrompt

func AgentTaskPrompt(prompt string, input any) (string, error)

AgentTaskPrompt bounds the exact prompt sent to the provider, including typed input.

func CanonicalLocalRef

func CanonicalLocalRef(ref string) (string, error)

func Capabilities

func Capabilities() []string

func CombineStructuredOutputs

func CombineStructuredOutputs(values []any, schema map[string]any) any

func CompareStructuredOutputs

func CompareStructuredOutputs(left, right any) map[string]any

func EstimateAgentPayloadTokens

func EstimateAgentPayloadTokens(value any) int

func ExtractJSONValue

func ExtractJSONValue(text string) (string, any, error)

func FailureClass

func FailureClass(err error) string

func IsControllerAction

func IsControllerAction(uses string) bool

func IsLocalWorkflowRef

func IsLocalWorkflowRef(ref string) bool

func JSONValuesEqual

func JSONValuesEqual(left, right any) bool

JSONValuesEqual compares JSON values, including numbers inside objects and arrays. Keep strings distinct and avoid expanding arbitrarily large exponents.

func MergeStructuredOutputs

func MergeStructuredOutputs(values []any, schema map[string]any) any

MergeStructuredOutputs is kept for compatibility. New code should use CombineStructuredOutputs.

func Redact

func Redact(text string, secrets map[string]string) string

func RedactError

func RedactError(err error, secrets map[string]string) error

func RedactValue

func RedactValue(value any, secrets map[string]string) any

func RegisterAction

func RegisterAction[I, O any](r *ActionRegistry, name string, spec ActionSpec[I, O]) error

func RestoreDatabase

func RestoreDatabase(ctx context.Context, dir, source string, owner *ownership.Lock) (string, error)

RestoreDatabase installs a validated consistent snapshot atomically. Existing records are first retained in a consistent private pre-restore backup.

func SplitContainerArgs

func SplitContainerArgs(text string) ([]string, error)

SplitContainerArgs performs quote removal only: no shell expansion, globbing, substitution, or environment interpretation. Empty quoted arguments survive.

func TaskStateReadOnly

func TaskStateReadOnly(operation string) bool

func ToolWireName

func ToolWireName(d ToolDefinition) string

func Validate

func Validate(w *Workflow) error

func ValidateTaskGroup

func ValidateTaskGroup(group string) error

Types

type ActionAttempt

type ActionAttempt struct {
	Attempt             Attempt                     `json:"attempt"`
	Context             ActionContext               `json:"context"`
	Contract            ActionContract              `json:"contract"`
	Input               json.RawMessage             `json:"input"`
	Bindings            json.RawMessage             `json:"bindings"`
	InputFingerprint    string                      `json:"input_fingerprint"`
	BindingsFingerprint string                      `json:"bindings_fingerprint"`
	State               string                      `json:"state"`
	Result              ActionValue                 `json:"result"`
	Error               string                      `json:"error,omitempty"`
	Reconciliations     []ActionRecoveryObservation `json:"reconciliations,omitempty"`
	Revision            int                         `json:"revision"`
}

ActionAttempt retains admission and every reconciliation observation. A lost completion leaves State admitted; neither a handler error nor retry-uncertain proves that an external mutation had no effect.

type ActionCheckpoint

type ActionCheckpoint[I, O any] struct {
	Input    I
	Bindings json.RawMessage
	Result   ActionResult[O]
}

type ActionContext

type ActionContext struct {
	CredentialRefs string `json:"credential_refs,omitempty"`
	RunID          string `json:"run_id"`
	JobID          string `json:"job_id"`
	StepID         string `json:"step_id"`
	Iteration      int    `json:"iteration"`
	AttemptID      string `json:"attempt_id"`
	Attempt        int    `json:"attempt"`
	Generation     int64  `json:"generation"`
	OperationKey   string `json:"operation_key"`
}

ActionContext identifies a physical attempt and a stable logical operation. OperationKey is unchanged by resume, reconciliation, or a new attempt.

type ActionContract

type ActionContract struct {
	Name           string          `json:"name"`
	Implementation string          `json:"implementation"`
	Effect         ActionEffect    `json:"effect"`
	InputSchema    json.RawMessage `json:"input_schema"`
	OutputSchema   json.RawMessage `json:"output_schema"`
	Fingerprint    string          `json:"fingerprint"`
}

type ActionEffect

type ActionEffect string
const (
	ActionReadOnly         ActionEffect = "read_only"
	ActionExternalMutation ActionEffect = "external_mutation"
)

type ActionJournal

type ActionJournal interface {
	Journal
	ActionAttempts(context.Context, string) ([]ActionAttempt, error)
	AdmitAction(context.Context, ActionAttempt) error
	CheckpointAction(context.Context, ActionAttempt) error
}

ActionJournal is an optional Journal extension. Admission and completion must atomically update both the action record and its linked step attempt, fence the originating execution owner, and retain reconciliation history.

type ActionReconciliation

type ActionReconciliation[O any] struct {
	// Outcome must be completed, no_effect, or unknown. Proof is required for
	// completed/no_effect; it must identify application-owned evidence/receipts.
	Outcome string
	Proof   json.RawMessage
	Result  ActionResult[O]
}

type ActionRecoveryObservation

type ActionRecoveryObservation struct {
	Generation int64           `json:"generation"`
	Time       time.Time       `json:"time"`
	Outcome    string          `json:"outcome"`
	Proof      json.RawMessage `json:"proof,omitempty"`
	Error      string          `json:"error,omitempty"`
}

type ActionRegistry

type ActionRegistry struct {
	// contains filtered or unexported fields
}

ActionRegistry is safe for concurrent registration. First execution freezes it permanently; configure a new registry to admit different contracts.

type ActionRequest

type ActionRequest struct {
	RunID     string
	JobID     string
	StepID    string
	Iteration int
	Uses      string
	With      map[string]any
	Metadata  map[string]any
	Secrets   map[string]string
	Needs     map[string]JobExecution
	Steps     map[string]StepExecution
}

type ActionResult

type ActionResult[O any] struct {
	Output   O               `json:"output"`
	Evidence json.RawMessage `json:"evidence,omitempty"`
	Receipt  json.RawMessage `json:"receipt,omitempty"`
}

type ActionRunner

type ActionRunner interface {
	Admission(context.Context, map[string]*Workflow) (map[string]any, error)
	RunAction(context.Context, ActionRequest) (map[string]any, error)
}

type ActionSpec

type ActionSpec[I, O any] struct {
	Implementation     string
	Effect             ActionEffect
	Handler            func(context.Context, ActionContext, I) (ActionResult[O], error)
	Bindings           func(context.Context, ActionContext, I) (json.RawMessage, error)
	ValidateCheckpoint func(context.Context, ActionContext, ActionCheckpoint[I, O]) error
	Reconcile          func(context.Context, ActionContext, ActionCheckpoint[I, O]) (ActionReconciliation[O], error)
}

ActionSpec hooks are application code. Bindings, ValidateCheckpoint and Reconcile must be read-only. Implementation must change whenever executable semantics change. Credentials belong in application-owned clients/closures.

type ActionValue

type ActionValue struct {
	Output   json.RawMessage `json:"output,omitempty"`
	Evidence json.RawMessage `json:"evidence,omitempty"`
	Receipt  json.RawMessage `json:"receipt,omitempty"`
}

ActionValue is the serialized result retained by an ActionJournal. Application handlers use the typed ActionResult instead.

type AgentDefinition

type AgentDefinition struct {
	Name                  string `toml:"name" json:"name"`
	Description           string `toml:"description" json:"description"`
	DeveloperInstructions string `toml:"developer_instructions" json:"developer_instructions"`
	Model                 string `toml:"model" json:"model,omitempty"`
	ReasoningEffort       string `toml:"model_reasoning_effort" json:"model_reasoning_effort,omitempty"`
	Source                string `toml:"-" json:"source"`
	Bytes                 string `toml:"-" json:"bytes"`
}

AgentDefinition is immutable admitted data, not a provider/security policy. Native custom agent files cannot replace authentication, tools or execution.

func LoadAgentDefinition

func LoadAgentDefinition(path string) (*AgentDefinition, error)

type AgentOutputContract

type AgentOutputContract struct {
	Format         string         `json:"format,omitempty"`
	Schema         map[string]any `json:"schema,omitempty"`
	RepairAttempts int            `json:"repair_attempts,omitempty"`
	// contains filtered or unexported fields
}

func ParseAgentOutputContract

func ParseAgentOutputContract(raw any) (*AgentOutputContract, error)

func (*AgentOutputContract) Enabled

func (c *AgentOutputContract) Enabled() bool

func (*AgentOutputContract) Instruction

func (c *AgentOutputContract) Instruction() string

func (*AgentOutputContract) Validate

func (c *AgentOutputContract) Validate() error

type AgentRequest

type AgentRequest struct {
	Definition *AgentDefinition
	Input      any
	Turns      int

	// SessionOwnerID retains controller-owned provider state across conversation turns.
	SessionOwnerID string
	ObserveUsage   func(UsageUpdate) error
	Tools          *InvocationTools
	Generation     int64
	ParentWorkerID string
	RunID          string
	InvocationID   string
	RepairOnly     bool
	AgentID        string
	Model          string
	Prompt         string
	Workspace      string
	Output         *AgentOutputContract
}

func (AgentRequest) DetachStructuredContract

func (request AgentRequest) DetachStructuredContract() (
	AgentRequest,
	*AgentOutputContract,
)

DetachStructuredContract gives one concurrent execution its own lazy pattern cache while retaining the immutable normalized schema graph.

type AgentRunner

type AgentRunner interface {
	RunAgent(context.Context, AgentRequest) (map[string]any, error)
}

type AgentTaskDispatch

type AgentTaskDispatch struct {
	Reference string         `json:"agent"`
	Operation string         `json:"operation"`
	Input     AgentTaskInput `json:"input"`
}

type AgentTaskInput

type AgentTaskInput struct {
	Workspace  string               `json:"workspace,omitempty"`
	Prompt     string               `json:"prompt"`
	Input      any                  `json:"input,omitempty"`
	Output     *AgentOutputContract `json:"output,omitempty"`
	Model      string               `json:"model,omitempty"`
	Turns      int                  `json:"turns,omitempty"`
	Definition *AgentDefinition     `json:"definition,omitempty"`
}

type Artifact

type Artifact struct {
	ID        string `json:"id"`
	RunID     string `json:"run_id"`
	AttemptID string `json:"attempt_id"`
	Name      string `json:"name"`
	SHA256    string `json:"sha256"`
	Size      int    `json:"size"`
}

type Attempt

type Attempt struct {
	AgentTask        *AgentTaskDispatch `json:"agent_task,omitempty"`
	Conversation     *ConversationState `json:"conversation,omitempty"`
	InputFingerprint string             `json:"input_fingerprint,omitempty"`
	Phase            string             `json:"phase,omitempty"`
	TaskAttemptID    string             `json:"task_attempt_id,omitempty"`
	TaskOutputs      map[string]any     `json:"task_outputs,omitempty"`
	RepairCount      int                `json:"repair_count,omitempty"`
	RepairOutputs    []map[string]any   `json:"repair_outputs,omitempty"`
	ID               string             `json:"id"`
	RunID            string             `json:"run_id"`
	JobID            string             `json:"job_id"`
	StepID           string             `json:"step_id"`
	Iteration        int                `json:"iteration"`
	Number           int                `json:"number"`
	Status           string             `json:"status"`
	StartedAt        time.Time          `json:"started_at"`
	FinishedAt       time.Time          `json:"finished_at,omitempty"`
	Result           StepExecution      `json:"result"`
}

type Broker

type Broker struct {
	Store    *SQLiteStore
	Workers  *WorkerManager
	External ExternalToolDispatcher
	// contains filtered or unexported fields
}

func (*Broker) Bind

func (b *Broker) Bind(ctx context.Context, in ToolInvocation) (ToolBinding, error)

type Capacity

type Capacity struct {
	Slots        chan struct{}
	MaxSuspended int
	// contains filtered or unexported fields
}

Capacity shares one execution boundary across workflows, workers and broker callbacks. Slots remains exposed for compatibility with existing callers.

func (*Capacity) Acquire

func (p *Capacity) Acquire(ctx context.Context) (*CapacityLease, error)

func (*Capacity) Suspended

func (p *Capacity) Suspended() int

func (*Capacity) TryAcquire

func (p *Capacity) TryAcquire() (*CapacityLease, bool)

type CapacityLease

type CapacityLease struct {
	// contains filtered or unexported fields
}

func (*CapacityLease) Reacquire

func (l *CapacityLease) Reacquire(ctx context.Context) error

func (*CapacityLease) Release

func (l *CapacityLease) Release()

func (*CapacityLease) Suspend

func (l *CapacityLease) Suspend() error

Suspend is called only after an adapter's explicit invocation-level blocked barrier, never just because one callback is waiting. It is idempotent across parallel callbacks and bounded independently of runnable execution slots.

type ChannelMessageTrigger

type ChannelMessageTrigger struct {
	Channels     StringList       `json:"channels,omitempty"     yaml:"channels,omitempty"`
	Chats        StringList       `json:"chats,omitempty"        yaml:"chats,omitempty"`
	Senders      StringList       `json:"senders,omitempty"      yaml:"senders,omitempty"`
	Mentioned    *bool            `json:"mentioned,omitempty"    yaml:"mentioned,omitempty"`
	Command      string           `json:"command,omitempty"      yaml:"command,omitempty"`
	TextMatches  string           `json:"text_matches,omitempty" yaml:"text_matches,omitempty"`
	Passthrough  *bool            `json:"passthrough,omitempty"  yaml:"passthrough,omitempty"`
	Conversation ConversationSpec `json:"conversation,omitempty" yaml:"conversation,omitempty"`
}

type CommandTrigger

type CommandTrigger struct {
	Name         string           `json:"name,omitempty"         yaml:"name,omitempty"`
	Channels     StringList       `json:"channels,omitempty"     yaml:"channels,omitempty"`
	Chats        StringList       `json:"chats,omitempty"        yaml:"chats,omitempty"`
	Senders      StringList       `json:"senders,omitempty"      yaml:"senders,omitempty"`
	Args         map[string]Input `json:"args,omitempty"         yaml:"args,omitempty"`
	Passthrough  *bool            `json:"passthrough,omitempty"  yaml:"passthrough,omitempty"`
	Conversation ConversationSpec `json:"conversation,omitempty" yaml:"conversation,omitempty"`
}

type ContainerImplementation

type ContainerImplementation struct {
	ContractVersion int                       `json:"contract_version,omitempty"`
	Bundle          *HelperBundle             `json:"helper_bundle,omitempty"`
	Selection       containerapi.Selection    `json:"selection"`
	Image           containerapi.Image        `json:"image"`
	Guardian        runtimeexec.GuardianAsset `json:"guardian"`
	Policy          runtimeexec.Policy        `json:"policy"`
}

type ConversationDelivery

type ConversationDelivery struct {
	ID      string `json:"id"`
	From    string `json:"from"`
	To      string `json:"to"`
	Message string `json:"message"`
}

These receipts use the same controller-owned send/finish protocol as JSON conversations. Sender identity and turn ownership never come from arguments.

type ConversationReceipt

type ConversationReceipt struct {
	Fingerprint string          `json:"fingerprint"`
	Reply       json.RawMessage `json:"reply"`
}

type ConversationSpec

type ConversationSpec struct {
	Session  string `json:"session,omitempty"  yaml:"session,omitempty"`
	Delivery string `json:"delivery,omitempty" yaml:"delivery,omitempty"`
}

type ConversationState

type ConversationState struct {
	Roles            []string                       `json:"roles"`
	Sessions         map[string]string              `json:"sessions"`
	Queue            []ConversationDelivery         `json:"queue"`
	Active           *ConversationDelivery          `json:"active,omitempty"`
	Transcript       []ConversationDelivery         `json:"transcript"`
	Receipts         map[string]ConversationReceipt `json:"receipts"`
	Turns            int                            `json:"turns"`
	Calls            int                            `json:"calls"`
	MaxCalls         int                            `json:"maxCalls"`
	Messages         int                            `json:"messages"`
	MaxMessages      int                            `json:"maxMessages"`
	Prompt           string                         `json:"prompt"`
	FinishBy         string                         `json:"finishBy"`
	Finished         bool                           `json:"finished"`
	Result           any                            `json:"result,omitempty"`
	Failure          string                         `json:"failure,omitempty"`
	IntegrityFailure bool                           `json:"integrityFailure,omitempty"`
	Deadline         time.Time                      `json:"deadline"`
}

type Definition

type Definition struct {
	Ref   string        `json:"ref"`
	Name  string        `json:"name,omitempty"`
	Call  *WorkflowCall `json:"workflow_call,omitempty"`
	Error string        `json:"error,omitempty"`
}

type Delivery

type Delivery struct {
	Channel, ChatID, TopicID, ThreadTS, MessageID, ReplyToMessageID string
	ReplyHandles                                                    map[string]string
}

type Event

type Event struct {
	Version  int             `json:"version"`
	Sequence int64           `json:"sequence"`
	RunID    string          `json:"run_id"`
	Time     time.Time       `json:"time"`
	Type     string          `json:"type"`
	Data     json.RawMessage `json:"data,omitempty"`
}

type EventEntityTrigger

type EventEntityTrigger struct {
	IDs        StringList            `json:"ids,omitempty"        yaml:"ids,omitempty"`
	Types      StringList            `json:"types,omitempty"      yaml:"types,omitempty"`
	Attributes map[string]StringList `json:"attributes,omitempty" yaml:"attributes,omitempty"`
}

EventEntityTrigger filters the normalized actor or subject attached to an external event.

type EventTrigger

type EventTrigger struct {
	Sources    StringList            `json:"sources,omitempty"    yaml:"sources,omitempty"`
	Connectors StringList            `json:"connectors,omitempty" yaml:"connectors,omitempty"`
	Types      StringList            `json:"types,omitempty"      yaml:"types,omitempty"`
	Actor      *EventEntityTrigger   `json:"actor,omitempty"      yaml:"actor,omitempty"`
	Subject    *EventEntityTrigger   `json:"subject,omitempty"    yaml:"subject,omitempty"`
	Attributes map[string]StringList `json:"attributes,omitempty" yaml:"attributes,omitempty"`
}

EventTrigger filters connector-independent events from the durable external event inbox. Values in each list are alternatives; populated fields are combined.

type Executor

type Executor struct {
	ContainerGuardianDirectory string

	Workers *WorkerManager

	// BeforeFinalize retains execution ownership until supervised workers stop.
	BeforeFinalize   func(context.Context, string) error
	Capacity         *Capacity
	BindTools        ToolBinder
	CommandExecution runtimeexec.Policy
	Ready            func(context.Context) error

	Actions            ActionRunner
	ApplicationActions *ActionRegistry

	ActionFactory  func(json.RawMessage) (ActionRunner, error)
	WorkspaceDir   string
	DefinitionsDir string
	Agents         AgentRunner
	Store          RunStore
	MaxParallel    int
	Roles          json.RawMessage
	RoleRunner     func(json.RawMessage) (AgentRunner, error)
	Slots          chan struct{}
	// contains filtered or unexported fields
}

func (*Executor) Discover

func (e *Executor) Discover() ([]Definition, error)

func (*Executor) Load

func (e *Executor) Load(ref string) (map[string]*Workflow, error)

Load snapshots and validates the entire reusable workflow closure before any subprocess starts. Definitions cannot change underneath an admitted run.

func (*Executor) Prepare

func (e *Executor) Prepare(ctx context.Context, req RunRequest) (*Run, error)

Prepare validates and persists a queued run before acknowledging admission. Controller admission resolves credentials separately from the snapshot.

func (*Executor) Resume

func (e *Executor) Resume(ctx context.Context, id string, secrets map[string]string, retry bool) (result *Run, err error)

Resume uses the admitted closure, never current workflow files. Uncertain attempts require an explicit acknowledgement before another effect is launched.

func (*Executor) Run

func (e *Executor) Run(ctx context.Context, req RunRequest) (*Run, error)

type ExternalInputAnswer

type ExternalInputAnswer struct {
	AnswerID   string          `json:"answer_id"`
	EvidenceID string          `json:"evidence_id"`
	Value      json.RawMessage `json:"value"`
}

ExternalInputAnswer is data interpreted and validated by the host application. AnswerID is unique across the journal, including canceled and consumed gates.

type ExternalInputControl

type ExternalInputControl struct {
	Paused       bool `json:"paused"`
	Canceled     bool `json:"canceled"`
	Continuation bool `json:"continuation_requested"`
}

type ExternalInputGate

type ExternalInputGate struct {
	ID          string                     `json:"gate_id"`
	OriginID    string                     `json:"origin_run_id"`
	RunID       string                     `json:"run_id"`
	Generation  int64                      `json:"execution_generation"`
	JobID       string                     `json:"job_id"`
	StepID      string                     `json:"step_id"`
	Iteration   int                        `json:"iteration"`
	EvidenceID  string                     `json:"evidence_id"`
	Prompt      string                     `json:"prompt"`
	Payload     json.RawMessage            `json:"payload,omitempty"`
	Fingerprint string                     `json:"fingerprint"`
	State       string                     `json:"state"`
	Answer      *ExternalInputAnswer       `json:"answer,omitempty"`
	History     []ExternalInputObservation `json:"history"`
}

ExternalInputGate retains the immutable request and its complete lifecycle. RunID identifies the physical child; OriginID is the controller handle.

type ExternalInputJournal

type ExternalInputJournal interface {
	Journal
	EnsureInputGate(context.Context, ExternalInputGate) (ExternalInputGate, error)
	Inputs(context.Context, string) ([]ExternalInputGate, error)
	AcceptInput(context.Context, string, string, ExternalInputAnswer) (ExternalInputGate, error)
	// ConsumeInput returns ErrExternalInputPaused or ErrExternalInputCanceled
	// when a durable pause or Cancel alone prevents consumption. Pause preserves
	// accepted state; Cancel preserves retained answer/history while invalidating
	// its gate. Return genuine failures too if control alone did not explain denial.
	ConsumeInput(context.Context, string) (ExternalInputGate, error)
	InputControl(context.Context, string) (ExternalInputControl, error)
	// QueueResume controls the root handle: unanswered gates remain suspended
	// without a new generation; safe admission atomically clears pause and creates
	// one execution after cancellation and retry-acknowledgement guards. Empty
	// request identity and zero queue limit support embedded Executor.Resume.
	QueueResume(context.Context, string, string, bool, int) (*Run, error)
}

ExternalInputJournal is optional for existing stores. Workflows containing input/wait require it before admission. Writes must fence the current owner; acceptance and continuation intent must commit in one transaction. New effect admissions must reject durable Cancel; completed results/checkpoints and cleanup persistence remain writable after cancellation.

type ExternalInputObservation

type ExternalInputObservation struct {
	State      string    `json:"state"`
	Time       time.Time `json:"time"`
	Generation int64     `json:"execution_generation"`
}

type ExternalIntent

type ExternalIntent struct {
	Key     string         `json:"key"`
	RunID   string         `json:"run_id"`
	Kind    string         `json:"kind"`
	Payload map[string]any `json:"payload"`
	Status  string         `json:"status"`
	Result  map[string]any `json:"result,omitempty"`
}

type FileStore

type FileStore struct{ Dir string }

FileStore writes one private, atomically replaced JSON checkpoint per run. Records are observational: interrupted runs are never automatically replayed.

func (FileStore) Save

func (s FileStore) Save(ctx context.Context, run *Run) error

type ForEach

type ForEach struct {
	Items       any    `json:"items" yaml:"items"`
	Key         string `json:"key" yaml:"key"`
	Concurrency *int   `json:"concurrency,omitempty" yaml:"concurrency,omitempty"`
}

ForEach executes a reusable workflow over a pinned array, sequentially by default. Key is evaluated against each item; payloads remain data.

type HelperBundle

type HelperBundle struct {
	OriginID string       `json:"origin_run_id"`
	ID       string       `json:"id"`
	Files    []HelperFile `json:"files"`
}

type HelperFile

type HelperFile struct {
	Path   string `json:"path"`
	Mode   uint32 `json:"mode"`
	Size   int64  `json:"size"`
	SHA256 string `json:"sha256"`
}

type Input

type Input struct {
	Type     string `json:"type,omitempty"     yaml:"type,omitempty"`
	Required bool   `json:"required,omitempty" yaml:"required,omitempty"`
	Default  any    `json:"default,omitempty"  yaml:"default,omitempty"`
}

type InvocationTools

type InvocationTools struct {
	Binding ToolBinding
	Lease   *CapacityLease
}

InvocationTools is controller-created and never deserialized from provider arguments. The adapter owns the blocked barrier, and must reacquire the lease before returning a tool result that permits provider execution to continue.

type InvocationUsage

type InvocationUsage struct {
	UsageIdentity
	Observations map[string]UsageObservation `json:"observations"`
}

type IterationItemResult

type IterationItemResult struct {
	Fingerprint     string                  `json:"fingerprint"`
	PlanFingerprint string                  `json:"plan_fingerprint"`
	Jobs            map[string]JobExecution `json:"jobs,omitempty"`
	Key             string                  `json:"key"`
	Number          int                     `json:"number"`
	Attempt         int                     `json:"attempt"`
	ChildID         string                  `json:"child_id,omitempty"`
	Status          string                  `json:"status"`
	Outputs         map[string]any          `json:"outputs,omitempty"`
	FailureClass    string                  `json:"failure_class,omitempty"`
	Error           string                  `json:"error,omitempty"`
}

IterationItemResult is an observation of one physical child. Terminal results are append-only; explicit resume appends a fresh attempt for incomplete items.

type IterationJournal

type IterationJournal interface {
	Journal
	CheckIteration(context.Context) error
	IterationRun(context.Context, string, string, string) (string, error)
	BeginInput(context.Context, string, string, string, int, bool, string, bool, string) (Attempt, bool, error)
	PinIteration(context.Context, IterationPlan) error
	IterationPlan(context.Context, string, string) (IterationPlan, error)
	IterationAttempts(context.Context, string, string) ([]IterationItemResult, error)
	AppendIteration(context.Context, string, string, IterationItemResult) error
}

IterationJournal is required only for workflows containing for-each. Plan and attempt writes must fence the originating owner and commit before dispatch or advancing. Each attempt has one admission and one immutable result. A separately appended recovered observation may close an interrupted child after a lost terminal write.

type IterationPlan

type IterationPlan struct {
	RunID       string              `json:"run_id"`
	JobID       string              `json:"job_id"`
	Fingerprint string              `json:"fingerprint"`
	Items       []IterationPlanItem `json:"items"`
}

IterationPlan is immutable. Fingerprint binds order, payloads, resolved call inputs, the concurrency bound, admitted definition closure, roles, and action contracts.

type IterationPlanItem

type IterationPlanItem struct {
	Key    string         `json:"key"`
	Number int            `json:"number"`
	Item   any            `json:"item"`
	Inputs map[string]any `json:"inputs"`
}

type Job

type Job struct {
	Container       *JobContainer     `json:"container,omitempty" yaml:"container,omitempty"`
	ForEach         *ForEach          `json:"for-each,omitempty" yaml:"for-each,omitempty"`
	Repeat          *Repeat           `json:"repeat,omitempty" yaml:"repeat,omitempty"`
	Name            string            `json:"name,omitempty"              yaml:"name,omitempty"`
	RunsOn          string            `json:"runs-on,omitempty"           yaml:"runs-on,omitempty"`
	Needs           StringList        `json:"needs,omitempty"             yaml:"needs,omitempty"`
	Uses            string            `json:"uses,omitempty"              yaml:"uses,omitempty"`
	If              string            `json:"if,omitempty"                yaml:"if,omitempty"`
	ContinueOnError bool              `json:"continue_on_error,omitempty" yaml:"continue-on-error,omitempty"`
	With            map[string]any    `json:"with,omitempty"              yaml:"with,omitempty"`
	Secrets         any               `json:"secrets,omitempty"           yaml:"secrets,omitempty"`
	Outputs         map[string]string `json:"outputs,omitempty"           yaml:"outputs,omitempty"`
	Steps           []Step            `json:"steps,omitempty"             yaml:"steps,omitempty"`
	Context         RunContext        `json:"context,omitempty"           yaml:"context,omitempty"`
}

type JobContainer

type JobContainer struct {
	Files          []string                 `json:"files,omitempty" yaml:"files,omitempty"`
	Image          string                   `json:"image" yaml:"image"`
	Implementation *ContainerImplementation `json:"implementation,omitempty" yaml:"-"`
}

func (*JobContainer) UnmarshalYAML

func (c *JobContainer) UnmarshalYAML(n *yaml.Node) error

type JobExecution

type JobExecution struct {
	ChildRunID   string                   `json:"child_run_id,omitempty"`
	ChildJobs    map[string]JobExecution  `json:"child_jobs,omitempty"`
	Items        []IterationItemResult    `json:"items,omitempty"`
	Complete     bool                     `json:"complete,omitempty"`
	FailureClass string                   `json:"failure_class,omitempty"`
	Iterations   []JobIteration           `json:"iterations,omitempty"`
	ID           string                   `json:"id"`
	Status       string                   `json:"status"`
	Outputs      map[string]any           `json:"outputs,omitempty"`
	Steps        map[string]StepExecution `json:"steps,omitempty"`
	Error        string                   `json:"error,omitempty"`
}

type JobIteration

type JobIteration struct {
	Number  int                      `json:"number"`
	Status  string                   `json:"status"`
	Outputs map[string]any           `json:"outputs,omitempty"`
	Steps   map[string]StepExecution `json:"steps,omitempty"`
	Error   string                   `json:"error,omitempty"`
}

type Journal

Journal supplements the compatibility checkpoint interface with durable admission and completion. Completion is committed before a dependent starts.

type MessageSummary

type MessageSummary struct {
	ID       string `json:"id"`
	WorkerID string `json:"worker_id"`
	Sequence int    `json:"sequence"`
	Status   string `json:"status"`
}

type NativeTaskRunner

type NativeTaskRunner interface {
	AdmitNativeTask(*AgentDefinition) (*AgentDefinition, error)
}

type Output

type Output struct {
	Value string `json:"value,omitempty" yaml:"value,omitempty"`
}

type Page

type Page[T any] struct {
	Items      []T    `json:"items"`
	NextCursor string `json:"next_cursor,omitempty"`
}

type ProviderCapabilities

type ProviderCapabilities struct {
	Sessions         bool `json:"sessions"`
	Resume           bool `json:"resume"`
	Interrupt        bool `json:"interrupt"`
	StructuredOutput bool `json:"structured_output"`
	ManagedPolicy    bool `json:"managed_policy"`
}

SessionRunner is the live-provider contract. Compatibility adapters report their limitations explicitly; callers must not infer resumability from IDs.

type ProviderEvent

type ProviderEvent struct {
	Type      string         `json:"type"`
	SessionID string         `json:"session_id,omitempty"`
	Data      map[string]any `json:"data,omitempty"`
}

type Removal

type Removal struct {
	Kind  string `json:"kind"`
	Path  string `json:"path"`
	State string `json:"state"`
}

type Repeat

type Repeat struct {
	MaxAttempts int    `json:"max-attempts" yaml:"max-attempts"`
	Until       string `json:"until" yaml:"until"`
}

type ResolvedRef

type ResolvedRef struct {
	Canonical string
	Path      string
}

type Resolver

type Resolver struct {
	WorkspaceDir   string
	DefinitionsDir string
}

func (Resolver) ResolveLocal

func (r Resolver) ResolveLocal(ref string) (ResolvedRef, error)

type Retention

type Retention struct {
	OriginID  string    `json:"origin_run_id"`
	Root      string    `json:"workspace"`
	State     string    `json:"state"`
	Removals  []Removal `json:"removals"`
	UpdatedAt time.Time `json:"updated_at"`
}

type Run

type Run struct {
	Usage        *UsageSummary           `json:"normalized_usage,omitempty"`
	Generation   int64                   `json:"execution_generation,omitempty"`
	Owner        string                  `json:"-"`
	FailureClass string                  `json:"failure_class,omitempty"`
	OriginID     string                  `json:"origin_run_id,omitempty"`
	Version      int                     `json:"version,omitempty"`
	ID           string                  `json:"id"`
	WorkflowRef  string                  `json:"workflow_ref"`
	Status       string                  `json:"status"`
	StartedAt    time.Time               `json:"started_at"`
	FinishedAt   time.Time               `json:"finished_at,omitempty"`
	Jobs         map[string]JobExecution `json:"jobs"`
	Outputs      map[string]any          `json:"outputs,omitempty"`
	Error        string                  `json:"error,omitempty"`
}

type RunContext

type RunContext struct {
	Session  string `json:"session,omitempty"  yaml:"session,omitempty"`
	Delivery string `json:"delivery,omitempty" yaml:"delivery,omitempty"`
}

type RunRequest

type RunRequest struct {
	TaskGroup string

	Execution      runtimeexec.Policy
	RequestID      string
	Metadata       map[string]any
	Ref            string
	Inputs         map[string]any
	Secrets        map[string]string
	Event          map[string]any
	SecretRefs     map[string]string
	RetryUncertain bool
	// contains filtered or unexported fields
}

type RunStore

type RunStore interface {
	Save(context.Context, *Run) error
}

type RunSummary

type RunSummary struct {
	ID          string `json:"id"`
	OriginID    string `json:"origin_run_id"`
	Generation  int64  `json:"execution_generation"`
	WorkflowRef string `json:"workflow_ref"`
	Status      string `json:"status"`
	Updated     string `json:"updated"`
}

type RuntimeEventTrigger

type RuntimeEventTrigger struct {
	Kinds    StringList `json:"kinds,omitempty"    yaml:"kinds,omitempty"`
	Sources  StringList `json:"sources,omitempty"  yaml:"sources,omitempty"`
	Agents   StringList `json:"agents,omitempty"   yaml:"agents,omitempty"`
	Sessions StringList `json:"sessions,omitempty" yaml:"sessions,omitempty"`
	Channels StringList `json:"channels,omitempty" yaml:"channels,omitempty"`
	Chats    StringList `json:"chats,omitempty"    yaml:"chats,omitempty"`
}

type SQLiteStore

type SQLiteStore struct {
	Dir string
	// contains filtered or unexported fields
}

func OpenSQLite

func OpenSQLite(dir string) (*SQLiteStore, error)

func OpenSQLiteInspection

func OpenSQLiteInspection(dir string) (*SQLiteStore, error)

OpenSQLiteInspection never creates or migrates a workspace database.

func (*SQLiteStore) AcceptInput

func (s *SQLiteStore) AcceptInput(ctx context.Context, origin, id string, a ExternalInputAnswer) (ExternalInputGate, error)

func (*SQLiteStore) ActionAttempts

func (s *SQLiteStore) ActionAttempts(ctx context.Context, run string) ([]ActionAttempt, error)

func (*SQLiteStore) AdmissionRequest

func (s *SQLiteStore) AdmissionRequest(ctx context.Context, requestID string) (*Run, Snapshot, error)

func (*SQLiteStore) Admit

func (s *SQLiteStore) Admit(ctx context.Context, r *Run, snap Snapshot) error

func (*SQLiteStore) AdmitAction

func (s *SQLiteStore) AdmitAction(ctx context.Context, a ActionAttempt) error

func (*SQLiteStore) AdmitInvocation

func (s *SQLiteStore) AdmitInvocation(ctx context.Context, record runtimeexec.Record) error

func (*SQLiteStore) AppendIteration

func (s *SQLiteStore) AppendIteration(ctx context.Context, run, job string, r IterationItemResult) error

func (*SQLiteStore) Artifact

func (s *SQLiteStore) Artifact(ctx context.Context, run, id string) ([]byte, error)

func (*SQLiteStore) Artifacts

func (s *SQLiteStore) Artifacts(ctx context.Context, run string) ([]Artifact, error)

func (*SQLiteStore) Attempts

func (s *SQLiteStore) Attempts(ctx context.Context, id string) ([]Attempt, error)

func (*SQLiteStore) Backup

func (s *SQLiteStore) Backup(ctx context.Context, destination string, owner *ownership.Lock) error

Backup includes committed WAL content. It never exports provider credentials or assumes a database-only backup can restore external session/workspace data.

func (*SQLiteStore) Begin

func (s *SQLiteStore) Begin(ctx context.Context, run, job, step string, iteration int, retry bool) (Attempt, bool, error)

func (*SQLiteStore) BeginBlock

func (s *SQLiteStore) BeginBlock(ctx context.Context, run, job, step string, iteration int) (Attempt, bool, error)

func (*SQLiteStore) BeginConversation

func (s *SQLiteStore) BeginConversation(ctx context.Context, run, job, step string, iteration int, fingerprint, logical string) (Attempt, bool, error)

func (*SQLiteStore) BeginFinalization

func (s *SQLiteStore) BeginFinalization(ctx context.Context, run *Run) error

BeginFinalization closes durable worker/tool admission before joining work. Run status stays running until the entire generation has stopped.

func (*SQLiteStore) BeginInput

func (s *SQLiteStore) BeginInput(ctx context.Context, run, job, step string, iteration int, retry bool, fingerprint string, replaySafe bool, logical string) (Attempt, bool, error)

func (*SQLiteStore) BeginRetention

func (s *SQLiteStore) BeginRetention(ctx context.Context, record Retention, owner *ownership.Lock) (Retention, error)

func (*SQLiteStore) BeginUsage

func (s *SQLiteStore) BeginUsage(ctx context.Context, identity UsageIdentity) error

func (*SQLiteStore) CancellationRequested

func (s *SQLiteStore) CancellationRequested(ctx context.Context, id string) (bool, error)

func (*SQLiteStore) CaptureHelperBundle

func (s *SQLiteStore) CaptureHelperBundle(ctx context.Context, origin, base string, declarations []string) (bundle *HelperBundle, returned error)

CaptureHelperBundle stages only declared regular files. OpenRoot prevents a concurrent workspace symlink replacement from escaping the owning package.

func (*SQLiteStore) CheckCleanupPrerequisites

func (s *SQLiteStore) CheckCleanupPrerequisites(ctx context.Context) error

func (*SQLiteStore) CheckInvocationCleanup

func (s *SQLiteStore) CheckInvocationCleanup(ctx context.Context, run string) error

func (*SQLiteStore) CheckIteration

func (s *SQLiteStore) CheckIteration(ctx context.Context) error

func (*SQLiteStore) CheckToolEffects

func (s *SQLiteStore) CheckToolEffects(ctx context.Context, run string) error

func (*SQLiteStore) CheckWorkerAdmission

func (s *SQLiteStore) CheckWorkerAdmission(ctx context.Context, run string) error

func (*SQLiteStore) CheckpointAction

func (s *SQLiteStore) CheckpointAction(ctx context.Context, a ActionAttempt) error

func (*SQLiteStore) Claim

func (s *SQLiteStore) Claim(ctx context.Context, r *Run, previous string) error

Claim atomically transfers a suspended/queued run into execution. A second contender cannot launch effects even if it loaded the same prior checkpoint.

func (*SQLiteStore) CleanupHelperStaging

func (s *SQLiteStore) CleanupHelperStaging(ctx context.Context, owner *ownership.Lock) error

CleanupHelperStaging is a recovery operation before accepting admissions. It requires exclusive workspace ownership and removes only marked staging or unreferenced final bundle directories; another origin's committed assets stay.

func (*SQLiteStore) Close

func (s *SQLiteStore) Close() error

func (*SQLiteStore) Complete

func (s *SQLiteStore) Complete(ctx context.Context, a Attempt, result StepExecution) error

func (*SQLiteStore) ConsumeInput

func (s *SQLiteStore) ConsumeInput(ctx context.Context, id string) (ExternalInputGate, error)

func (*SQLiteStore) ConversationAttempt

func (s *SQLiteStore) ConversationAttempt(ctx context.Context, run, job, step string, iteration int, logical string) (Attempt, bool, error)

ConversationAttempt reads a turn receipt without admitting work. Ordered item retries share logical receipts, including after the conversation deadline.

func (*SQLiteStore) Delete

func (s *SQLiteStore) Delete(ctx context.Context, id string) error

func (*SQLiteStore) DeleteOrigin

func (s *SQLiteStore) DeleteOrigin(ctx context.Context, id string) error

func (*SQLiteStore) EnsureInputGate

func (s *SQLiteStore) EnsureInputGate(ctx context.Context, g ExternalInputGate) (ExternalInputGate, error)

func (*SQLiteStore) Events

func (s *SQLiteStore) Events(ctx context.Context, id string, after int64) ([]Event, error)

func (*SQLiteStore) ExecutionRetry

func (s *SQLiteStore) ExecutionRetry(ctx context.Context, id string, generation int64) (bool, error)

func (*SQLiteStore) FinishRetention

func (s *SQLiteStore) FinishRetention(ctx context.Context, record Retention, owner *ownership.Lock) error

func (*SQLiteStore) HelperBundlePath

func (s *SQLiteStore) HelperBundlePath(bundle *HelperBundle) (string, error)

func (*SQLiteStore) InitIntents

func (s *SQLiteStore) InitIntents(ctx context.Context) error

func (*SQLiteStore) InputControl

func (s *SQLiteStore) InputControl(ctx context.Context, origin string) (c ExternalInputControl, err error)

func (*SQLiteStore) Inputs

func (s *SQLiteStore) Inputs(ctx context.Context, run string) ([]ExternalInputGate, error)

func (*SQLiteStore) InspectTaskState

func (s *SQLiteStore) InspectTaskState(ctx context.Context, run string) (TaskStateInspection, error)

InspectTaskState observes the full group ledger without an execution lease or writes. It remains available after interruption and includes provenance.

func (*SQLiteStore) Intent

func (s *SQLiteStore) Intent(ctx context.Context, key string) (ExternalIntent, error)

func (*SQLiteStore) InterruptInput

func (s *SQLiteStore) InterruptInput(ctx context.Context, origin string, generation int64) error

InterruptInput preserves all gates/answers and fences automatic continuation. The controller stops and joins any active execution after this commit.

func (*SQLiteStore) InvocationDirectories

func (s *SQLiteStore) InvocationDirectories(ctx context.Context, origin string) ([]string, error)

func (*SQLiteStore) Invocations

func (s *SQLiteStore) Invocations(ctx context.Context, run string, pending bool) ([]runtimeexec.Record, error)

func (*SQLiteStore) IterationAttempts

func (s *SQLiteStore) IterationAttempts(ctx context.Context, run, job string) ([]IterationItemResult, error)

func (*SQLiteStore) IterationPlan

func (s *SQLiteStore) IterationPlan(ctx context.Context, run, job string) (p IterationPlan, err error)

func (*SQLiteStore) IterationRun

func (s *SQLiteStore) IterationRun(ctx context.Context, run, logical, job string) (string, error)

IterationRun finds the first physical controller for a stable logical call. Nested item retries share its immutable plan and completed item observations.

func (*SQLiteStore) List

func (s *SQLiteStore) List(ctx context.Context) ([]Run, error)

func (*SQLiteStore) ListPage

func (s *SQLiteStore) ListPage(ctx context.Context, limit int, cursor string) (Page[RunSummary], error)

func (*SQLiteStore) Load

func (s *SQLiteStore) Load(ctx context.Context, id string) (*Run, Snapshot, error)

func (*SQLiteStore) Metrics

func (s *SQLiteStore) Metrics(ctx context.Context) (StoreMetrics, error)

func (*SQLiteStore) Migrate

func (s *SQLiteStore) Migrate(ctx context.Context, owner *ownership.Lock) error

Migrate must be called while holding exclusive workspace ownership. Existing snapshots and attempt history are never rewritten. The consistent pre-upgrade backup is deliberately retained for operator verification and rollback.

func (*SQLiteStore) ObserveUsage

func (s *SQLiteStore) ObserveUsage(ctx context.Context, identity UsageIdentity, update UsageUpdate) error

func (*SQLiteStore) OriginRuns

func (s *SQLiteStore) OriginRuns(ctx context.Context, id string) ([]Run, error)

OriginRuns returns the complete reusable closure's records for one owner.

func (*SQLiteStore) PinIteration

func (s *SQLiteStore) PinIteration(ctx context.Context, p IterationPlan) error

func (*SQLiteStore) ProbeStorage

func (s *SQLiteStore) ProbeStorage(ctx context.Context) error

func (*SQLiteStore) PutIntent

func (s *SQLiteStore) PutIntent(ctx context.Context, intent ExternalIntent) error

func (*SQLiteStore) QueueDepth

func (s *SQLiteStore) QueueDepth(ctx context.Context) (int, error)

func (*SQLiteStore) QueueInputContinuations

func (s *SQLiteStore) QueueInputContinuations(ctx context.Context, maxQueued int) error

QueueInputContinuations admits durable continuation intents when no controller owns an execution. Controllers use QueueInputContinuationsExcept during cleanup.

func (*SQLiteStore) QueueInputContinuationsExcept

func (s *SQLiteStore) QueueInputContinuationsExcept(ctx context.Context, maxQueued int, active ...string) error

QueueInputContinuationsExcept excludes active controller owners until cleanup finishes, even after the executor has published waiting and released its lease.

func (*SQLiteStore) QueueResume

func (s *SQLiteStore) QueueResume(ctx context.Context, id, requestID string, retry bool, maxQueued int) (*Run, error)

QueueResume atomically admits a new execution without modifying the snapshot or any attempt. Duplicate request identities refer to the original generation.

func (*SQLiteStore) Queued

func (s *SQLiteStore) Queued(ctx context.Context) ([]Run, error)

Queued returns at most 100 candidates without decoding terminal history.

func (*SQLiteStore) ReconcileInvocations

func (s *SQLiteStore) ReconcileInvocations(ctx context.Context, run string) error

ReconcileInvocations is called with exclusive workspace ownership. It never kills by a persisted host PID or treats runtime failure as confirmed absence.

func (*SQLiteStore) RecordAttempt

func (s *SQLiteStore) RecordAttempt(ctx context.Context, a Attempt) error

func (*SQLiteStore) Recover

func (s *SQLiteStore) Recover(ctx context.Context) error

Recover is called only while holding exclusive workspace ownership. It never replays effects or claims a process is dead based on a reused PID.

func (*SQLiteStore) RecoverToolCalls

func (s *SQLiteStore) RecoverToolCalls(ctx context.Context) error

func (*SQLiteStore) RecoveryBundle

func (s *SQLiteStore) RecoveryBundle(ctx context.Context, destination string, owner *ownership.Lock) error

RecoveryBundle exports only engine-owned state. Provider-owned authentication stores stay outside the bundle, including engine state links to native auth.

func (*SQLiteStore) RequestCancel

func (s *SQLiteStore) RequestCancel(ctx context.Context, id string) error

func (*SQLiteStore) RequestCancelGeneration

func (s *SQLiteStore) RequestCancelGeneration(ctx context.Context, id string, generation int64) error

RequestCancelGeneration fences delayed requests against a later resume. Zero selects the current generation for compatibility callers.

func (*SQLiteStore) RequireCurrentSchema

func (s *SQLiteStore) RequireCurrentSchema() error

func (*SQLiteStore) ResumeRequest

func (s *SQLiteStore) ResumeRequest(ctx context.Context, id, requestID string, retry bool) (*Run, error)

func (*SQLiteStore) Retention

func (s *SQLiteStore) Retention(ctx context.Context, id string) (Retention, error)

func (*SQLiteStore) Save

func (s *SQLiteStore) Save(ctx context.Context, r *Run) error

func (*SQLiteStore) SaveRetention

func (s *SQLiteStore) SaveRetention(ctx context.Context, record Retention, owner *ownership.Lock) error

func (*SQLiteStore) TaskState

TaskState commits logical task state before acknowledgement. A replayed claim never grants dispatch again; an unacknowledged claim needs reconciliation.

func (*SQLiteStore) ToolCalls

func (s *SQLiteStore) ToolCalls(ctx context.Context, run string, unresolved bool) ([]ToolCallRecord, error)

ToolCalls exposes unresolved effects without replaying them. Inspection is bounded and callers can retrieve later pages with the ordinary call identity.

func (*SQLiteStore) UpdateInvocation

func (s *SQLiteStore) UpdateInvocation(ctx context.Context, record runtimeexec.Record) error

func (*SQLiteStore) Usage

func (s *SQLiteStore) Usage(ctx context.Context, run string) (UsageReport, error)

func (*SQLiteStore) VerifyHelperBundle

func (s *SQLiteStore) VerifyHelperBundle(bundle *HelperBundle) error

type ScheduleTrigger

type ScheduleTrigger struct {
	Cron string `json:"cron,omitempty" yaml:"cron,omitempty"`
}

type Secret

type Secret struct {
	Required bool `json:"required,omitempty" yaml:"required,omitempty"`
}

type SessionRequest

type SessionRequest struct {
	AgentRequest
	SessionID string
}

type SessionResult

type SessionResult struct {
	ProviderStatus  string         `json:"provider_status,omitempty"`
	ProviderVersion string         `json:"provider_version,omitempty"`
	SessionID       string         `json:"session_id"`
	Status          string         `json:"status"`
	Outputs         map[string]any `json:"outputs,omitempty"`
}

type SessionRunner

type SessionRunner interface {
	Capabilities(string) (ProviderCapabilities, error)
	RunTurn(context.Context, SessionRequest, func(ProviderEvent)) (SessionResult, error)
}

type Snapshot

type Snapshot struct {
	CredentialAliases map[string]string         `json:"credential_aliases,omitempty"`
	ActionContracts   map[string]ActionContract `json:"application_actions,omitempty"`
	Execution         runtimeexec.Policy        `json:"execution,omitempty"`
	Metadata          map[string]any            `json:"metadata,omitempty"`
	Version           int                       `json:"version"`
	Definitions       map[string]*Workflow      `json:"definitions"`
	Hashes            map[string]string         `json:"hashes"`
	Inputs            map[string]any            `json:"inputs,omitempty"`
	Event             map[string]any            `json:"event,omitempty"`
	SecretRefs        map[string]string         `json:"secret_refs,omitempty"`
	RequestID         string                    `json:"request_id,omitempty"`
	RequiredSecrets   []string                  `json:"required_secrets,omitempty"`
	Roles             json.RawMessage           `json:"roles,omitempty"`
	Parallel          int                       `json:"parallel"`
}

Snapshot is the admitted definition closure and nonsecret execution context. Credentials are resolved again on resume; values never belong here.

type Step

type Step struct {
	Files                   []string                 `json:"files,omitempty" yaml:"files,omitempty"`
	Protocol                string                   `json:"protocol,omitempty" yaml:"protocol,omitempty"`
	Effect                  ActionEffect             `json:"effect,omitempty" yaml:"effect,omitempty"`
	InputSchema             any                      `json:"input-schema,omitempty" yaml:"input-schema,omitempty"`
	OutputSchema            any                      `json:"output-schema,omitempty" yaml:"output-schema,omitempty"`
	Input                   map[string]any           `json:"input,omitempty" yaml:"input,omitempty"`
	Env                     map[string]string        `json:"env,omitempty" yaml:"env,omitempty"`
	ContainerImplementation *ContainerImplementation `json:"container_implementation,omitempty" yaml:"-"`
	Definition              *AgentDefinition         `json:"agent_definition,omitempty" yaml:"-"`
	OnResult                []Step                   `json:"onResult,omitempty" yaml:"onResult,omitempty"`
	OnComplete              []Step                   `json:"onComplete,omitempty" yaml:"onComplete,omitempty"`
	OnIncomplete            []Step                   `json:"onIncomplete,omitempty" yaml:"onIncomplete,omitempty"`
	Conversation            []string                 `json:"conversation,omitempty" yaml:"conversation,omitempty"`
	Start                   string                   `json:"start,omitempty" yaml:"start,omitempty"`
	FinishBy                string                   `json:"finishBy,omitempty" yaml:"finishBy,omitempty"`
	MaxTurns                int                      `json:"maxTurns,omitempty" yaml:"maxTurns,omitempty"`
	MaxMessages             int                      `json:"maxMessages,omitempty" yaml:"maxMessages,omitempty"`
	OnError                 []Step                   `json:"onError,omitempty" yaml:"onError,omitempty"`
	OnFailure               []Step                   `json:"onFailure,omitempty" yaml:"onFailure,omitempty"`
	Finally                 []Step                   `json:"finally,omitempty" yaml:"finally,omitempty"`
	HandlerTimeout          string                   `json:"handlerTimeout,omitempty" yaml:"handlerTimeout,omitempty"`
	Parallel                []Step                   `json:"parallel,omitempty" yaml:"parallel,omitempty"`
	Sequence                []Step                   `json:"sequence,omitempty" yaml:"sequence,omitempty"`
	Prompt                  *string                  `json:"prompt,omitempty" yaml:"prompt,omitempty"`
	Argv                    []string                 `json:"argv,omitempty" yaml:"argv,omitempty"`
	Run                     string                   `json:"run,omitempty" yaml:"run,omitempty"`
	Shell                   string                   `json:"shell,omitempty" yaml:"shell,omitempty"`
	WorkingDirectory        string                   `json:"working-directory,omitempty" yaml:"working-directory,omitempty"`
	Timeout                 string                   `json:"timeout,omitempty" yaml:"timeout,omitempty"`
	ID                      string                   `json:"id,omitempty"                yaml:"id,omitempty"`
	Name                    string                   `json:"name,omitempty"              yaml:"name,omitempty"`
	Uses                    string                   `json:"uses,omitempty"              yaml:"uses,omitempty"`
	If                      string                   `json:"if,omitempty"                yaml:"if,omitempty"`
	ContinueOnError         bool                     `json:"continue_on_error,omitempty" yaml:"continue-on-error,omitempty"`
	With                    map[string]any           `json:"with,omitempty"              yaml:"with,omitempty"`
	Context                 RunContext               `json:"context,omitempty"           yaml:"context,omitempty"`
}

func FlattenSteps

func FlattenSteps(steps []Step) []Step

FlattenSteps returns all structural and executable steps in declaration preorder, assigning stable job-scoped IDs to anonymous steps. Child IDs use their physical index path, independent of explicit ancestor IDs.

type StepExecution

type StepExecution struct {
	Lifecycle          *StepLifecycle `json:"lifecycle,omitempty"`
	FailureClass       string         `json:"failure_class,omitempty"`
	UnsafeFailureClass string         `json:"unsafe_failure_class,omitempty"`
	AttemptID          string         `json:"attempt_id,omitempty"`
	StartedAt          time.Time      `json:"started_at,omitempty"`
	FinishedAt         time.Time      `json:"finished_at,omitempty"`
	ID                 string         `json:"id"`
	Status             string         `json:"status"`
	Outputs            map[string]any `json:"outputs,omitempty"`
	Error              string         `json:"error,omitempty"`
}

type StepLifecycle

type StepLifecycle struct {
	Verifications []any                      `json:"verifications,omitempty"`
	Candidate     map[string]any             `json:"candidate,omitempty"`
	Verification  any                        `json:"verification,omitempty"`
	Agent         string                     `json:"agent,omitempty"`
	OriginalError string                     `json:"original_error,omitempty"`
	OriginalClass string                     `json:"original_class,omitempty"`
	Deadline      time.Time                  `json:"deadline"`
	Handlers      map[string][]StepExecution `json:"handlers,omitempty"`
	Skipped       map[string]string          `json:"skipped,omitempty"`
}

type StoreMetrics

type StoreMetrics struct {
	QueueDepth      int            `json:"queue_depth"`
	QueueAgeSeconds float64        `json:"queue_age_seconds"`
	Runs            map[string]int `json:"runs"`
	Workers         map[string]int `json:"workers"`
	Failures        int            `json:"failures"`
	CleanupBacklog  int            `json:"cleanup_backlog"`
}

type StringList

type StringList []string

func (*StringList) UnmarshalYAML

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

type StructuredOutputResult

type StructuredOutputResult struct {
	Structured any    `json:"structured,omitempty"`
	RawJSON    string `json:"raw_json,omitempty"`
	Valid      bool   `json:"valid"`
	Error      string `json:"error,omitempty"`
}

func ValidateAgentStructuredOutput

func ValidateAgentStructuredOutput(text string, contract *AgentOutputContract) StructuredOutputResult

type TaskBudget

type TaskBudget struct {
	Name  string `json:"name"`
	Limit int64  `json:"limit"`
	Used  int64  `json:"used"`
}

type TaskClaim

type TaskClaim struct {
	Task                string          `json:"task"`
	Fingerprint         string          `json:"fingerprint"`
	OperationID         string          `json:"operation_id"`
	State               string          `json:"state"`
	ResultReference     string          `json:"result_reference,omitempty"`
	EvidenceFingerprint string          `json:"evidence_fingerprint,omitempty"`
	OwnerRun            string          `json:"owner_run"`
	OwnerGeneration     int64           `json:"owner_generation"`
	Owner               string          `json:"-"`
	Proof               json.RawMessage `json:"proof,omitempty"`
}

type TaskDeadline

type TaskDeadline struct {
	Name             string    `json:"name"`
	OriginalDeadline time.Time `json:"original_deadline"`
	Deadline         time.Time `json:"deadline"`
	Extensions       int64     `json:"extensions"`
}

type TaskStateInspection

type TaskStateInspection struct {
	Group     string             `json:"group"`
	Closed    bool               `json:"closed"`
	Claims    []TaskClaim        `json:"claims"`
	Budgets   []TaskBudget       `json:"budgets"`
	Deadlines []TaskDeadline     `json:"deadlines"`
	Requests  []TaskStateRequest `json:"requests"`
}

type TaskStateRequest

type TaskStateRequest struct {
	Operation           string          `json:"operation"`
	Name                string          `json:"name,omitempty"`
	Task                string          `json:"task,omitempty"`
	Fingerprint         string          `json:"fingerprint,omitempty"`
	OperationID         string          `json:"operation_id,omitempty"`
	RequestID           string          `json:"request_id,omitempty"`
	EvidenceFingerprint string          `json:"evidence_fingerprint,omitempty"`
	ResultReference     string          `json:"result_reference,omitempty"`
	Outcome             string          `json:"outcome,omitempty"`
	Proof               json.RawMessage `json:"proof,omitempty"`
	Limit               int64           `json:"limit,omitempty"`
	Amount              int64           `json:"amount,omitempty"`
	Deadline            time.Time       `json:"deadline,omitempty"`
	Instruction         string          `json:"instruction,omitempty"`
	Source              string          `json:"source,omitempty"`
}

TaskStateRequest addresses one logical operation in the admitted task group. Proofs and evidence identities are application assertions: the controller does not infer whether a domain-specific mutation happened or evidence is current.

type TaskStateResponse

type TaskStateResponse struct {
	Claim    *TaskClaim    `json:"claim,omitempty"`
	Budget   *TaskBudget   `json:"budget,omitempty"`
	Deadline *TaskDeadline `json:"deadline,omitempty"`
	Dispatch bool          `json:"dispatch"`
	Reusable bool          `json:"reusable"`
	Closed   bool          `json:"closed,omitempty"`
}

type ToolBinder

type ToolBinder func(context.Context, ToolInvocation) (ToolBinding, error)

type ToolBinding

type ToolBinding interface {
	Catalog() []ToolDefinition
	Call(context.Context, ToolRequest) (json.RawMessage, error)
}

type ToolCallRecord

type ToolCallRecord struct {
	RunID               string          `json:"run_id"`
	Generation          int64           `json:"execution_generation"`
	InvocationID        string          `json:"invocation_id"`
	CallID              string          `json:"call_id"`
	Server              string          `json:"server"`
	Tool                string          `json:"tool"`
	ArgumentFingerprint string          `json:"argument_fingerprint"`
	AuditArguments      any             `json:"arguments"`
	Status              string          `json:"status"`
	Result              json.RawMessage `json:"result,omitempty"`
	FailureClass        string          `json:"failure_class,omitempty"`
	Error               string          `json:"error,omitempty"`
	AdmittedAt          time.Time       `json:"admitted_at"`
	FinishedAt          time.Time       `json:"finished_at,omitempty"`
}

type ToolDefinition

type ToolDefinition struct {
	Server      string          `json:"server" yaml:"server"`
	Name        string          `json:"name" yaml:"name"`
	Description string          `json:"description" yaml:"description"`
	InputSchema json.RawMessage `json:"input_schema" yaml:"-"`
	Fingerprint string          `json:"fingerprint" yaml:"-"`
	// ControllerValidation defers validation of adapter-exposed objects to the controller.
	ControllerValidation bool `json:"controller_validation,omitempty" yaml:"-"`
}

ToolDefinition is pinned in the admitted role snapshot. WireName is stable and provider-safe; server/tool names never come from provider-selected owners.

func EngineTools

func EngineTools() []ToolDefinition

type ToolGrant

type ToolGrant struct {
	Server string `json:"server" yaml:"server"`
	Tool   string `json:"tool" yaml:"tool"`
}

type ToolInvocation

type ToolInvocation struct {
	Owner          string
	Dispatch       ExternalToolDispatcher
	RunID          string
	Generation     int64
	InvocationID   string
	ParentWorkerID string
	Role           string
	Workspace      string
	NativeTools    []string
	Access         WorkerAccess
	Limits         WorkerLimits
	Grants         []ToolGrant
	Catalog        []ToolDefinition
	Secrets        map[string]string
}

type ToolRequest

type ToolRequest struct {
	CallID    string          `json:"call_id"`
	Server    string          `json:"server"`
	Tool      string          `json:"tool"`
	Arguments json.RawMessage `json:"arguments"`
}

type UsageGroup

type UsageGroup struct {
	Provider string       `json:"provider"`
	Model    string       `json:"model"`
	Summary  UsageSummary `json:"summary"`
}

type UsageIdentity

type UsageIdentity struct {
	ID            string `json:"invocation_id"`
	RunID         string `json:"origin_run_id"`
	TaskAttemptID string `json:"task_attempt_id,omitempty"`
	WorkerID      string `json:"worker_id,omitempty"`
	Kind          string `json:"kind"`
	Provider      string `json:"provider"`
	Model         string `json:"model"`
	SessionID     string `json:"session_id,omitempty"`
	Finished      bool   `json:"finished"`
}

type UsageObservation

type UsageObservation struct {
	DeltaInputTokens       *int64    `json:"delta_input_tokens,omitempty"`
	DeltaCachedInputTokens *int64    `json:"delta_cached_input_tokens,omitempty"`
	DeltaOutputTokens      *int64    `json:"delta_output_tokens,omitempty"`
	CounterReset           bool      `json:"counter_reset,omitempty"`
	InputTokens            *int64    `json:"input_tokens"`
	CachedInputTokens      *int64    `json:"cached_input_tokens"`
	OutputTokens           *int64    `json:"output_tokens"`
	CostUSD                *float64  `json:"cost_usd"`
	Scope                  string    `json:"counter_scope"`
	Final                  bool      `json:"final"`
	Complete               bool      `json:"complete"`
	ObservedAt             time.Time `json:"observed_at"`
}

func NormalizeUsage

func NormalizeUsage(update UsageUpdate) UsageObservation

type UsageReport

type UsageReport struct {
	Summary         UsageSummary      `json:"summary"`
	ByProviderModel []UsageGroup      `json:"by_provider_model"`
	Invocations     []InvocationUsage `json:"invocations"`
}

type UsageSummary

type UsageSummary struct {
	Overflow              bool     `json:"overflow,omitempty"`
	InputTokens           *int64   `json:"input_tokens"`
	CachedInputTokens     *int64   `json:"cached_input_tokens"`
	OutputTokens          *int64   `json:"output_tokens"`
	CostUSD               *float64 `json:"cost_usd"`
	KnownCostUSD          *float64 `json:"known_cost_usd"`
	CostComplete          bool     `json:"cost_complete"`
	Complete              bool     `json:"complete"`
	Invocations           int      `json:"invocations"`
	IncompleteInvocations int      `json:"incomplete_invocations"`
}

func SummarizeUsage

func SummarizeUsage(invocations []InvocationUsage) UsageSummary

type UsageUpdate

type UsageUpdate struct {
	Key                        string
	Provider, Model, SessionID string
	Usage                      map[string]any
	CostUSD                    any
	Final                      bool
	Incomplete                 bool
}

type Worker

type Worker struct {
	TaskWorkspace          string                        `json:"task_workspace,omitempty"`
	Definition             *AgentDefinition              `json:"agent_definition,omitempty"`
	SessionOwnerID         string                        `json:"session_owner_id,omitempty"`
	FailureAcknowledgement *WorkerFailureAcknowledgement `json:"failure_acknowledgement,omitempty"`
	MaxWorkers             int                           `json:"max_workers"`
	CreatorInvocation      string                        `json:"creator_invocation,omitempty"`
	ToolGrants             []ToolGrant                   `json:"mcp_grants"`
	FailureGeneration      int64                         `json:"failure_generation,omitempty"`
	FailureClass           string                        `json:"failure_class,omitempty"`
	Access                 WorkerAccess                  `json:"access"`
	MaxQueued              int                           `json:"max_queued"`
	MaxDepth               int                           `json:"max_depth"`
	TurnDuration           time.Duration                 `json:"turn_duration"`
	MaxOutput              int                           `json:"max_output"`
	ID                     string                        `json:"id"`
	RunID                  string                        `json:"run_id"`
	ParentID               string                        `json:"parent_id,omitempty"`
	Role                   string                        `json:"role"`
	Status                 string                        `json:"status"`
	SessionID              string                        `json:"session_id,omitempty"`
	Tools                  []string                      `json:"tools"`
	Remaining              int                           `json:"remaining_turns"`
	TaskTurns              int                           `json:"task_turns,omitempty"`
	Depth                  int                           `json:"depth"`
	Error                  string                        `json:"error,omitempty"`
}

type WorkerAccess

type WorkerAccess struct {
	Cleanup   string `json:"cleanup_guarantee,omitempty"`
	Container bool   `json:"container"`
	Writable  bool   `json:"writable"`
	Workspace string `json:"workspace,omitempty"`
}

type WorkerFactory

type WorkerFactory func(context.Context, string, string, []string) (SessionRunner, []string, map[string]string, error)

WorkerFactory resolves the admitted role snapshot and credentials, then applies the requested tool subset. It must reject policies the backend cannot enforce.

type WorkerFailureAcknowledgement

type WorkerFailureAcknowledgement struct {
	RequestID      string    `json:"request_id"`
	MessageID      string    `json:"message_id"`
	Generation     int64     `json:"execution_generation"`
	Reason         string    `json:"reason"`
	Evidence       string    `json:"evidence"`
	AcknowledgedAt time.Time `json:"acknowledged_at"`
}

WorkerFailureAcknowledgement records a controller's disposition without changing the failed message, original output, or failure classification. It neither grants successful coverage nor reopens the worker for dispatch.

type WorkerFailureRequest

type WorkerFailureRequest struct {
	RunID, WorkerID, MessageID, Owner, RequestID, Reason, Evidence string
	Generation                                                     int64
}

type WorkerLimits

type WorkerLimits struct {
	MaxWorkers   int
	MaxDepth     int
	MaxQueued    int
	MaxTurns     int
	TurnDuration time.Duration
	MaxOutput    int
}

func DefaultWorkerLimits

func DefaultWorkerLimits() WorkerLimits

type WorkerManager

type WorkerManager struct {
	AdmissionReady func(context.Context) error
	Store          *SQLiteStore
	Factory        WorkerFactory
	Slots          chan struct{}
	Capacity       *Capacity
	BindTools      ToolBinder
	Limits         WorkerLimits
	// contains filtered or unexported fields
}

func (*WorkerManager) AcknowledgeFailure

AcknowledgeFailure is controller-only; it is deliberately absent from native worker tools. Only settled, ordinary failures can be handled. Uncertain cleanup, storage, integrity, cancellation, and authorization failures retain the existing finalization barrier.

func (*WorkerManager) CancelRun

func (m *WorkerManager) CancelRun(ctx context.Context, run string) error

func (*WorkerManager) Get

func (m *WorkerManager) Get(ctx context.Context, run, id string) (Worker, error)

func (*WorkerManager) Init

func (m *WorkerManager) Init(ctx context.Context) error

func (*WorkerManager) Interrupt

func (m *WorkerManager) Interrupt(ctx context.Context, run, id string, closeWorker bool) error

func (*WorkerManager) List

func (m *WorkerManager) List(ctx context.Context, run string) ([]Worker, error)

func (*WorkerManager) ListPage

func (m *WorkerManager) ListPage(ctx context.Context, run string, limit int, cursor string) (Page[WorkerSummary], error)

func (*WorkerManager) Messages

func (m *WorkerManager) Messages(ctx context.Context, run, id string) ([]WorkerMessage, error)

func (*WorkerManager) MessagesPage

func (m *WorkerManager) MessagesPage(ctx context.Context, run, worker string, limit int, cursor string) (Page[MessageSummary], error)

func (*WorkerManager) Resume

func (m *WorkerManager) Resume(ctx context.Context, run, id string) error

func (*WorkerManager) Send

func (m *WorkerManager) Send(ctx context.Context, run, id, requestID, prompt string) (WorkerMessage, error)

func (*WorkerManager) Serve

func (m *WorkerManager) Serve(ctx context.Context)

func (*WorkerManager) Spawn

func (m *WorkerManager) Spawn(ctx context.Context, spec WorkerSpec) (Worker, error)

func (*WorkerManager) StopRun

func (m *WorkerManager) StopRun(ctx context.Context, run string) error

StopRun closes admission first, then joins every active turn. A terminal run is not published until these provider invocations have stopped.

func (*WorkerManager) WaitMessage

func (m *WorkerManager) WaitMessage(ctx context.Context, req WorkerWaitRequest) (WorkerMessage, error)

WaitMessage holds no CapacityLease, container, or provider process. Pending waits occupy the caller goroutine; pipeline integration must retain its bounded workflow controller reservation. Subscribe before observing durable state so completion before or during subscription cannot be lost. Serve's shared sweep repairs missed wakeups.

type WorkerMessage

type WorkerMessage struct {
	TaskAttemptID          string                        `json:"task_attempt_id,omitempty"`
	Input                  any                           `json:"input,omitempty"`
	Output                 *AgentOutputContract          `json:"output,omitempty"`
	Model                  string                        `json:"model,omitempty"`
	RepairOnly             bool                          `json:"repair_only,omitempty"`
	FailureAcknowledgement *WorkerFailureAcknowledgement `json:"failure_acknowledgement,omitempty"`
	Generation             int64                         `json:"execution_generation,omitempty"`
	FailureClass           string                        `json:"failure_class,omitempty"`
	QueueTimeMS            int64                         `json:"queue_time_ms,omitempty"`
	UnsafeFailureClass     string                        `json:"unsafe_failure_class,omitempty"`
	ID                     string                        `json:"id"`
	WorkerID               string                        `json:"worker_id"`
	RequestID              string                        `json:"request_id"`
	Sequence               int                           `json:"sequence"`
	Status                 string                        `json:"status"`
	Prompt                 string                        `json:"prompt"`
	Result                 SessionResult                 `json:"result,omitempty"`
	Error                  string                        `json:"error,omitempty"`
	EnqueuedAt             time.Time                     `json:"enqueued_at"`
	StartedAt              time.Time                     `json:"started_at,omitempty"`
	FinishedAt             time.Time                     `json:"finished_at,omitempty"`
}

type WorkerSpec

type WorkerSpec struct {
	TaskWorkspace     string           `json:"-"`
	Definition        *AgentDefinition `json:"-"`
	Owner             string           `json:"-"`
	CreatorInvocation string           `json:"-"`
	Boundary          *ToolInvocation  `json:"-"`
	ToolGrants        []ToolGrant      `json:"mcp_grants,omitempty"`
	// StableID is controller-only and never accepted from a provider wire frame.
	StableID string   `json:"-"`
	RunID    string   `json:"run_id"`
	ParentID string   `json:"parent_id,omitempty"`
	Role     string   `json:"role"`
	Tools    []string `json:"tools,omitempty"`
	Turns    int      `json:"turns,omitempty"`
}

type WorkerSummary

type WorkerSummary struct {
	ID       string `json:"id"`
	RunID    string `json:"run_id"`
	ParentID string `json:"parent_id,omitempty"`
	Role     string `json:"role"`
	Status   string `json:"status"`
}

type WorkerWaitRequest

type WorkerWaitRequest struct {
	RunID, OperationID, WorkerID, MessageID string
	Deadline                                time.Time
}

WorkerWaitRequest is controller-internal. OperationID is a logical pipeline coordinate, never an attempt ID. Reattachment cannot extend Deadline.

type Workflow

type Workflow struct {
	Schemas map[string]map[string]any `json:"schemas,omitempty" yaml:"schemas,omitempty"`
	Name    string                    `json:"name,omitempty"  yaml:"name,omitempty"`
	On      WorkflowTriggers          `json:"on,omitempty"    yaml:"on,omitempty"`
	Gates   map[string]any            `json:"gates,omitempty" yaml:"gates,omitempty"`
	Jobs    map[string]Job            `json:"jobs"            yaml:"jobs"`
}

func Parse

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

Parse retains PicoClaw's schema while rejecting unknown fields, aliases, duplicate keys, and multiple documents instead of silently ignoring them.

func (*Workflow) UnmarshalYAML

func (w *Workflow) UnmarshalYAML(value *yaml.Node) error

type WorkflowCall

type WorkflowCall struct {
	Inputs  map[string]Input  `json:"inputs,omitempty"  yaml:"inputs,omitempty"`
	Secrets map[string]Secret `json:"secrets,omitempty" yaml:"secrets,omitempty"`
	Outputs map[string]Output `json:"outputs,omitempty" yaml:"outputs,omitempty"`
}

type WorkflowTriggers

type WorkflowTriggers struct {
	Manual         map[string]any         `json:"manual,omitempty"          yaml:"manual,omitempty"`
	Schedule       []ScheduleTrigger      `json:"schedule,omitempty"        yaml:"schedule,omitempty"`
	ChannelMessage *ChannelMessageTrigger `json:"channel_message,omitempty" yaml:"channel_message,omitempty"`
	Command        *CommandTrigger        `json:"command,omitempty"         yaml:"command,omitempty"`
	RuntimeEvent   *RuntimeEventTrigger   `json:"runtime_event,omitempty"   yaml:"runtime_event,omitempty"`
	Event          *EventTrigger          `json:"event,omitempty"           yaml:"event,omitempty"`
	WorkflowCall   *WorkflowCall          `json:"workflow_call,omitempty"   yaml:"workflow_call,omitempty"`
}

func (*WorkflowTriggers) UnmarshalYAML

func (t *WorkflowTriggers) UnmarshalYAML(value *yaml.Node) error

Jump to

Keyboard shortcuts

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