runtime

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 49 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type ActiveExecutionRegistry

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

func NewActiveExecutionRegistry

func NewActiveExecutionRegistry() *ActiveExecutionRegistry

func (*ActiveExecutionRegistry) Kill

func (r *ActiveExecutionRegistry) Kill(loopID, runID, executionID, reason string) (bool, error)

func (*ActiveExecutionRegistry) Register

func (r *ActiveExecutionRegistry) Register(loopID, runID, executionID string, execution activeExecution) func()

type Options

type Options struct {
	Config                      config.Config
	Logger                      bootstrap.Logger
	Now                         func() time.Time
	ShutdownTimeout             time.Duration
	WorktreeCleanupInitialDelay time.Duration
	OpenSQLiteCoordinator       OpenSQLiteCoordinatorFunc
	SyncConfiguredProjects      SyncConfiguredProjectsFunc
	RunSchedulerTick            RunSchedulerTickFunc
	ReadProcessCommand          ReadProcessCommandFunc
	SignalProcess               SignalProcessFunc
	DeferRecovery               bool
}

type ReadProcessCommandFunc

type ReadProcessCommandFunc func(context.Context, int) (string, error)

type RecoveryOrphanAgentCleanup

type RecoveryOrphanAgentCleanup struct {
	Attempted    bool   `json:"attempted"`
	CleanedCount int64  `json:"cleanedCount"`
	Warning      string `json:"warning,omitempty"`
}

type RecoverySummary

type RecoverySummary struct {
	StartedAt             string                     `json:"startedAt,omitempty"`
	CompletedAt           string                     `json:"completedAt,omitempty"`
	OrphanAgentCleanup    RecoveryOrphanAgentCleanup `json:"orphanAgentCleanup"`
	ExpiredLocksReleased  int64                      `json:"expiredLocksReleased"`
	InterruptedRunsMarked int64                      `json:"interruptedRunsMarked"`
	LoopsRequeued         int64                      `json:"loopsRequeued"`
	EventsWritten         int64                      `json:"eventsWritten"`
}

type RunSchedulerTickFunc

type RunSchedulerTickFunc func(context.Context, Services) error

type Runtime

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

func New

func New(options Options) *Runtime

func (*Runtime) CompleteStartup added in v0.7.1

func (r *Runtime) CompleteStartup(ctx context.Context) error

func (*Runtime) Config

func (r *Runtime) Config() config.Config

func (*Runtime) ExecutionMatchesProcess

func (r *Runtime) ExecutionMatchesProcess(ctx context.Context, execution storage.AgentExecutionRecord, pid int) (matches bool, running bool, err error)

func (*Runtime) NetworkStatus added in v0.9.0

func (r *Runtime) NetworkStatus() networkclient.Status

func (*Runtime) ReconcileStaleRunningRuns added in v0.9.1

func (r *Runtime) ReconcileStaleRunningRuns(ctx context.Context) (StaleRunReconcileSummary, error)

func (*Runtime) ReconcileWebhookForwarders added in v0.8.0

func (r *Runtime) ReconcileWebhookForwarders()

func (*Runtime) RecordWebhookDelivery added in v0.8.0

func (r *Runtime) RecordWebhookDelivery(eventType, deliveryID string)

func (*Runtime) RecoverySummary

func (r *Runtime) RecoverySummary() RecoverySummary

func (*Runtime) RefreshWebhookForwarders added in v0.8.0

func (r *Runtime) RefreshWebhookForwarders() error

func (*Runtime) Services

func (r *Runtime) Services() Services

func (*Runtime) Start

func (r *Runtime) Start(ctx context.Context) error

func (*Runtime) StartedAt

func (r *Runtime) StartedAt() (time.Time, bool)

func (*Runtime) Stop

func (r *Runtime) Stop(reason string)

func (*Runtime) TriggerSchedulerClaim added in v0.8.0

func (r *Runtime) TriggerSchedulerClaim()

func (*Runtime) TriggerSchedulerTick

func (r *Runtime) TriggerSchedulerTick()

func (*Runtime) WaitForShutdown

func (r *Runtime) WaitForShutdown()

func (*Runtime) WebhookForwarder added in v0.8.0

func (r *Runtime) WebhookForwarder() WebhookForwarder

func (*Runtime) WebhookStatus added in v0.8.0

func (r *Runtime) WebhookStatus() WebhookStatus

func (*Runtime) WorktreeCleanupStatus added in v0.9.0

func (r *Runtime) WorktreeCleanupStatus() WorktreeCleanupStatus

type Services

type Services struct {
	Coordinator      *storage.SQLiteCoordinator
	Repositories     *storage.Repositories
	Projects         *projects.Service
	Loops            *loops.Service
	Runs             *runs.Service
	ActiveExecutions *ActiveExecutionRegistry
}

type SignalProcessFunc

type SignalProcessFunc func(int, syscall.Signal) error

type StaleRunReconcileSummary added in v0.9.1

type StaleRunReconcileSummary struct {
	Mode                 string   `json:"mode"`
	StartedAt            string   `json:"startedAt,omitempty"`
	CompletedAt          string   `json:"completedAt,omitempty"`
	CandidateRuns        int64    `json:"candidateRuns"`
	InterruptedRuns      int64    `json:"interruptedRuns"`
	LoopsRequeued        int64    `json:"loopsRequeued"`
	QueueItemsRequeued   int64    `json:"queueItemsRequeued"`
	QueueItemsCancelled  int64    `json:"queueItemsCancelled"`
	CleanedExecutions    int64    `json:"cleanedExecutions"`
	SkippedUncertainRuns int64    `json:"skippedUncertainRuns"`
	EventsWritten        int64    `json:"eventsWritten"`
	RunIDs               []string `json:"runIds,omitempty"`
	LoopIDs              []string `json:"loopIds,omitempty"`
	ExecutionIDs         []string `json:"executionIds,omitempty"`
}

type SyncConfiguredProjectsFunc

type SyncConfiguredProjectsFunc func(context.Context, *projects.Service, config.Config, time.Time) error

type WebhookCounters added in v0.8.0

type WebhookCounters struct {
	DeliveriesReceived int `json:"deliveriesReceived"`
	Coalesced          int `json:"coalesced"`
	Dropped            int `json:"dropped"`
	Queued             int `json:"queued"`
	Processed          int `json:"processed"`
	Failed             int `json:"failed"`
}

type WebhookForwarder added in v0.8.0

type WebhookForwarder interface {
	Forward(context.Context, webhookforward.DeliveryRequest) (webhookforward.ForwardResult, error)
	Stats() webhookforward.Stats
	Close()
}

type WebhookForwarderState added in v0.8.0

type WebhookForwarderState struct {
	Repo          string   `json:"repo"`
	Running       bool     `json:"running"`
	PID           *int     `json:"pid,omitempty"`
	Adopted       bool     `json:"adopted"`
	Latched       bool     `json:"latched"`
	LatchReason   *string  `json:"latchReason,omitempty"`
	Fingerprint   string   `json:"fingerprint,omitempty"`
	SpawnedAt     *string  `json:"spawnedAt,omitempty"`
	Command       []string `json:"command"`
	RestartCount  int      `json:"restartCount"`
	LastStartedAt *string  `json:"lastStartedAt,omitempty"`
	LastExitAt    *string  `json:"lastExitAt,omitempty"`
	LastError     string   `json:"lastError,omitempty"`
	StdoutTail    []string `json:"stdoutTail,omitempty"`
	StderrTail    []string `json:"stderrTail,omitempty"`
}

type WebhookForwarderStatus added in v0.8.0

type WebhookForwarderStatus struct {
	Repo         string   `json:"repo"`
	Events       []string `json:"events"`
	Command      []string `json:"command"`
	Running      bool     `json:"running"`
	RespawnCount int      `json:"respawnCount"`
	LastStartAt  *string  `json:"lastStartAt,omitempty"`
	LastExitAt   *string  `json:"lastExitAt,omitempty"`
	LastError    *string  `json:"lastError,omitempty"`
	Tail         []string `json:"tail"`
}

type WebhookQueueStatus added in v0.8.0

type WebhookQueueStatus struct {
	Pending       int `json:"pending"`
	Capacity      int `json:"capacity"`
	ActiveWorkers int `json:"activeWorkers"`
}

type WebhookRecentOutcome added in v0.8.0

type WebhookRecentOutcome struct {
	At      string `json:"at"`
	Outcome string `json:"outcome"`
	Message string `json:"message"`
}

type WebhookRuntimeStatus added in v0.8.0

type WebhookRuntimeStatus struct {
	Enabled         bool                     `json:"enabled"`
	Healthy         bool                     `json:"healthy"`
	Degraded        bool                     `json:"degraded"`
	Endpoint        *string                  `json:"endpoint,omitempty"`
	DegradedReasons []string                 `json:"degradedReasons,omitempty"`
	Forwarders      []WebhookForwarderStatus `json:"forwarders"`
}

type WebhookStatus added in v0.8.0

type WebhookStatus struct {
	Enabled                     bool                    `json:"enabled"`
	Mode                        config.WebhookMode      `json:"mode"`
	ConfiguredTunnelProjectIDs  []string                `json:"configuredTunnelProjectIds,omitempty"`
	FallbackPollIntervalSeconds int                     `json:"fallbackPollIntervalSeconds"`
	ListenerPath                string                  `json:"listenerPath"`
	EndpointURL                 string                  `json:"endpointUrl"`
	TunnelListenerURL           string                  `json:"tunnelListenerUrl,omitempty"`
	TunnelPublicBaseURL         string                  `json:"tunnelPublicBaseUrl,omitempty"`
	Degraded                    bool                    `json:"degraded"`
	DegradedReasons             []string                `json:"degradedReasons"`
	Queue                       WebhookQueueStatus      `json:"queue"`
	Counters                    WebhookCounters         `json:"counters"`
	RecentOutcomes              []WebhookRecentOutcome  `json:"recentOutcomes"`
	Forwarders                  []WebhookForwarderState `json:"forwarders"`
	TunnelHooks                 []WebhookTunnelState    `json:"tunnelHooks"`
}

type WebhookTunnelState added in v0.8.1

type WebhookTunnelState struct {
	Repo                string  `json:"repo"`
	HookID              *int64  `json:"hookId,omitempty"`
	ManagedURL          string  `json:"managedUrl,omitempty"`
	LastPingAt          *string `json:"lastPingAt,omitempty"`
	ConsecutiveDisables int64   `json:"consecutiveDisables"`
	Latched             bool    `json:"latched"`
	Orphaned            bool    `json:"orphaned"`
	LastError           string  `json:"lastError,omitempty"`
}

type WorktreeCleanupStatus added in v0.9.0

type WorktreeCleanupStatus struct {
	Enabled         bool    `json:"enabled"`
	DryRun          bool    `json:"dryRun"`
	LastStartedAt   *string `json:"lastStartedAt,omitempty"`
	LastCompletedAt *string `json:"lastCompletedAt,omitempty"`
	LastStatus      string  `json:"lastStatus"`
	Scanned         int     `json:"scanned"`
	Candidates      int     `json:"candidates"`
	Cleaned         int     `json:"cleaned"`
	Skipped         int     `json:"skipped"`
	Failed          int     `json:"failed"`
	LastError       string  `json:"lastError,omitempty"`
}

Jump to

Keyboard shortcuts

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