Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NextTime ¶
NextTime calculates the next time that matches the 5-field cron expression after the given 'from' time. Returns the next fire time or an error.
Supported syntax per field:
- * — any value
- */N — every Nth value
- N — exact value
- N,M,K — list of values
- N-M — range (inclusive)
- N-M/S — range with step
Types ¶
type Job ¶
type Job struct {
ID string
CronExpr string
Prompt string
Recurring bool
CreatedAt time.Time
NextFire time.Time
}
Job represents a scheduled prompt job.
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler manages in-memory cron-like prompt scheduling.
func NewScheduler ¶
NewScheduler creates a scheduler with the given enqueue callback. The enqueue callback is called when a job fires, typically injecting the prompt into the TUI's conversation.
func (*Scheduler) Create ¶
Create adds a new scheduled job and returns its snapshot. The cron expression is a standard 5-field format:
minute hour day-of-month month day-of-week
Supports: *, */N, N, N-M, N,M,K, N-M/S
func (*Scheduler) SetEnqueue ¶
SetEnqueue sets or replaces the enqueue callback. Use this when the scheduler is created before the TUI is available.