trigger

package
v1.4.6 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package trigger implements cron scheduling and webhook handling for agent execution.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentRunner

type AgentRunner interface {
	RunFromTrigger(ctx context.Context, agentName, prompt, invocationType string) error
}

AgentRunner is the interface for executing agent runs from triggers.

type Scheduler

type Scheduler struct {
	// contains filtered or unexported fields
}

Scheduler manages cron-based agent execution.

func NewScheduler

func NewScheduler(runner AgentRunner) *Scheduler

NewScheduler creates a scheduler backed by the given runner. Cron expressions use the standard 5-field format: minute hour day-of-month month day-of-week (e.g. "0 9 * * 1-5" for 09:00 on weekdays). Do not use WithSeconds() so docs and configs match.

func (*Scheduler) Entries

func (s *Scheduler) Entries() int

Entries returns the number of registered cron entries (for testing).

func (*Scheduler) RegisterSchedules

func (s *Scheduler) RegisterSchedules(pol *policy.Policy) error

RegisterSchedules adds cron entries from the policy's trigger configuration.

func (*Scheduler) Start

func (s *Scheduler) Start()

Start begins executing registered cron jobs.

func (*Scheduler) Stop

func (s *Scheduler) Stop()

Stop halts the scheduler and waits for running jobs to complete.

type WebhookHandler

type WebhookHandler struct {
	// contains filtered or unexported fields
}

WebhookHandler handles incoming webhook triggers.

func NewWebhookHandler

func NewWebhookHandler(runner AgentRunner, pol *policy.Policy) *WebhookHandler

NewWebhookHandler creates a handler from the policy's webhook configuration.

func (*WebhookHandler) HandleWebhook

func (wh *WebhookHandler) HandleWebhook(w http.ResponseWriter, r *http.Request)

HandleWebhook processes an incoming webhook trigger.

Jump to

Keyboard shortcuts

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