cloudworker

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 23 Imported by: ? 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 cloudworker runs one exact cloud-leased target through Fort's native runtime without importing any provider credential or cloud database client.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAdapterNotApproved = errors.New("cloud worker adapter binding is not approved")
	ErrWorkerInvalid      = errors.New("cloud worker configuration or assignment is invalid")
)

Functions

This section is empty.

Types

type AdapterRegistry

type AdapterRegistry interface {
	Prepare(controlapi.WorkerAssignment, ExecutionContext) (runtime.RunSpec, error)
}

type ApprovedBinding

type ApprovedBinding struct {
	Pins      coreworker.ExecutionPins          `json:"pins"`
	Execution controlapi.WorkerExecutionBinding `json:"execution"`
}

type CommandReadiness

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

CommandReadiness delegates capability observation to one explicitly configured, absolute executable. The executable must emit one bounded JSON object. Recheck runs it again and requires byte-identical evidence before it probes the exact built-in native provider and verifies the pinned workdir.

func NewCommandReadiness

func NewCommandReadiness(capabilityRevisionID string, revision int, command []string, providers []native.Provider) (*CommandReadiness, error)

func (*CommandReadiness) Recheck

func (readiness *CommandReadiness) Recheck(ctx context.Context, assignment controlapi.WorkerAssignment) error

func (*CommandReadiness) Snapshot

func (readiness *CommandReadiness) Snapshot(ctx context.Context) (ReadinessSnapshot, error)

type ExecutionContext

type ExecutionContext struct {
	ManifestID     string
	ManifestDigest string
	Items          []controlapi.WorkerContextItem
}

ExecutionContext is the complete immutable, typed context selected by Fort. A separately approved adapter owns any provider-specific encoding; Worker never concatenates these records into the assignment prompt.

type HTTPClient

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

HTTPClient is the enrolled machine's bounded HTTPS implementation of Control. It sends plaintext only to the authenticated control endpoint; it has no application AEAD key and no Supabase credential.

func NewHTTPClient

func NewHTTPClient(config HTTPConfig) (*HTTPClient, error)

func (*HTTPClient) AcknowledgeWorkerCancellation

func (client *HTTPClient) AcknowledgeWorkerCancellation(ctx context.Context, command controlapi.WorkerCancellationAckCommand) (controlapi.WorkerCancellationAck, error)

func (*HTTPClient) AppendWorkerArtifactChunk

func (client *HTTPClient) AppendWorkerArtifactChunk(ctx context.Context, command controlapi.WorkerArtifactChunkCommand) (controlapi.WorkerArtifactChunk, error)

func (*HTTPClient) ClaimNextWorkerTarget

func (client *HTTPClient) ClaimNextWorkerTarget(ctx context.Context, command controlapi.WorkerClaimNextCommand) (controlapi.WorkerAssignment, error)

func (*HTTPClient) CommitWorkerTerminal

func (client *HTTPClient) CommitWorkerTerminal(ctx context.Context, command controlapi.WorkerTerminalCommand) (controlapi.WorkerTerminalResult, error)

func (*HTTPClient) CreateWorkerArtifact

func (client *HTTPClient) CreateWorkerArtifact(ctx context.Context, command controlapi.WorkerArtifactCreateCommand) (controlapi.WorkerArtifact, error)

func (*HTTPClient) FinalizeWorkerArtifact

func (client *HTTPClient) FinalizeWorkerArtifact(ctx context.Context, command controlapi.WorkerArtifactFinalizeCommand) (controlapi.WorkerArtifact, error)

func (*HTTPClient) GetWorkerArtifactStatus

func (client *HTTPClient) GetWorkerArtifactStatus(ctx context.Context, command controlapi.WorkerArtifactStatusCommand) (controlapi.WorkerArtifact, error)

func (*HTTPClient) HeartbeatWorkerLease

func (*HTTPClient) ReadWorkerContextPage

func (client *HTTPClient) ReadWorkerContextPage(ctx context.Context, command controlapi.WorkerContextPageCommand) (controlapi.WorkerContextPage, error)

func (*HTTPClient) RecordWorkerReadiness

func (client *HTTPClient) RecordWorkerReadiness(ctx context.Context, command controlapi.WorkerReadinessCommand) (controlapi.WorkerReadinessResult, error)

type HTTPConfig

type HTTPConfig struct {
	Endpoint string
	Identity Identity
	Token    string
	Client   *http.Client
}

type HeartbeatFactory

type HeartbeatFactory func(time.Duration) (<-chan time.Time, func())

type IDSource

type IDSource interface {
	New(kind string) string
}

type Identity

type Identity struct {
	AccountID string
	WorkerID  string
	MachineID string
}

type NativeRegistry

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

NativeRegistry is an explicit local allow-list. Every immutable execution selector, including the server-pinned workdir, must match before a RunSpec is produced. It never falls back to another provider, model, adapter, or path.

func NewNativeRegistry

func NewNativeRegistry(bindings []ApprovedBinding) (*NativeRegistry, error)

func (*NativeRegistry) Prepare

func (registry *NativeRegistry) Prepare(assignment controlapi.WorkerAssignment, executionContext ExecutionContext) (runtime.RunSpec, error)

type Readiness

type Readiness interface {
	Snapshot(context.Context) (ReadinessSnapshot, error)
	Recheck(context.Context, controlapi.WorkerAssignment) error
}

Readiness owns local capability observation. Recheck must probe the same exact local evidence again; Worker invokes it immediately before Dispatch.

type ReadinessSnapshot

type ReadinessSnapshot struct {
	CapabilityRevisionID string
	Revision             int
	Evidence             json.RawMessage
	EvidenceDigest       string
}

type Worker

type Worker struct {
	Identity          Identity
	Control           Control
	Runtime           runtime.Runtime
	Readiness         Readiness
	Adapters          AdapterRegistry
	Clock             func() time.Time
	IDs               IDSource
	Heartbeat         HeartbeatFactory
	HeartbeatInterval time.Duration
}

func (*Worker) RunOne

func (worker *Worker) RunOne(ctx context.Context) (bool, error)

RunOne records readiness, atomically claims at most one compatible target, executes it, and durably commits its plaintext output through Control.

Jump to

Keyboard shortcuts

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