Documentation
¶
Index ¶
- func Execute() error
- func ExtractTimestamp(line string) time.Time
- func GetPromptsDir() (string, error)
- func GetScope() scope.Scope
- func IsLastIdentifier(identifier string) bool
- func IsLineInTimeRange(line string, since, until time.Time) bool
- func MatchesGrep(line string, patterns []*regexp.Regexp, invert bool) bool
- func ParseDurationWithDays(s string) (time.Duration, error)
- func ParseTimeFlag(value string) (time.Time, error)
- func PersistSystemPrompt(content string, useGlobal bool) (string, error)
- func ResolveAgentIdentifier(mgr *state.Manager, identifier string) (*state.AgentState, error)
- type CheckResult
- type DoctorReport
- type ModelInfo
- type ModelStat
- type PromptStat
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractTimestamp ¶
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 ¶
GetPromptsDir returns the prompts directory based on current scope.
func IsLastIdentifier ¶
IsLastIdentifier returns true if the identifier refers to the most recent agent.
func IsLineInTimeRange ¶
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 ¶
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 ¶
ParseDurationWithDays handles durations with day support (e.g., "1d"). Standard time.ParseDuration doesn't support 'd' for days.
func ParseTimeFlag ¶
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
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 ¶
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 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.
Source Files
¶
- attach.go
- clone.go
- completion.go
- compose_logs.go
- compose_stop.go
- config.go
- diff.go
- doctor.go
- down.go
- init.go
- inspect.go
- kill.go
- kill_all.go
- list.go
- logs.go
- models.go
- pause_all.go
- prompts.go
- prompts_check.go
- prompts_edit.go
- prompts_new.go
- prompts_show.go
- prune.go
- replay.go
- restart.go
- resume_all.go
- rm.go
- root.go
- run.go
- start.go
- start_all.go
- stats.go
- stop.go
- stop_all.go
- summary.go
- top.go
- up.go
- update.go
- upgrade.go
- version.go
- wait.go