machineapi

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package machineapi is the code of the machine connection API: every request and response body of Core's /api/v1 routes. Core's handlers, the daemon and the sandbox node all use these types. The routes, credentials and errors are in contracts/agents-api/machine-api.md.

Index

Constants

View Source
const (
	ConnectionConnected    = "connected"
	ConnectionDisconnected = "disconnected"
)
View Source
const DefaultHeartbeat = 15 * time.Second

DefaultHeartbeat applies when Core reports no positive heartbeat_seconds. A zero heartbeat would never ping and always hit the 60 second timeout.

View Source
const InstallGrantEnv = "OAC_INSTALL_GRANT"

InstallGrantEnv names the environment variable that carries the short-lived installation grant from Core's command to the installer. It never carries an executor credential.

Variables

This section is empty.

Functions

func CanonicalUUID

func CanonicalUUID(value string) bool

CanonicalUUID reports whether value is a non-nil UUID in canonical lower-case form.

Types

type AuthError

type AuthError struct {
	Error  string `json:"error"`
	Detail string `json:"detail"`
}

AuthError is the body of every failed agent-daemon/bootstrap and agent-daemon/ws request.

type BootstrapRequest

type BootstrapRequest struct {
	DeviceID string `json:"device_id"`
}

BootstrapRequest is the body of POST agent-daemon/bootstrap.

type BootstrapResponse

type BootstrapResponse struct {
	DeviceID         string `json:"device_id"`
	WSURL            string `json:"ws_url"`
	HeartbeatSeconds int    `json:"heartbeat_seconds"`
}

BootstrapResponse answers POST agent-daemon/bootstrap.

func (BootstrapResponse) HeartbeatInterval

func (b BootstrapResponse) HeartbeatInterval() time.Duration

type Connection

type Connection struct {
	EnvironmentID string `json:"environment_id"`
	Status        string `json:"status"`
}

Connection answers GET agent-daemon/connection.

type EnrollRequest

type EnrollRequest struct {
	EnvironmentID string `json:"environment_id"`
}

EnrollRequest is the body of POST agent-daemon/enroll.

type Enrollment

type Enrollment struct {
	DeviceID           string `json:"device_id"`
	SessionID          string `json:"session_id"`
	EnvironmentID      string `json:"environment_id"`
	WorkspaceDirectory string `json:"workspace_directory"`
}

Enrollment answers POST agent-daemon/enroll: the device bound to the Environment's Session.

func (Enrollment) Validate

func (e Enrollment) Validate(environment string) error

Validate checks that the binding names canonical IDs and the requested Environment.

type InstallationClaim

type InstallationClaim struct {
	ExecutorToken string `json:"executor_token"`
}

InstallationClaim is the body of POST agent-daemon/installation/claim.

type InstallationContext

type InstallationContext struct {
	Version         string `json:"version"`
	ProtocolVersion string `json:"protocol_version"`
	EnvironmentID   string `json:"environment_id"`
	RemoteURL       string `json:"remote_url"`
	Workspace       string `json:"workspace_directory"`
	Harness         string `json:"harness"`
}

InstallationContext answers POST agent-daemon/installation: the frozen connection constraints of one Session. It is bootstrap metadata, not an execution protocol.

type NodeEnrollment

type NodeEnrollment struct {
	SpecificationDigest  string `json:"specification_digest"`
	DeploymentGeneration uint64 `json:"deployment_generation"`
	NodeID               string `json:"node_id"`
	Credential           string `json:"credential"`
	Name                 string `json:"name"`
	Provider             string `json:"provider"`
	BackendFingerprint   string `json:"backend_fingerprint"`
	// The Core origin this node stores and connects to, such as https://core.example. It must equal the installation public URL; otherwise enrollment gets 409 sandbox_node_address_mismatch and the token stays unused.
	CoreURL string `json:"core_url"`
	// Host measurements as in the node's health reports. Core derives a limit the enrollment token leaves unset from them.
	CPUCount           *int64   `json:"cpu_count,omitempty"`
	EffectiveCPUCores  *float64 `json:"effective_cpu_cores,omitempty"`
	TotalMemoryBytes   *int64   `json:"total_memory_bytes,omitempty"`
	AvailableDiskBytes *int64   `json:"available_disk_bytes,omitempty"`
}

NodeEnrollment is the body of POST sandbox-node/enroll.

type NodeIdentity

type NodeIdentity struct {
	SpecificationDigest  string `json:"specification_digest"`
	DeploymentGeneration uint64 `json:"deployment_generation"`
	NodeID               string `json:"node_id"`
	InstallationID       string `json:"installation_id"`
	Provider             string `json:"provider"`
	MaxActive            int    `json:"max_active"`
	MaxRetained          int    `json:"max_retained"`
}

NodeIdentity answers POST sandbox-node/enroll.

type NodeStatus

type NodeStatus struct {
	NodeIdentity
	Connected     bool `json:"connected"`
	ProviderReady bool `json:"provider_ready"`
}

NodeStatus answers GET sandbox-node/identity: the authenticated node's identity and Core-owned presence.

Jump to

Keyboard shortcuts

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