protocol

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RunnerHello      = "runner.hello"
	RunnerWelcome    = "runner.welcome"
	RunnerHeartbeat  = "runner.heartbeat"
	RunnerSnapshot   = "runner.snapshot"
	CommandDispatch  = "command.dispatch"
	CommandAck       = "command.ack"
	CommandResult    = "command.result"
	EventAppend      = "event.append"
	ArtifactBegin    = "artifact.begin"
	ArtifactChunk    = "artifact.chunk"
	ArtifactComplete = "artifact.complete"
	ProtocolError    = "protocol.error"
)
View Source
const Version = "1.0"

Variables

This section is empty.

Functions

This section is empty.

Types

type Ack

type Ack struct {
	CommandID uuid.UUID `json:"commandId"`
	Duplicate bool      `json:"duplicate"`
}

type ArtifactFinish

type ArtifactFinish struct {
	UploadID uuid.UUID `json:"uploadId"`
}

type ArtifactPart

type ArtifactPart struct {
	UploadID uuid.UUID `json:"uploadId"`
	Offset   int64     `json:"offset"`
	Data     string    `json:"data"`
}

type ArtifactStart

type ArtifactStart struct {
	UploadID    uuid.UUID `json:"uploadId"`
	ArtifactID  uuid.UUID `json:"artifactId"`
	TaskID      uuid.UUID `json:"taskId"`
	Name        string    `json:"name"`
	Kind        string    `json:"kind"`
	SHA256      string    `json:"sha256"`
	Size        int64     `json:"size"`
	MIME        string    `json:"mime"`
	Compression string    `json:"compression"`
}

type CodexAccountUsage

type CodexAccountUsage struct {
	LifetimeTokens        *int64 `json:"lifetimeTokens,omitempty"`
	PeakDailyTokens       *int64 `json:"peakDailyTokens,omitempty"`
	CurrentStreakDays     *int64 `json:"currentStreakDays,omitempty"`
	LongestStreakDays     *int64 `json:"longestStreakDays,omitempty"`
	LongestRunningTurnSec *int64 `json:"longestRunningTurnSec,omitempty"`
}

type CodexCredits

type CodexCredits struct {
	Balance    *string `json:"balance,omitempty"`
	HasCredits bool    `json:"hasCredits"`
	Unlimited  bool    `json:"unlimited"`
}

type CodexMetadata

type CodexMetadata struct {
	Available   bool               `json:"available"`
	RefreshedAt time.Time          `json:"refreshedAt"`
	Models      []CodexModel       `json:"models"`
	RateLimits  *CodexRateLimits   `json:"rateLimits,omitempty"`
	Usage       *CodexAccountUsage `json:"usage,omitempty"`
	Message     string             `json:"message,omitempty"`
}

type CodexModel

type CodexModel struct {
	ID                        string                 `json:"id"`
	Model                     string                 `json:"model"`
	DisplayName               string                 `json:"displayName"`
	Description               string                 `json:"description"`
	IsDefault                 bool                   `json:"isDefault"`
	DefaultReasoningEffort    string                 `json:"defaultReasoningEffort"`
	SupportedReasoningEfforts []CodexReasoningEffort `json:"supportedReasoningEfforts"`
	DefaultServiceTier        *string                `json:"defaultServiceTier,omitempty"`
	ServiceTiers              []CodexServiceTier     `json:"serviceTiers"`
}

type CodexRateLimit

type CodexRateLimit struct {
	LimitID   *string               `json:"limitId,omitempty"`
	LimitName *string               `json:"limitName,omitempty"`
	PlanType  *string               `json:"planType,omitempty"`
	Primary   *CodexRateLimitWindow `json:"primary,omitempty"`
	Secondary *CodexRateLimitWindow `json:"secondary,omitempty"`
	Credits   *CodexCredits         `json:"credits,omitempty"`
}

type CodexRateLimitWindow

type CodexRateLimitWindow struct {
	UsedPercent        int    `json:"usedPercent"`
	ResetsAt           *int64 `json:"resetsAt,omitempty"`
	WindowDurationMins *int64 `json:"windowDurationMins,omitempty"`
}

type CodexRateLimits

type CodexRateLimits struct {
	Default   CodexRateLimit            `json:"default"`
	ByLimitID map[string]CodexRateLimit `json:"byLimitId,omitempty"`
}

type CodexReasoningEffort

type CodexReasoningEffort struct {
	ID          string `json:"id"`
	Description string `json:"description"`
}

type CodexServiceTier

type CodexServiceTier struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type Dispatch

type Dispatch struct {
	CommandID uuid.UUID       `json:"commandId"`
	TaskID    *uuid.UUID      `json:"taskId,omitempty"`
	Type      string          `json:"type"`
	Payload   json.RawMessage `json:"payload"`
}

type Envelope

type Envelope struct {
	ProtocolVersion string          `json:"protocolVersion"`
	MessageID       uuid.UUID       `json:"messageId"`
	Type            string          `json:"type"`
	SentAt          time.Time       `json:"sentAt"`
	CorrelationID   *uuid.UUID      `json:"correlationId,omitempty"`
	Payload         json.RawMessage `json:"payload"`
}

func New

func New(messageType string, correlationID *uuid.UUID, payload any) (Envelope, error)

type EventPayload

type EventPayload struct {
	TaskID         uuid.UUID       `json:"taskId"`
	Type           string          `json:"type"`
	Data           json.RawMessage `json:"data"`
	SourceMessage  uuid.UUID       `json:"sourceMessageId"`
	CodexTimestamp *time.Time      `json:"codexTimestamp,omitempty"`
}

type Heartbeat

type Heartbeat struct {
	Status      string         `json:"status"`
	Load        map[string]any `json:"load"`
	ActiveTasks []uuid.UUID    `json:"activeTasks"`
	CodexStatus string         `json:"codexStatus"`
	Codex       *CodexMetadata `json:"codex,omitempty"`
}

type Hello

type Hello struct {
	RunnerID         uuid.UUID      `json:"runnerId"`
	NodeID           string         `json:"nodeId"`
	Name             string         `json:"name"`
	Hostname         string         `json:"hostname"`
	Platform         string         `json:"platform"`
	Arch             string         `json:"arch"`
	Version          string         `json:"version"`
	CodexVersion     string         `json:"codexVersion"`
	CodexStatus      string         `json:"codexStatus"`
	Capabilities     map[string]any `json:"capabilities"`
	LastAckCommandID *uuid.UUID     `json:"lastAckCommandId,omitempty"`
}

type Result

type Result struct {
	CommandID uuid.UUID       `json:"commandId"`
	Success   bool            `json:"success"`
	Data      json.RawMessage `json:"data,omitempty"`
	Error     string          `json:"error,omitempty"`
}

type Snapshot

type Snapshot struct {
	Tasks      []SnapshotTask      `json:"tasks"`
	Commands   []SnapshotCommand   `json:"commands"`
	Workspaces []SnapshotWorkspace `json:"workspaces"`
}

Snapshot is sent immediately after hello and again after a reconnect. It lets the Control Plane reconcile durable Runner state when either side lost the final ACK/result during a network or process restart. All identifiers are still scoped by the credential-derived tenant on the server.

type SnapshotCommand

type SnapshotCommand struct {
	CommandID uuid.UUID       `json:"commandId"`
	Status    string          `json:"status"`
	Result    json.RawMessage `json:"result,omitempty"`
	Error     string          `json:"error,omitempty"`
	UpdatedAt time.Time       `json:"updatedAt"`
}

type SnapshotTask

type SnapshotTask struct {
	TaskID       uuid.UUID `json:"taskId"`
	ThreadID     string    `json:"threadId,omitempty"`
	ActiveTurnID string    `json:"activeTurnId,omitempty"`
	RelayTurnID  uuid.UUID `json:"relayTurnId,omitempty"`
	WorkspaceID  uuid.UUID `json:"workspaceId"`
	UpdatedAt    time.Time `json:"updatedAt"`
}

type SnapshotWorkspace

type SnapshotWorkspace struct {
	WorkspaceID   uuid.UUID `json:"workspaceId"`
	CanonicalPath string    `json:"canonicalPath"`
	UpdatedAt     time.Time `json:"updatedAt"`
}

type Welcome

type Welcome struct {
	RunnerID         uuid.UUID `json:"runnerId"`
	HeartbeatSeconds int       `json:"heartbeatSeconds"`
	ServerTime       time.Time `json:"serverTime"`
	Message          string    `json:"message,omitempty"`
}

Jump to

Keyboard shortcuts

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