Documentation
¶
Overview ¶
Package daemon implements the squad routines daemon's runtime loop — loading routines, wiring the scheduler, catching up on missed fires, watching for manifest changes, and firing agents.
The package is consumed by two callers:
- `cmd/squad` (subcommand `routined`) for "just run the squad binary as the daemon" — what launchd / systemd use by default.
- `cmd/squad-routined` (Windows GUI-subsystem binary) so Task Scheduler doesn't flash a console window on every restart.
Both invocations end up calling Run with the same loaded config.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildFireFn ¶
BuildFireFn returns a routine.FireFn that invokes runner.ExecuteRun against the squad agent system for one routine fire. Exposed so tests and alternative daemon entrypoints can construct the same fire path.
func RedirectStdio ¶
RedirectStdio appends-opens path and points os.Stdout/os.Stderr at it. Used on Windows where Task Scheduler has no native stdio redirection like launchd's StandardOutPath or systemd's StandardOutput=journal.
func Run ¶
Run owns the daemon's lifecycle: validate inputs, build store + scheduler, catch up on missed fires, then hand off to runLoop (which spawns the watch goroutine and blocks on ctx). Splitting the entrypoint keeps the testable validation/setup in this file; the lifecycle wrapper lives in daemon_run.go and is excluded from coverage because its assertion surface is goroutines + signals.
Types ¶
type Options ¶
type Options struct {
// MaxConcurrent caps simultaneous in-flight fires across the daemon.
// Defaults to 2.
MaxConcurrent uint
// FireTimeout, if non-zero, applies a wall-clock deadline to each fire.
FireTimeout time.Duration
}
Options tune the daemon's runtime behaviour. The zero value runs with sensible defaults.