cmd

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute() error

func ExtractTimestamp

func ExtractTimestamp(line string) time.Time

ExtractTimestamp extracts timestamp from a log line. Returns zero time if no timestamp found. Agent logs typically start with: "2024-01-28 10:15:32 | ..."

func GetPromptsDir

func GetPromptsDir() (string, error)

GetPromptsDir returns the prompts directory based on current scope.

func GetScope

func GetScope() scope.Scope

GetScope returns the current scope (project or global).

func IsLastIdentifier

func IsLastIdentifier(identifier string) bool

IsLastIdentifier returns true if the identifier refers to the most recent agent.

func IsLineInTimeRange

func IsLineInTimeRange(line string, since, until time.Time) bool

IsLineInTimeRange checks if a log line falls within the since/until range. Lines without timestamps are included by default (they're likely continuations).

func MatchesGrep

func MatchesGrep(line string, patterns []*regexp.Regexp, invert bool) bool

MatchesGrep returns true if the line matches any of the grep patterns. If invert is true, returns true if the line matches NONE of the patterns. If patterns is empty, returns true (no filter).

func ParseDurationWithDays

func ParseDurationWithDays(s string) (time.Duration, error)

ParseDurationWithDays handles durations with day support (e.g., "1d"). Standard time.ParseDuration doesn't support 'd' for days.

func ParseTimeFlag

func ParseTimeFlag(value string) (time.Time, error)

ParseTimeFlag parses a time flag value into a time.Time. It supports relative durations (e.g., "30m", "2h", "1d") and absolute timestamps.

func PersistSystemPrompt added in v0.15.0

func PersistSystemPrompt(content string, useGlobal bool) (string, error)

PersistSystemPrompt updates the configured system prompt and writes the change to the appropriate config file (project unless useGlobal is true). It is exported via the package for use by the `swarm run` command, which allows users to set + persist a system prompt in the same step.

func ResolveAgentIdentifier

func ResolveAgentIdentifier(mgr *state.Manager, identifier string) (*state.AgentState, error)

ResolveAgentIdentifier resolves an agent identifier to an AgentState. Handles special identifiers like "@last" and "_" which refer to the most recently started agent.

Types

type CheckResult

type CheckResult struct {
	Name        string   `json:"name"`
	Status      string   `json:"status"` // "pass", "warn", "fail"
	Details     []string `json:"details"`
	Suggestions []string `json:"suggestions,omitempty"`
}

CheckResult represents the result of a single diagnostic check.

type DoctorReport

type DoctorReport struct {
	Checks  []CheckResult `json:"checks"`
	Summary struct {
		Passed   int `json:"passed"`
		Warnings int `json:"warnings"`
		Failed   int `json:"failed"`
	} `json:"summary"`
}

DoctorReport contains all check results and a summary.

type ModelInfo

type ModelInfo struct {
	ID          string
	Description string
}

ModelInfo represents a model with its ID and optional description.

type ModelStat

type ModelStat struct {
	Name  string `json:"name"`
	Count int    `json:"count"`
}

ModelStat represents statistics for a single model.

type PromptStat

type PromptStat struct {
	Name       string `json:"name"`
	RunCount   int    `json:"run_count"`
	Iterations int    `json:"iterations"`
}

PromptStat represents statistics for a single prompt.

type Stats

type Stats struct {
	Running    int `json:"running"`
	Paused     int `json:"paused"`
	Terminated int `json:"terminated"`
	Total      int `json:"total"`

	IterationsCompleted  int     `json:"iterations_completed"`
	IterationsTotal      int     `json:"iterations_total"`
	IterationsSuccessful int     `json:"iterations_successful"`
	IterationsFailed     int     `json:"iterations_failed"`
	SuccessRate          float64 `json:"success_rate"`

	PromptStats []PromptStat `json:"prompt_stats"`
	ModelStats  []ModelStat  `json:"model_stats"`

	TotalRuntimeSeconds   int64 `json:"total_runtime_seconds"`
	AverageRuntimeSeconds int64 `json:"average_runtime_seconds"`
}

Stats represents aggregate statistics about agents.

Jump to

Keyboard shortcuts

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