Help us shape the future of Go! Take the 2026 Go Developer Survey

machine

package
v0.4.22 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ContractVersion = "v1"
View Source
const ExecutionContractVersion = "v1"
View Source
const StreamContractVersion = "v1"

Variables

This section is empty.

Functions

func CapabilitySpecifications

func CapabilitySpecifications() []string

func MCPTools added in v0.4.15

func MCPTools() []string

Types

type ActorRef added in v0.4.22

type ActorRef struct {
	Mode      string   `json:"mode"`
	Issuer    string   `json:"issuer,omitempty"`
	Subject   string   `json:"subject,omitempty"`
	Assurance string   `json:"assurance,omitempty"`
	Methods   []string `json:"authentication_methods,omitempty"`
}

type Discovery added in v0.4.22

type Discovery struct {
	ContractVersion  string      `json:"contract_version"`
	ExecutionVersion string      `json:"execution_version"`
	Operations       []Operation `json:"operations"`
	Capabilities     []string    `json:"capabilities,omitempty"`
}

func MachineDiscovery added in v0.4.22

func MachineDiscovery() Discovery

type Error

type Error struct {
	Code        ErrorCode `json:"code"`
	Message     string    `json:"message"`
	CauseCode   string    `json:"cause,omitempty"`
	Retryable   bool      `json:"retryable,omitempty"`
	Next        string    `json:"next,omitempty"`
	Resource    string    `json:"resource,omitempty"`
	Remediation string    `json:"remediation_class,omitempty"`
	Cause       error     `json:"-"`
}

func Classify

func Classify(err error) *Error

func NewError

func NewError(code ErrorCode, message, next string, retryable bool) *Error

func Wrap

func Wrap(code ErrorCode, err error, next string, retryable bool) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type ErrorCode

type ErrorCode string
const (
	ErrorValidationFailed         ErrorCode = "validation_failed"
	ErrorNotFound                 ErrorCode = "not_found"
	ErrorPortConflict             ErrorCode = "port_conflict"
	ErrorRequiredSecretMissing    ErrorCode = "required_secret_missing"
	ErrorSourceMissing            ErrorCode = "source_missing"
	ErrorApprovalRequired         ErrorCode = "approval_required"
	ErrorWorkloadStartFailed      ErrorCode = "workload_start_failed"
	ErrorImagePullFailed          ErrorCode = "image_pull_failed"
	ErrorAuthenticationFailed     ErrorCode = "authentication_failed"
	ErrorInvalidWorkload          ErrorCode = "invalid_workload"
	ErrorCapabilityMissing        ErrorCode = "capability_missing"
	ErrorPolicyDenied             ErrorCode = "policy_denied"
	ErrorConflict                 ErrorCode = "conflict"
	ErrorOwnershipAmbiguous       ErrorCode = "ownership_ambiguous"
	ErrorProviderUnavailable      ErrorCode = "provider_unavailable"
	ErrorRuntimeUnavailable       ErrorCode = "runtime_unavailable"
	ErrorHostResourceInsufficient ErrorCode = "host_resource_insufficient"
	ErrorTimeout                  ErrorCode = "timeout"
	ErrorVerificationFailed       ErrorCode = "verification_failed"
	ErrorUnsupported              ErrorCode = "unsupported_operation"
	ErrorInternal                 ErrorCode = "internal_error"
)

type ErrorResult

type ErrorResult struct {
	ContractVersion string `json:"contract_version"`
	Error           *Error `json:"error"`
}

func ResultError

func ResultError(err error) ErrorResult

type EventKind added in v0.4.22

type EventKind string
const (
	EventOperationStarted   EventKind = "operation.started"
	EventOperationProgress  EventKind = "operation.progress"
	EventOperationSucceeded EventKind = "operation.succeeded"
	EventOperationFailed    EventKind = "operation.failed"
	EventOperationCancelled EventKind = "operation.cancelled"
	EventApplicationState   EventKind = "application.state"
	EventProviderState      EventKind = "provider.state"
	EventTargetState        EventKind = "target.state"
	EventRuntimeResource    EventKind = "runtime.resource"
)

type Execution added in v0.4.22

type Execution struct {
	ContractVersion string             `json:"contract_version"`
	ExecutionID     string             `json:"execution_id"`
	OperationID     string             `json:"operation_id"`
	Actor           ActorRef           `json:"actor"`
	Context         OperationContext   `json:"context"`
	State           ExecutionState     `json:"state"`
	StartedAt       *time.Time         `json:"started_at,omitempty"`
	FinishedAt      *time.Time         `json:"finished_at,omitempty"`
	Progress        *OperationProgress `json:"progress,omitempty"`
	Result          json.RawMessage    `json:"result,omitempty"`
	Error           *Error             `json:"error,omitempty"`
}

func (Execution) Validate added in v0.4.22

func (e Execution) Validate() error

type ExecutionState added in v0.4.22

type ExecutionState string
const (
	ExecutionPending   ExecutionState = "pending"
	ExecutionRunning   ExecutionState = "running"
	ExecutionSucceeded ExecutionState = "succeeded"
	ExecutionFailed    ExecutionState = "failed"
	ExecutionCancelled ExecutionState = "cancelled"
)

type MachineEvent added in v0.4.22

type MachineEvent struct {
	ContractVersion string             `json:"contract_version"`
	Sequence        uint64             `json:"sequence"`
	OccurredAt      time.Time          `json:"occurred_at"`
	Kind            EventKind          `json:"kind"`
	ExecutionID     string             `json:"execution_id,omitempty"`
	OperationID     string             `json:"operation_id,omitempty"`
	Actor           *ActorRef          `json:"actor,omitempty"`
	Context         *OperationContext  `json:"context,omitempty"`
	State           ExecutionState     `json:"state,omitempty"`
	Progress        *OperationProgress `json:"progress,omitempty"`
	Result          json.RawMessage    `json:"result,omitempty"`
	Error           *Error             `json:"error,omitempty"`
	ResourceKind    string             `json:"resource_kind,omitempty"`
	ResourceID      string             `json:"resource_id,omitempty"`
}

type Operation

type Operation struct {
	ID                   string      `json:"id"`
	Description          string      `json:"description"`
	Safety               SafetyClass `json:"safety"`
	ConfirmationRequired bool        `json:"confirmation_required"`
	PolicyRequired       bool        `json:"policy_required"`
	ContractVersion      string      `json:"contract_version"`
	MCPTool              string      `json:"mcp_tool,omitempty"`
}

func OperationByID added in v0.4.15

func OperationByID(id string) (Operation, bool)

func Operations

func Operations() []Operation

type OperationContext added in v0.4.22

type OperationContext struct {
	Application string `json:"application,omitempty"`
	Environment string `json:"environment,omitempty"`
	Target      string `json:"target,omitempty"`
	Workspace   string `json:"workspace,omitempty"`
	Resource    string `json:"resource,omitempty"`
}

type OperationProgress added in v0.4.22

type OperationProgress struct {
	Stage   string  `json:"stage,omitempty"`
	Message string  `json:"message,omitempty"`
	Current int64   `json:"current,omitempty"`
	Total   int64   `json:"total,omitempty"`
	Percent float64 `json:"percent,omitempty"`
}

type SafetyClass

type SafetyClass string
const (
	SafetyReadOnly    SafetyClass = "read_only"
	SafetyMutating    SafetyClass = "mutating"
	SafetyDestructive SafetyClass = "destructive"
)

type StreamDescriptor added in v0.4.22

type StreamDescriptor struct {
	ContractVersion string           `json:"contract_version"`
	StreamID        string           `json:"stream_id"`
	Kind            StreamKind       `json:"kind"`
	Actor           ActorRef         `json:"actor"`
	Context         OperationContext `json:"context"`
	ResourceKind    string           `json:"resource_kind"`
	ResourceID      string           `json:"resource_id"`
	CreatedAt       time.Time        `json:"created_at"`
}

type StreamKind added in v0.4.22

type StreamKind string
const (
	StreamLogs StreamKind = "logs"
	StreamExec StreamKind = "exec"
)

type StreamRequest added in v0.4.22

type StreamRequest struct {
	ContractVersion string           `json:"contract_version"`
	Kind            StreamKind       `json:"kind"`
	Context         OperationContext `json:"context"`
	ResourceKind    string           `json:"resource_kind"`
	ResourceID      string           `json:"resource_id"`
	Since           *time.Time       `json:"since,omitempty"`
	Tail            int              `json:"tail,omitempty"`
	Follow          bool             `json:"follow,omitempty"`
	Command         []string         `json:"command,omitempty"`
	TTY             bool             `json:"tty,omitempty"`
}

func (StreamRequest) Validate added in v0.4.22

func (r StreamRequest) Validate() error

Jump to

Keyboard shortcuts

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