Documentation
¶
Index ¶
- type GoalControllerSchedule
- type Handler
- type Option
- func WithAuthConfig(cfg *svcauth.Config) Option
- func WithConversationClient(client convcli.Client) Option
- func WithInterval(d time.Duration) Option
- func WithMaxConcurrentRuns(n int) Option
- func WithScyService(sv *scy.Service) Option
- func WithTokenProvider(p token.Provider) Option
- func WithUserCredAuthConfig(cfg *UserCredAuthConfig) Option
- func WithUserService(users svcauth.UserService) Option
- type RunListPage
- type Schedule
- type ScheduleStore
- type Service
- func (s *Service) CancelGoalWakeups(ctx context.Context, conversationID, goalID string) error
- func (s *Service) CurrentGoalWakeup(ctx context.Context, conversationID, goalID string) *GoalControllerSchedule
- func (s *Service) Delete(ctx context.Context, id string) error
- func (s *Service) Get(ctx context.Context, id string) (*Schedule, error)
- func (s *Service) List(ctx context.Context) ([]*Schedule, error)
- func (s *Service) RunDue(ctx context.Context) (int, error)
- func (s *Service) RunNow(ctx context.Context, id string) error
- func (s *Service) ScheduleGoalWakeup(ctx context.Context, req agentsvc.GoalWakeupRequest) (bool, error)
- func (s *Service) StartWatchdog(ctx context.Context)
- func (s *Service) Upsert(ctx context.Context, schedule *Schedule) error
- type Store
- type UserCredAuthConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GoalControllerSchedule ¶ added in v0.1.13
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler serves scheduler HTTP endpoints.
func NewHandler ¶
NewHandler creates a scheduler HTTP handler.
func (*Handler) RegisterWithoutRunNow ¶
RegisterWithoutRunNow mounts scheduler routes except the run-now endpoint.
type Option ¶
type Option func(*Service)
Option customizes the scheduler service.
func WithAuthConfig ¶ added in v0.1.1
WithAuthConfig sets auth configuration used by scheduler OOB user_cred flow.
func WithConversationClient ¶
WithConversationClient sets the conversation client used to annotate scheduled conversations.
func WithInterval ¶
WithInterval sets the watchdog polling interval.
func WithMaxConcurrentRuns ¶ added in v0.1.8
WithMaxConcurrentRuns caps the number of in-flight executeRun goroutines. A value <= 0 disables the cap (unbounded fan-out) and matches historical behaviour. When the cap is reached, new enqueueAndLaunch calls block until an existing run finishes.
func WithScyService ¶
WithScyService sets the scy service for loading encrypted secrets.
func WithTokenProvider ¶
WithTokenProvider sets the token provider for credential management.
func WithUserCredAuthConfig ¶ added in v0.1.2
func WithUserCredAuthConfig(cfg *UserCredAuthConfig) Option
WithUserCredAuthConfig sets public scheduler auth configuration used by legacy user_cred_url OOB authorization.
func WithUserService ¶ added in v0.1.7
func WithUserService(users svcauth.UserService) Option
WithUserService sets the user service used to resolve scheduler subjects to persistent user IDs for the created_by_user_id auth path.
type RunListPage ¶ added in v0.1.1
type Schedule ¶
type Schedule struct {
ID string `json:"id"`
Name string `json:"name"`
Description *string `json:"description,omitempty"`
CreatedByUserID *string `json:"createdByUserId,omitempty"`
Visibility string `json:"visibility,omitempty"`
Internal bool `json:"internal,omitempty"`
ConversationID *string `json:"conversationId,omitempty"`
GoalID *string `json:"goalId,omitempty"`
AgentRef string `json:"agentRef"`
ModelOverride *string `json:"modelOverride,omitempty"`
UserCredURL *string `json:"userCredUrl,omitempty"`
Enabled bool `json:"enabled"`
StartAt *time.Time `json:"startAt,omitempty"`
EndAt *time.Time `json:"endAt,omitempty"`
ScheduleType string `json:"scheduleType"`
CronExpr *string `json:"cronExpr,omitempty"`
IntervalSeconds *int `json:"intervalSeconds,omitempty"`
Timezone string `json:"timezone,omitempty"`
TimeoutSeconds int `json:"timeoutSeconds,omitempty"`
TaskPromptURI *string `json:"taskPromptUri,omitempty"`
TaskPrompt *string `json:"taskPrompt,omitempty"`
NextRunAt *time.Time `json:"nextRunAt,omitempty"`
LastRunAt *time.Time `json:"lastRunAt,omitempty"`
LastStatus *string `json:"lastStatus,omitempty"`
LastError *string `json:"lastError,omitempty"`
LeaseOwner *string `json:"leaseOwner,omitempty"`
LeaseUntil *time.Time `json:"leaseUntil,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt,omitempty"`
}
Schedule represents a scheduled task configuration.
type ScheduleStore ¶
type ScheduleStore = Store
ScheduleStore is kept as a compatibility alias for the persisted scheduler store.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages persisted scheduler CRUD and execution of due schedules.
func (*Service) CancelGoalWakeups ¶ added in v0.1.13
func (*Service) CurrentGoalWakeup ¶ added in v0.1.13
func (s *Service) CurrentGoalWakeup(ctx context.Context, conversationID, goalID string) *GoalControllerSchedule
func (*Service) ScheduleGoalWakeup ¶ added in v0.1.13
func (*Service) StartWatchdog ¶
StartWatchdog begins a background loop that polls for due schedules at the configured interval. It blocks until ctx is cancelled.
type Store ¶
type Store interface {
Get(ctx context.Context, id string) (*schedulepkg.ScheduleView, error)
List(ctx context.Context) ([]*schedulepkg.ScheduleView, error)
ListRuns(ctx context.Context, in *schrun.RunListInput, page, size int) (*RunListPage, error)
ListForRunDue(ctx context.Context) ([]*schedulepkg.ScheduleView, error)
DeleteSchedule(ctx context.Context, id string) error
PatchSchedule(ctx context.Context, schedule *schedwrite.Schedule) error
PatchRuns(ctx context.Context, rows []*agrunwrite.MutableRunView) error
ListRunsForDue(ctx context.Context, scheduleID string, scheduledFor *time.Time, excludeStatuses []string) ([]*schrun.RunView, error)
TryClaimSchedule(ctx context.Context, scheduleID, leaseOwner string, leaseUntil time.Time) (bool, error)
ReleaseScheduleLease(ctx context.Context, scheduleID, leaseOwner string) (bool, error)
TryClaimRun(ctx context.Context, runID, leaseOwner string, leaseUntil time.Time) (bool, error)
ReleaseRunLease(ctx context.Context, runID, leaseOwner string) (bool, error)
}
Store provides persisted scheduler reads/writes backed by Datly components.
type UserCredAuthConfig ¶ added in v0.1.2
UserCredAuthConfig contains the subset of auth settings required for legacy scheduler user_cred_url OOB authorization.