Documentation
¶
Overview ¶
Package cron hosts the recurring-schedule prompt tools: cron_create, cron_list, cron_delete. They share the alarm package's Scheduler — a cron job is an alarm.Alarm with a non-empty CronExpr — so cron jobs and one-shot alarms coexist in one timer set, one durable store, and one fire path (WakeupQueue enqueue + idle-wake) the agent already wires for alarms.
remote_trigger lives here for parity with the reference source but is an unrelated HTTP-client feature and remains a stub.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Trigger tools.Tool = tools.NewStub( tools.REMOTE_TRIGGER, "Call the remote-trigger API. Use this instead of curl — the OAuth token is added automatically in-process and never exposed. "+ "Actions: list (GET all), get (GET one), create (POST new — requires body), "+ "update (POST partial update — requires body), run (POST /run — optional body). "+ "Returns raw JSON from the API.", `{ "type":"object", "additionalProperties":false, "required":["action"], "properties":{ "action":{"type":"string","enum":["list","get","create","update","run"],"description":"API operation to perform."}, "trigger_id":{"type":"string","pattern":"^[\\w-]+$","description":"Required for get, update, and run."}, "body":{"type":"object","additionalProperties":{},"propertyNames":{"type":"string"},"description":"Required for create and update; optional for run."} } }`, )
Trigger remains a stub — remote_trigger is an unrelated remote-API client, out of scope for cron scheduling (PRD §5.6/§6).
Functions ¶
Types ¶
type CreateTool ¶ added in v1.8.0
type CreateTool struct {
// contains filtered or unexported fields
}
CreateTool implements CRON_CREATE. Execute is non-blocking: it arms a recurring (or one-shot) timer on the shared alarm Scheduler and returns.
func NewCreate ¶ added in v1.8.0
func NewCreate(s *alarm.Scheduler) *CreateTool
NewCreate constructs a CRON_CREATE tool bound to the shared scheduler — the same instance whose fire callback Enqueues the prompt and wakes the loop.
func (*CreateTool) Description ¶ added in v1.8.0
func (t *CreateTool) Description() string
func (*CreateTool) Execute ¶ added in v1.8.0
func (t *CreateTool) Execute(_ context.Context, logger *slog.Logger, input json.RawMessage) (tools.Result, error)
func (*CreateTool) Name ¶ added in v1.8.0
func (t *CreateTool) Name() string
func (*CreateTool) Schema ¶ added in v1.8.0
func (t *CreateTool) Schema() json.RawMessage
type DeleteTool ¶ added in v1.8.0
type DeleteTool struct {
// contains filtered or unexported fields
}
DeleteTool implements CRON_DELETE.
func NewDelete ¶ added in v1.8.0
func NewDelete(s *alarm.Scheduler) *DeleteTool
NewDelete constructs a CRON_DELETE tool bound to the shared scheduler.
func (*DeleteTool) Description ¶ added in v1.8.0
func (t *DeleteTool) Description() string
func (*DeleteTool) Execute ¶ added in v1.8.0
func (t *DeleteTool) Execute(_ context.Context, logger *slog.Logger, input json.RawMessage) (tools.Result, error)
func (*DeleteTool) Name ¶ added in v1.8.0
func (t *DeleteTool) Name() string
func (*DeleteTool) Schema ¶ added in v1.8.0
func (t *DeleteTool) Schema() json.RawMessage
type Expr ¶ added in v1.8.0
type Expr struct {
// contains filtered or unexported fields
}
Expr is a parsed 5-field cron expression (minute hour day-of-month month day-of-week). It is a plain comparable value safe for concurrent use.
The parser supports *, */n, n, a-b, a-b/n, and comma lists. Day-of-month and day-of-week follow standard cron OR semantics (when both are restricted, a day matches if EITHER matches). No external dependency — the engine is self-contained.
func ParseExpr ¶ added in v1.8.0
ParseExpr parses a standard 5-field cron expression. Returns an error for unsupported syntax (@-aliases, TZ= prefix, 6-field, L/W/#/? specials).
type ListTool ¶ added in v1.8.0
type ListTool struct {
// contains filtered or unexported fields
}
ListTool implements CRON_LIST.
func (*ListTool) Description ¶ added in v1.8.0
func (*ListTool) Schema ¶ added in v1.8.0
func (t *ListTool) Schema() json.RawMessage