Documentation
¶
Index ¶
- func NewCron(cfg CronConfig, deps CronDeps) (capschedule.Runtime, error)
- func NewFile(cfg FileConfig, deps FileDeps) (schedule.Registry, error)
- func NewMulti(cfg MultiConfig, deps MultiDeps) (schedule.Registry, error)
- type Cron
- type CronConfig
- type CronDeps
- type CronJobSpec
- type FileConfig
- type FileDeps
- type MultiConfig
- type MultiDeps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCron ¶ added in v0.1.3
func NewCron(cfg CronConfig, deps CronDeps) (capschedule.Runtime, error)
NewCron registers schedule/cron: Resident calendar scheduler over a shared job registry.
Best practices:
- Point tool/schedule at the same registry instance, or agent jobs never fire.
- Script jobs need workspace and shell deps; prompt jobs only need the registry.
- Missed boundaries are skipped, not backfilled.
func NewFile ¶
func NewFile(cfg FileConfig, deps FileDeps) (schedule.Registry, error)
NewFile registers schedule/file: Durable cron job table, shared by schedule/cron and tool/schedule.
Best practices:
- Point schedule/cron and tool/schedule at one instance, or the agent will schedule jobs nothing fires.
- Jobs carry a source: config jobs are reconciled against the preset on every start, agent jobs are left alone.
- Writes go through a temp file and rename, so a process killed mid-write leaves no truncated table.
Types ¶
type Cron ¶ added in v0.1.3
type Cron struct {
// contains filtered or unexported fields
}
Cron watches a shared registry and submits due jobs as inbound turns.
func (*Cron) SetClockForTest ¶ added in v0.1.3
func (c *Cron) SetClockForTest(now func() time.Time, wait func(context.Context, time.Duration) error)
SetClockForTest replaces the clock and wait so cron behaviour can be asserted without real waiting. Test-only.
func (*Cron) Start ¶ added in v0.1.3
func (c *Cron) Start(ctx context.Context, submit capschedule.SubmitFunc) error
type CronConfig ¶ added in v0.1.3
type CronConfig struct {
// Jobs are reconciled into the registry on every start with source=config.
Jobs []CronJobSpec `json:"jobs"`
// SessionMode is stateless (default), reuse, or fixed.
SessionMode string `json:"sessionMode"`
// SessionID is the id prefix used for inbound turns.
SessionID string `json:"sessionId"`
// PollSeconds is the idle backoff when no jobs are scheduled.
// Defaults to 30.
PollSeconds int `json:"pollSeconds"`
// MissedGraceSeconds is how long a missed one-shot job is still fired.
// Older one-shots are marked stale instead of backfilled. Defaults to 300.
MissedGraceSeconds int `json:"missedGraceSeconds"`
}
type CronJobSpec ¶ added in v0.1.3
type CronJobSpec struct {
ID string `json:"id"`
Cron string `json:"cron"`
Prompt string `json:"prompt,omitempty"`
Script string `json:"script,omitempty"`
Note string `json:"note,omitempty"`
}
CronJobSpec is one config-declared cron job. Prompt and script are mutually exclusive; script runs without an agent turn.
type FileConfig ¶
type FileConfig struct {
// Path is JSON file holding the jobs, resolved through the workspace.
Path string `json:"path"`
}
type MultiConfig ¶ added in v0.1.10
type MultiConfig struct {
// Path is the shared schedule file, default global:schedules/schedule.json.
Path string `json:"path"`
}
Click to show internal directories.
Click to hide internal directories.