runshared

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProcessTerminationGracePeriod = 3 * time.Second
	GracefulShutdownTimeout       = 3 * time.Second
)
View Source
const (
	ExitCodeTimeout       = -2
	ExitCodeCanceled      = -1
	ActivityCheckInterval = 5 * time.Second
	RunStatusSucceeded    = "succeeded"
	RunStatusFailed       = "failed"
	RunStatusCanceled     = "canceled"
)

Variables

This section is empty.

Functions

func AppendLinesToBuffer

func AppendLinesToBuffer(buf *LineBuffer, lines []string)

func AtLeastOne

func AtLeastOne(value int) int

func CloneGroups

func CloneGroups(src map[string][]model.IssueEntry) map[string][]model.IssueEntry

func CountTotalIssues

func CountTotalIssues(job *Job) int

func CreateLogWriters

func CreateLogWriters(outFile *os.File, errFile *os.File, useUI bool, emitHuman bool) (io.Writer, io.Writer)

func RuntimeLogger

func RuntimeLogger(enabled bool) *slog.Logger

func RuntimeLoggerFor

func RuntimeLoggerFor(cfg *Config, useUI bool) *slog.Logger

func SilentLogger

func SilentLogger() *slog.Logger

func WriterOrNil

func WriterOrNil(file *os.File) io.Writer

Types

type ActivityMonitor

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

func NewActivityMonitor

func NewActivityMonitor() *ActivityMonitor

func (*ActivityMonitor) BeginActivity

func (a *ActivityMonitor) BeginActivity()

func (*ActivityMonitor) EndActivity

func (a *ActivityMonitor) EndActivity()

func (*ActivityMonitor) RecordActivity

func (a *ActivityMonitor) RecordActivity()

func (*ActivityMonitor) TimeSinceLastActivity

func (a *ActivityMonitor) TimeSinceLastActivity() time.Duration

type Config

type Config struct {
	WorkspaceRoot          string
	Name                   string
	Round                  int
	Provider               string
	PR                     string
	ReviewsDir             string
	TasksDir               string
	DryRun                 bool
	AutoCommit             bool
	Concurrent             int
	BatchSize              int
	IDE                    string
	Model                  string
	AddDirs                []string
	TailLines              int
	ReasoningEffort        string
	AccessMode             string
	TaskRuntimeRules       []model.TaskRuntimeRule
	Mode                   model.ExecutionMode
	OutputFormat           model.OutputFormat
	Verbose                bool
	Persist                bool
	DaemonOwned            bool
	DetachOnly             bool
	RunID                  string
	RunArtifacts           model.RunArtifacts
	RuntimeManager         model.RuntimeManager
	IncludeCompleted       bool
	IncludeResolved        bool
	Timeout                time.Duration
	MaxRetries             int
	RetryBackoffMultiplier float64
	SoundEnabled           bool
	SoundOnCompleted       string
	SoundOnFailed          string
}

func NewConfig

func NewConfig(src *model.RuntimeConfig, runArtifacts model.RunArtifacts) *Config

func (*Config) EventStreamEnabled

func (cfg *Config) EventStreamEnabled() bool

func (*Config) HumanOutputEnabled

func (cfg *Config) HumanOutputEnabled() bool

func (*Config) ResolvedOutputFormat

func (cfg *Config) ResolvedOutputFormat() model.OutputFormat

type FailInfo

type FailInfo struct {
	CodeFile string
	ExitCode int
	OutLog   string
	ErrLog   string
	Err      error
}

type Job

type Job struct {
	CodeFiles       []string
	Groups          map[string][]model.IssueEntry
	TaskTitle       string
	TaskType        string
	SafeName        string
	IDE             string
	Model           string
	ReasoningEffort string
	ReusableAgent   *ReusableAgentExecution
	Prompt          []byte
	SystemPrompt    string
	MCPServers      []model.MCPServer
	ResumeRunID     string
	ResumeSession   string
	OutPromptPath   string
	OutLog          string
	ErrLog          string
	Status          string
	Failure         string
	ExitCode        int
	Usage           model.Usage
	OutBuffer       *LineBuffer
	ErrBuffer       *LineBuffer
}

func NewJobs

func NewJobs(src []model.Job) []Job

func (Job) CodeFileLabel

func (j Job) CodeFileLabel() string

type JobAttemptResult

type JobAttemptResult struct {
	Status    JobAttemptStatus
	ExitCode  int
	Failure   *FailInfo
	Retryable bool
}

func (JobAttemptResult) IsCanceled

func (r JobAttemptResult) IsCanceled() bool

func (JobAttemptResult) NeedsRetry

func (r JobAttemptResult) NeedsRetry() bool

func (JobAttemptResult) Successful

func (r JobAttemptResult) Successful() bool

type JobAttemptStatus

type JobAttemptStatus string
const (
	AttemptStatusSuccess     JobAttemptStatus = "success"
	AttemptStatusFailure     JobAttemptStatus = "failure"
	AttemptStatusTimeout     JobAttemptStatus = "timeout"
	AttemptStatusCanceled    JobAttemptStatus = "canceled"
	AttemptStatusSetupFailed JobAttemptStatus = "setup_failed"
)

type JobPhase

type JobPhase string
const (
	JobPhaseQueued    JobPhase = "queued"
	JobPhaseScheduled JobPhase = "scheduled"
	JobPhaseRunning   JobPhase = "running"
	JobPhaseRetrying  JobPhase = "retrying"
	JobPhaseSucceeded JobPhase = "succeeded"
	JobPhaseFailed    JobPhase = "failed"
	JobPhaseCanceled  JobPhase = "canceled"
)

type LineBuffer

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

func NewLineBuffer

func NewLineBuffer(n int) *LineBuffer

func (*LineBuffer) AppendLine

func (r *LineBuffer) AppendLine(s string)

func (*LineBuffer) Snapshot

func (r *LineBuffer) Snapshot() []string

type ReusableAgentExecution

type ReusableAgentExecution struct {
	Name                string
	Source              string
	AvailableAgentCount int
}

ReusableAgentExecution carries reusable-agent metadata needed for runtime observability once the job prompt and MCP servers are fully prepared.

type ShutdownPhase

type ShutdownPhase string
const (
	ShutdownPhaseIdle     ShutdownPhase = ""
	ShutdownPhaseDraining ShutdownPhase = "draining"
	ShutdownPhaseForcing  ShutdownPhase = "forcing"
)

type ShutdownSource

type ShutdownSource string
const (
	ShutdownSourceSignal ShutdownSource = "signal"
	ShutdownSourceTimer  ShutdownSource = "timer"
)

type ShutdownState

type ShutdownState struct {
	Phase       ShutdownPhase
	Source      ShutdownSource
	RequestedAt time.Time
	DeadlineAt  time.Time
}

func (ShutdownState) Active

func (s ShutdownState) Active() bool

Jump to

Keyboard shortcuts

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