contracts

package
v0.0.0-...-4afd048 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CapabilityRuntime

type CapabilityRuntime interface {
	Execute(ctx context.Context, execution ExecutionContext) (map[string]any, error)
}

type CapabilityRuntimeCloser

type CapabilityRuntimeCloser interface {
	Close() error
}

CapabilityRuntimeCloser is implemented by runtimes that own runtime resources (for example a wasm backend) that must be released when the owning instance stops. Instances call Close on every registered runtime before shutting down.

type CapabilityRuntimeRegistry

type CapabilityRuntimeRegistry interface {
	Register(runtimeType core2.CapabilityRuntimeType, runtime CapabilityRuntime) error
	Resolve(runtimeType core2.CapabilityRuntimeType) (CapabilityRuntime, error)
}

type Compiler

type Compiler interface {
	Compile(assembly shared.Assembly) (*types.ExecutionBlueprint, error)
}

type EventBus

type EventBus interface {
	Subscribe(eventType event.Type, buffer int) (event.Subscription, error)
	Publish(ctx context.Context, event event.Event) error
	Close() error
}

type ExecutionContext

type ExecutionContext struct {
	ExecutionID   core2.ID
	CorrelationID core2.ID

	Capability core2.Capability
	Params     map[string]any

	// CapabilityConfigurations contains the fully resolved configuration for
	// this single Capability execution. It contains no {{ ... }} placeholders.
	//
	// This is user-authored input to the capability and is deliberately
	// distinct from RuntimeConfig.
	CapabilityConfigurations map[string]any

	// RuntimeConfig is the effective runtime configuration for this single
	// capability invocation: how N.O.R.E. should drive the capability through
	// its declared Capability Runtime. Defaults are already resolved, so every
	// field is populated.
	//
	// It belongs to the runtime engine, not to the capability. Implementations
	// must never merge it into Params or CapabilityConfigurations, and it is
	// never sent to the capability runtime as capability input.
	RuntimeConfig *core2.RuntimeConfig

	// Logger is bound to this capability execution. Use it for any diagnostic
	// output instead of writing to stdout.
	Logger Logger
}

type ExecutionRepository

type ExecutionRepository interface {
	Add(execution *executionmodel.Execution) error
	Get(executionID core.ID) (*executionmodel.Execution, bool)
	Save(ctx context.Context, execution *executionmodel.Execution) error
	Delete(executionID core.ID)
	List() []*executionmodel.Execution
	ListByInstance(instanceID core.ID) []*executionmodel.Execution
}

type Field

type Field struct {
	Key   string
	Value any
}

Field is a single structured key/value pair attached to a log message.

func F

func F(key string, value any) Field

type Logger

type Logger interface {
	Debug(ctx context.Context, message string, fields ...Field)
	Info(ctx context.Context, message string, fields ...Field)
	Warn(ctx context.Context, message string, fields ...Field)
	Error(ctx context.Context, message string, fields ...Field)
}

Logger is the logging seam handed to capability runtimes. Implementations usually publish CapabilityLog events onto the execution's event bus so logs flow through the same stream as lifecycle events instead of raw stdout writes. Logging is always best-effort and must never fail an execution.

Jump to

Keyboard shortcuts

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