Documentation
¶
Index ¶
- Constants
- Variables
- type CreateJobInput
- type CreateJobRequest
- type DeliveryCreator
- type Fire
- type FireResponse
- type FireStatus
- type Job
- type JobFilter
- type JobKind
- type JobResponse
- type JobStatus
- type JobsResponse
- type ReminderTool
- type RunGetter
- type Runner
- type SQLiteStore
- func (s *SQLiteStore) Close() error
- func (s *SQLiteStore) CreateAutomationFire(ctx context.Context, fire Fire) error
- func (s *SQLiteStore) CreateAutomationJob(ctx context.Context, job Job) error
- func (s *SQLiteStore) GetAutomationFireBySchedule(ctx context.Context, jobID string, scheduledFor time.Time) (Fire, error)
- func (s *SQLiteStore) GetAutomationJob(ctx context.Context, jobID string) (Job, error)
- func (s *SQLiteStore) ListAutomationJobs(ctx context.Context, filter JobFilter) ([]Job, error)
- func (s *SQLiteStore) UpdateAutomationFire(ctx context.Context, fire Fire) error
- func (s *SQLiteStore) UpdateAutomationJob(ctx context.Context, job Job) error
- type ScheduleMode
- type ScheduledAITaskTool
- type Service
- func (s *Service) CompleteJob(ctx context.Context, jobID string) (Job, error)
- func (s *Service) CreateJob(ctx context.Context, input CreateJobInput) (Job, error)
- func (s *Service) CreateJobForRun(ctx context.Context, runID string, input CreateJobInput) (Job, error)
- func (s *Service) DeleteJob(ctx context.Context, jobID string) (Job, error)
- func (s *Service) GetJob(ctx context.Context, jobID string) (Job, error)
- func (s *Service) ListJobs(ctx context.Context, filter JobFilter) ([]Job, error)
- func (s *Service) PauseJob(ctx context.Context, jobID string) (Job, error)
- func (s *Service) ResumeJob(ctx context.Context, jobID string) (Job, error)
- func (s *Service) Run(ctx context.Context)
- func (s *Service) RunNow(ctx context.Context, jobID string) (Fire, error)
- func (s *Service) Tick(ctx context.Context) error
- func (s *Service) WithClock(now func() time.Time) *Service
- func (s *Service) WithDeliveryTargets(targets []core.ClientDeliveryTarget) *Service
- func (s *Service) WithTickInterval(interval time.Duration) *Service
- type Store
Constants ¶
View Source
const ( DefaultTickInterval = 30 * time.Second DefaultTimezone = "UTC" )
Variables ¶
View Source
var ErrDuplicateFire = errors.New("duplicate automation fire")
Functions ¶
This section is empty.
Types ¶
type CreateJobInput ¶
type CreateJobRequest ¶
type CreateJobRequest struct {
Kind JobKind `json:"kind"`
SessionID string `json:"session_id"`
Client string `json:"client,omitempty"`
ExternalKey string `json:"external_key,omitempty"`
Title string `json:"title,omitempty"`
Timezone string `json:"timezone,omitempty"`
ScheduleMode ScheduleMode `json:"schedule_mode"`
RunAt string `json:"run_at,omitempty"`
IntervalSeconds int `json:"interval_seconds,omitempty"`
CronExpr string `json:"cron_expr,omitempty"`
Prompt string `json:"prompt"`
}
func NewCreateJobRequest ¶
func NewCreateJobRequest(input CreateJobInput) CreateJobRequest
func (CreateJobRequest) CreateInput ¶
func (request CreateJobRequest) CreateInput() (CreateJobInput, error)
type DeliveryCreator ¶
type DeliveryCreator interface {
CreateClientDelivery(ctx context.Context, delivery core.ClientDelivery) (core.ClientDelivery, error)
}
type Fire ¶
type Fire struct {
ID string `json:"id"`
JobID string `json:"job_id"`
ScheduledFor time.Time `json:"scheduled_for"`
Status FireStatus `json:"status"`
ResultState string `json:"result_state,omitempty"`
RunID string `json:"run_id,omitempty"`
Error string `json:"error,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
}
type FireResponse ¶
type FireResponse struct {
Fire Fire `json:"fire"`
}
type FireStatus ¶
type FireStatus string
const ( FireStatusPending FireStatus = "pending" FireStatusRunning FireStatus = "running" FireStatusCompleted FireStatus = "completed" FireStatusFailed FireStatus = "failed" FireStatusSkipped FireStatus = "skipped" )
type Job ¶
type Job struct {
ID string `json:"id"`
Kind JobKind `json:"kind"`
Status JobStatus `json:"status"`
SessionID string `json:"session_id"`
Client string `json:"client,omitempty"`
ExternalKey string `json:"external_key,omitempty"`
Title string `json:"title,omitempty"`
Timezone string `json:"timezone"`
ScheduleMode ScheduleMode `json:"schedule_mode"`
RunAt *time.Time `json:"run_at,omitempty"`
IntervalSeconds int `json:"interval_seconds,omitempty"`
CronExpr string `json:"cron_expr,omitempty"`
NextDueAt *time.Time `json:"next_due_at,omitempty"`
LastScheduledFor *time.Time `json:"last_scheduled_for,omitempty"`
Prompt string `json:"prompt"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt *time.Time `json:"deleted_at,omitempty"`
}
type JobResponse ¶
type JobResponse struct {
Job Job `json:"job"`
}
type JobsResponse ¶
type JobsResponse struct {
Jobs []Job `json:"jobs"`
}
type ReminderTool ¶
type ReminderTool struct {
// contains filtered or unexported fields
}
func NewReminderTool ¶
func NewReminderTool(service *Service) *ReminderTool
func (*ReminderTool) Spec ¶
func (t *ReminderTool) Spec() tools.Spec
type Runner ¶
type Runner interface {
AcceptTriggeredRun(ctx context.Context, input core.HandleTriggeredRunInput) (core.AcceptRunResult, error)
}
type SQLiteStore ¶
type SQLiteStore struct {
// contains filtered or unexported fields
}
func NewSQLiteStore ¶
func NewSQLiteStore(path string) (*SQLiteStore, error)
func (*SQLiteStore) Close ¶
func (s *SQLiteStore) Close() error
func (*SQLiteStore) CreateAutomationFire ¶
func (s *SQLiteStore) CreateAutomationFire(ctx context.Context, fire Fire) error
func (*SQLiteStore) CreateAutomationJob ¶
func (s *SQLiteStore) CreateAutomationJob(ctx context.Context, job Job) error
func (*SQLiteStore) GetAutomationFireBySchedule ¶
func (*SQLiteStore) GetAutomationJob ¶
func (*SQLiteStore) ListAutomationJobs ¶
func (*SQLiteStore) UpdateAutomationFire ¶
func (s *SQLiteStore) UpdateAutomationFire(ctx context.Context, fire Fire) error
func (*SQLiteStore) UpdateAutomationJob ¶
func (s *SQLiteStore) UpdateAutomationJob(ctx context.Context, job Job) error
type ScheduleMode ¶
type ScheduleMode string
const ( ScheduleModeOnce ScheduleMode = "once" ScheduleModeInterval ScheduleMode = "interval" ScheduleModeCron ScheduleMode = "cron" )
type ScheduledAITaskTool ¶
type ScheduledAITaskTool struct {
// contains filtered or unexported fields
}
func NewScheduledAITaskTool ¶
func NewScheduledAITaskTool(service *Service) *ScheduledAITaskTool
func (*ScheduledAITaskTool) Spec ¶
func (t *ScheduledAITaskTool) Spec() tools.Spec
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) CompleteJob ¶
func (*Service) CreateJobForRun ¶
func (*Service) WithDeliveryTargets ¶ added in v0.1.10
func (s *Service) WithDeliveryTargets(targets []core.ClientDeliveryTarget) *Service
type Store ¶
type Store interface {
CreateAutomationJob(ctx context.Context, job Job) error
GetAutomationJob(ctx context.Context, jobID string) (Job, error)
ListAutomationJobs(ctx context.Context, filter JobFilter) ([]Job, error)
UpdateAutomationJob(ctx context.Context, job Job) error
CreateAutomationFire(ctx context.Context, fire Fire) error
GetAutomationFireBySchedule(ctx context.Context, jobID string, scheduledFor time.Time) (Fire, error)
UpdateAutomationFire(ctx context.Context, fire Fire) error
}
Click to show internal directories.
Click to hide internal directories.