Documentation
¶
Overview ¶
Package loop provides a recurring-prompt scheduler for the piglet loop extension. It is free of SDK dependencies and fully testable in isolation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var MinInterval = 30 * time.Second
MinInterval is the minimum allowed scheduling interval. Tests may lower this to speed up timing assertions.
Functions ¶
Types ¶
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler runs a prompt on a recurring interval. All methods are safe for concurrent use.
func (*Scheduler) Start ¶
func (s *Scheduler) Start(interval time.Duration, prompt string, onTick func(iteration int, prompt string)) error
Start launches the scheduler. It calls onTick immediately (iteration 1), then again after each interval. Returns an error if:
- interval < MinInterval
- the scheduler is already running
Click to show internal directories.
Click to hide internal directories.