cronjob

package
v0.0.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package cronjob loads and runs workspace cronjob prompts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OnDemandCronTarget added in v0.0.7

func OnDemandCronTarget(text string, prefixes ...string) (string, bool)

OnDemandCronTarget extracts one deterministic top-level cron target from connector text.

Types

type Manager

type Manager struct {
	SendSlackChannel func(context.Context, string, string, string, string, string, []events.OutboundAttachment) error
	// contains filtered or unexported fields
}

Manager loads cron definitions once at startup and schedules them.

func New

func New(workspace, workDir string, bus *events.Bus, run RunFunc, logger *slog.Logger) *Manager

New constructs a cronjob manager using workDir for effective runtime cron definitions.

func (*Manager) LoadOneOffCronjob

func (m *Manager) LoadOneOffCronjob(target string) (OneOffCronjob, error)

LoadOneOffCronjob resolves and loads one live cronjob for a managed Slack thread run.

func (*Manager) RunOneOffCronjob

func (m *Manager) RunOneOffCronjob(ctx context.Context, job OneOffCronjob, progress *harnessbridge.RawRunProgress, finish func(context.Context, RunResult, error))

RunOneOffCronjob executes a loaded cronjob once with optional progress delivery.

func (*Manager) Start

func (m *Manager) Start(ctx context.Context) error

Start loads cron definitions and starts scheduling them.

func (*Manager) Stop

func (m *Manager) Stop(ctx context.Context) error

Stop shuts the cron manager down.

func (*Manager) StopAccepting added in v0.0.12

func (m *Manager) StopAccepting()

StopAccepting prevents queued cron triggers from starting new jobs.

type OneOffCronjob

type OneOffCronjob struct {
	Agent, Prompt, RelativePath, SlackChannel string
}

OneOffCronjob captures a live one-off cronjob prompt loaded from disk.

type RunFunc

RunFunc executes one cronjob prompt and returns the cronjob result.

type RunResult

type RunResult struct {
	Text, VerbatimMessage string
	Attachments           []events.OutboundAttachment
}

RunResult captures the observable result of one cronjob run.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL