operation

package
v0.2.46 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PathToOpRE = regexp.MustCompile(`OPS/(?P<stack>(?:\$boot)|(?:\$service(?:\/\$slot)*)).*?/?(?P<scope>\d+)\D*\/(?P<file>(?:resonator.txcl))$`)

Functions

func MetaFromContext

func MetaFromContext(ctx context.Context) string

MetaFromContext returns the meta string set by WithMeta, or "" if none was attached. Empty return is safe to gjson.Get against.

func WithMeta

func WithMeta(ctx context.Context, meta string) context.Context

WithMeta attaches the op's Meta string to ctx for downstream OpsHandler consumption. Empty meta is a no-op.

Types

type Operation

type Operation struct {
	Input     string `json:"input,omitempty"`
	Output    string `json:"output,omitempty"`
	Service   string `json:"service,omitempty"`
	Slot      string `json:"slot,omitempty"`
	Stack     string `json:"stack,omitempty"`
	Scope     int    `json:"scope,omitempty"`
	Name      string `json:"name,omitempty"` // filename-derived identity within (stack, scope); empty for legacy rules
	Txcl      string `json:"txcl,omitempty"`
	MockRes   string `json:"mockRes,omitempty"`
	MockReq   string `json:"mockReq,omitempty"`
	Resonator *resonator.Resonator
	Meta      string `json:"meta,omitempty"`
	OpID      string `json:"opId,omitempty"` // unique ID for this Operation

	// FullInput is the pre-projection envelope view, set by the
	// processor's SELECT block only when a SELECT projected Input
	// down to its assignments. In-memory only (json:"-"): stored
	// continuation records persist Input (the dispatched view), and
	// resumed ops recompute the projection through ResonatingOps, so
	// FullInput never needs to survive suspension. Read via
	// EnvelopeView() by chassis-internal consumers (mock selection,
	// EMIT/TTL resolution, mcp debug) that must see the whole
	// envelope regardless of projection.
	FullInput string `json:"-"`

	// Secrets holds materialized secret cleartext for this op
	// instance. The field is tagged `json:"-"` AND its type's
	// MarshalJSON / MarshalText / GobEncode all panic, so cleartext
	// cannot reach any envelope, trace, log, mock, or continuation
	// by construction (internal docs/todo-secret-store.md §4.1).
	//
	// Populated by the processor (PR 3) between WHEN/SET/SELECT/WITH
	// decoration and Exec; zeroed via defer on every exit path. Read
	// directly by secret-aware op handlers as op.Secrets.Get(NAME);
	// handlers never call the Resolver or Store themselves.
	Secrets secrets.SecretBag `json:"-"`
}

func New

func New() *Operation

New Create a new Operation

func PathToOperation

func PathToOperation(path string) (*Operation, error)

func (*Operation) Copy

func (op *Operation) Copy() *Operation

Copy Create a shallow copy of the Operation, forcing a new OpID.

Secrets bag is shared by reference (SecretBag's internal map is not deep-copied). Copy() is called within a single request scope to spawn a new execution instance; the copy and the original both see the same materialized cleartext, and the processor's deferred Zero() wipes both views in one call. Sharing is correct here.

func (*Operation) EnvelopeView added in v0.2.24

func (op *Operation) EnvelopeView() string

EnvelopeView returns the full pre-projection envelope when a SELECT projected op.Input, else op.Input. Chassis-internal reads of envelope control state (`_txc.mocks`, `_txc.ttl`, `_txc._debug`, EMIT value resolution) go through this so a SELECT-narrowed wire view doesn't disable them; transports dispatch op.Input directly — the projection IS the wire contract.

func (*Operation) MacroExpand

func (op *Operation) MacroExpand(input string, service string, slot string) (output string)

Jump to

Keyboard shortcuts

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