agent

package
v3.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const OperationEnvelopeVersion = "anixops.operation/v1"
View Source
const (
	ProtocolVersion = "anix.agent.v1"
)

Variables

View Source
var ErrNotPluginEnvelope = errors.New("desired operation is not an AnixOps plugin envelope")

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(config Config) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) IsConnected

func (c *Client) IsConnected() bool

func (*Client) Ready

func (c *Client) Ready() <-chan struct{}

func (*Client) SessionID

func (c *Client) SessionID() string

func (*Client) Start

func (c *Client) Start() error

type Config

type Config struct {
	Target           string
	NodeID           int
	APIKey           string
	UseTLS           bool
	ServerName       string
	AgentVersion     string
	InstanceID       string
	Capabilities     []*agentv1pb.Capability
	Labels           map[string]string
	KeepaliveTime    time.Duration
	Heartbeat        time.Duration
	ReconnectMin     time.Duration
	ReconnectMax     time.Duration
	DialTimeout      time.Duration
	HandshakeTimeout time.Duration
	Handler          OperationHandler
	DialContext      DialContextFunc
	DialOptions      []grpc.DialOption
	Rand             *mathrand.Rand
}

type DialContextFunc

type DialContextFunc func(context.Context, string, ...grpc.DialOption) (*grpc.ClientConn, error)

type OperationEnvelope

type OperationEnvelope struct {
	Version        string          `json:"version"`
	OperationID    string          `json:"operation_id"`
	IdempotencyKey string          `json:"idempotency_key"`
	SessionID      string          `json:"session_id"`
	Revision       uint64          `json:"revision"`
	PluginID       string          `json:"plugin_id"`
	TargetVersion  string          `json:"target_version"`
	ConfigHash     string          `json:"config_hash"`
	Config         json.RawMessage `json:"config"`
}

OperationEnvelope travels in DesiredOperation.payload_json. Keeping the outer protobuf stable lets older Agents retain their compatibility commands while plugin-aware Agents can require the full persistent-operation contract.

func DecodeOperationEnvelope

func DecodeOperationEnvelope(operation *agentv1pb.DesiredOperation) (*OperationEnvelope, error)

func DecodeOperationEnvelopeContext

func DecodeOperationEnvelopeContext(ctx context.Context, operation *agentv1pb.DesiredOperation) (*OperationEnvelope, error)

DecodeOperationEnvelopeContext additionally binds a plugin operation to the active Agent Control stream. DecodeOperationEnvelope remains available for offline validation and legacy callers that do not own a live session.

func (OperationEnvelope) Validate

func (e OperationEnvelope) Validate(operation *agentv1pb.DesiredOperation) error

type OperationHandler

type OperationHandler interface {
	HandleOperation(context.Context, *agentv1pb.DesiredOperation) (json.RawMessage, error)
}

type OperationHandlerFunc

type OperationHandlerFunc func(context.Context, *agentv1pb.DesiredOperation) (json.RawMessage, error)

func (OperationHandlerFunc) HandleOperation

func (f OperationHandlerFunc) HandleOperation(ctx context.Context, operation *agentv1pb.DesiredOperation) (json.RawMessage, error)

Jump to

Keyboard shortcuts

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