status

package
v0.178.3 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: BSD-2-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package status aggregates and formats system status information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blocked added in v0.174.6

type Blocked struct {
	Number  int    `json:"number"`            // The prompt number being gated (3-digit, e.g. 227)
	Reason  string `json:"reason"`            // One of: previous-prompt-not-completed, previous-prompt-missing, prompt-frontmatter-parse-error, prompt-file-read-error, project-lock-timeout
	Missing int    `json:"missing,omitempty"` // The prompt number the guard expected to find (omitted when not applicable)
}

Blocked describes a queue-advance guard refusal (spec 092).

type Checker

type Checker interface {
	GetStatus(ctx context.Context) (*Status, error)
	GetQueuedPrompts(ctx context.Context) ([]QueuedPrompt, error)
	GetCompletedPrompts(ctx context.Context, limit int) ([]CompletedPrompt, error)
}

Checker checks the current status of the dark-factory daemon.

func NewChecker

func NewChecker(
	projectName project.Name,
	projectDir string,
	queueDir string,
	completedDir string,
	logDir string,
	lockFilePath string,
	serverPort int,
	promptMgr PromptManager,
	containerCounter executor.ContainerCounter,
	maxContainers int,
	dirtyFileThreshold int,
	currentDateTimeGetter libtime.CurrentDateTimeGetter,
	subprocRunner subproc.Runner,
) Checker

NewChecker creates a new Checker with additional options.

type CompletedPrompt

type CompletedPrompt struct {
	Name        string           `json:"name"`
	CompletedAt libtime.DateTime `json:"completed_at"`
}

CompletedPrompt represents a completed prompt with metadata.

type Formatter added in v0.8.0

type Formatter interface {
	Format(st *Status) string
}

Formatter formats status for display.

func NewFormatter added in v0.8.0

func NewFormatter() Formatter

NewFormatter creates a new Formatter.

type PromptManager added in v0.119.2

type PromptManager interface {
	ListQueued(ctx context.Context) ([]prompt.Prompt, error)
	Title(ctx context.Context, path string) (string, error)
	ReadFrontmatter(ctx context.Context, path string) (*prompt.Frontmatter, error)
	HasExecuting(ctx context.Context) bool
	FindCommitting(ctx context.Context) ([]string, error)
	// GetBlockedPrompt scans the queue and returns the first queued prompt whose
	// per-spec predecessor is not completed. Returns (0, "", 0, false) if no
	// blocker is active.
	GetBlockedPrompt(ctx context.Context) (number int, reason string, missing int, ok bool)
}

PromptManager is the subset of prompt.Manager that the status package uses.

type QueuedPrompt

type QueuedPrompt struct {
	Name  string `json:"name"`
	Title string `json:"title"`
	Size  int64  `json:"size"`
}

QueuedPrompt represents a prompt in the queue with metadata.

type Status

type Status struct {
	ProjectDir          string   `json:"project_dir,omitempty"`
	Daemon              string   `json:"daemon"`
	DaemonPID           int      `json:"daemon_pid,omitempty"`
	CurrentPrompt       string   `json:"current_prompt,omitempty"`
	ExecutingSince      string   `json:"executing_since,omitempty"`
	Container           string   `json:"container,omitempty"`
	ContainerRunning    bool     `json:"container_running,omitempty"`
	GeneratingSpec      string   `json:"generating_spec,omitempty"`
	GeneratingContainer string   `json:"generating_container,omitempty"`
	QueueCount          int      `json:"queue_count"`
	QueuedPrompts       []string `json:"queued_prompts"`
	// Blocked describes the queue-advance guard's refusal to advance (spec 092).
	// Omitted from JSON and text output when no blocker is active.
	Blocked            *Blocked `json:"blocked,omitempty"`
	CommittingPrompts  []string `json:"committing_prompts,omitempty"`
	CommittingCount    int      `json:"committing_count,omitempty"`
	CompletedCount     int      `json:"completed_count"`
	ContainerCount     int      `json:"container_count,omitempty"`
	ContainerMax       int      `json:"container_max,omitempty"`
	DaemonLogFile      string   `json:"daemon_log_file,omitempty"`
	LastLogFile        string   `json:"last_log_file,omitempty"`
	LastLogSize        int64    `json:"last_log_size,omitempty"`
	GitIndexLock       bool     `json:"git_index_lock,omitempty"`
	DirtyFileCount     int      `json:"dirty_file_count,omitempty"`
	DirtyFileThreshold int      `json:"dirty_file_threshold,omitempty"`

	// Skipped flags — true when the corresponding subprocess call was
	// cancelled at timeout. Callers should NOT treat the zero value of
	// related fields as authoritative when the matching Skipped flag is true.
	DirtyFileCheckSkipped   bool `json:"dirty_file_check_skipped,omitempty"`
	ContainerRunningSkipped bool `json:"container_running_skipped,omitempty"`
	GeneratingSpecSkipped   bool `json:"generating_spec_skipped,omitempty"`
	ContainerCountSkipped   bool `json:"container_count_skipped,omitempty"`
}

Status represents the current daemon status.

Jump to

Keyboard shortcuts

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