gateadapter

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package gateadapter implements human_gate@v1 over the shared workflow/gate vocabulary and canonical workflow/wait continuation.

The adapter persists no application records and performs no polling. Product presentation and responder policy are supplied through injected extraction-ready seams. Payload stores must be idempotent and own cleanup if payload storage succeeds but durable suspension later fails.

Index

Constants

View Source
const (
	Name                = "human_gate"
	Version             = "v1"
	CapabilityGate      = "gate.respond"
	CapabilityWait      = "wait.resume"
	CodeInvalidGate     = "human_gate_invalid"
	CodeAuthorityFailed = "human_gate_authority_failed"
	CodePayloadFailed   = "human_gate_payload_failed"
	CodeContinuation    = "human_gate_continuation_invalid"
)

Variables

This section is empty.

Functions

func RegisterExecutor

func RegisterExecutor(registry stepkind.Registry, executor stepkind.StepKind) error

RegisterExecutor applies the shared typed-nil-safe registry admission used by thin profiled wrappers.

Types

type DecisionSchemaMode

type DecisionSchemaMode string

DecisionSchemaMode selects whether a shared gate profile derives its resume schema from declared option IDs or requires an exact authored schema.

const (
	DecisionSchemaDerived    DecisionSchemaMode = "derived"
	DecisionSchemaConfigured DecisionSchemaMode = "configured"
)

type Executor

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

Executor implements human_gate@v1. It is concurrency-safe when injected collaborators are concurrency-safe.

func New

func New(options Options) (*Executor, error)

New constructs a fail-closed human gate executor.

func NewProfile

func NewProfile(profile Profile, options Options) (*Executor, error)

NewProfile constructs a gate executor with one immutable adapter-owned profile. The profile is copied and validated during construction.

func Register

func Register(registry stepkind.Registry, options Options) (*Executor, error)

Register constructs and registers human_gate@v1.

func RegisterProfile

func RegisterProfile(registry stepkind.Registry, profile Profile, options Options) (*Executor, error)

RegisterProfile constructs and registers one immutable shared gate profile.

func (*Executor) Execute

Execute stores private presentation payload, resolves app-owned authority, and suspends initially. An accepted continuation returns typed decision and resume metadata without exposing the resume credential.

func (*Executor) Spec

func (e *Executor) Spec() stepkind.StepKindSpec

Spec returns immutable human_gate@v1 metadata. timed_out is const false on successful continuation; runtime timeout is a typed failed attempt and never fabricated as a successful adapter result.

func (*Executor) ValidateConfig

func (e *Executor) ValidateConfig(_ context.Context, input graph.Config) []diagnostic.Diagnostic

ValidateConfig reports deterministic config paths. An optional non-blocking gate is valid shared vocabulary but rejected here until W07-T09 lowers it to ordinary graph readiness semantics.

type Options

type Options struct {
	Authority workflowgate.AuthorityResolver
	Payloads  workflowgate.PayloadStore
	Now       func() time.Time
}

Options supplies application-owned gate policy, private payload storage, and a deterministic clock. Authority and Payloads are required.

type Profile

type Profile struct {
	Name                string
	Version             string
	Label               string
	RespondCapability   string
	WaitCapability      string
	InvalidCode         string
	AuthorityFailedCode string
	PayloadFailedCode   string
	ContinuationCode    string
	DecisionSchema      DecisionSchemaMode
}

Profile gives a named gate-like adapter its immutable step-kind vocabulary while keeping parsing, suspension, continuation, timeout, and redaction in one implementation. Adapter packages should publish a fixed profile rather than accepting profile data from workflow authors.

func (Profile) StepKindSpec

func (p Profile) StepKindSpec() stepkind.StepKindSpec

StepKindSpec returns the immutable static metadata described by p. Adapter constructors validate profiles before execution; callers defining a custom profile should use NewProfile rather than publishing unchecked metadata.

Jump to

Keyboard shortcuts

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