Documentation
¶
Index ¶
- Constants
- Variables
- func BuildPluginBlueprint(plugin string, key any, spec plugins.BlueprintSpec) (string, any, error)
- func ClassifyItemsCommand(ctx context.Context, a ClassifyArgs, stdin io.Reader, stdout, stderr io.Writer) int
- func CronCommand(ctx context.Context, h string, a *CronArgs, w io.Writer) (int, error)
- func CronCommandLines(ctx context.Context, h, arg string) ([]string, error)
- func CronList(ctx context.Context, h string, w io.Writer, showAll bool) error
- func CronStatus(ctx context.Context, h string, w io.Writer) error
- func DescribeStoreError(err error) string
- func DispatchExternalWorkerEntry(exit func(code int))
- func DrainDeliveryQueue(ctx context.Context, adapters, loop any) (int, error)
- func EffectiveJobState(job *Job) string
- func ExecuteJobForEvent(ctx context.Context, h, jobRef string, extraPrompt *string) (map[string]any, error)
- func FireOverdueJobs(ctx context.Context, p CronScheduler, adapters, loop any) (int, error)
- func ForgetStores(stores []string)
- func FormatISO(t time.Time) string
- func FreeBytes(path string) (uint64, bool)
- func GetRunningJobIDs() map[string]bool
- func GetWedgedJobIDs(ctx context.Context) map[string]bool
- func HandleSuggestionsCommand(ctx context.Context, args string, origin map[string]any, surface string) (string, error)
- func HasCredentialPlatform(adapters any, owned any) bool
- func IsJobRunnable(job *Job) bool
- func IsTerminalJob(job *Job) bool
- func ListExecutions(ctx context.Context, h, jobID string, limit int) ([]map[string]any, error)
- func MarkRunningJobsInterrupted(ctx context.Context, reason string) []string
- func NormalizeGraceMinutes(value any) (*int, error)
- func NormalizeTimezone(value any) (*string, error)
- func NotifyProviderJobsChanged(h string)
- func NowISO(h string) string
- func OutageCovers(cronDir string, dueAt, grace float64) bool
- func PrimaryProfileRoutesForCurrentHome(ctx context.Context) []*gateway.ProfileRoute
- func ProbeReport(cronDir string) map[string]any
- func ProbeStore(cronDir string) error
- func QueuePath(home string) string
- func RecordWorktreeRepo(ctx context.Context, h, repoRoot string)
- func RegisterEstopCheck(fn func(ctx context.Context, component string, log *slog.Logger) bool)
- func RemoveJob(ctx context.Context, h, ref string) (bool, error)
- func RunCanonicalJob(ctx context.Context, job *Job, extraPrompt *string, cancel CancelSource, ...) (bool, string, string, *string, error)
- func ScanCronPrompt(prompt string) string
- func SchedulerStop(p CronScheduler)
- func SeedCatalogSuggestions(ctx context.Context, add SuggestionAdder, keys []string) ([]*jsonutil.Object, error)
- func SetAgentFactory(f func(ctx context.Context, o AgentOptions) (CronAgent, error))
- func SetCleanupStaleAsyncClients(f func())
- func SetFormatTurnCompletionExplanation(f func(ctx context.Context, reason string, cause, model *string) string)
- func SetGatewayRunnerRef(fn func() GatewayRunner)
- func SetMaxIterationHandoffCheck(f func(result any) bool)
- func SetRequestHardInterrupt(f func(a CronAgent, reason, toolReason string))
- func SetStoreTransitionListener(fn func(event string, record *StoreDegraded))
- func ShutdownParallelPools()
- func StoreKey(home string) string
- func SwapStoreProbe(probe func(cronDir string) error) func(cronDir string) error
- func Truthy(v any) bool
- type AgentOptions
- type AmbiguousJobReferenceError
- type AutomationBlueprint
- type BlueprintCommandResult
- type BlueprintFillError
- type BlueprintSlot
- type CancelRequest
- type CancelSource
- type CatalogEntry
- type Claim
- type ClassifyArgs
- type CombinedCancelEvent
- type CreateJobOptions
- type CronAgent
- type CronArgs
- type CronExecution
- type CronExecutionUnknown
- type CronExpr
- type CronPromptInjectionBlocked
- type CronPromptRestore
- type CronScheduler
- type CronSchedulerRegistrationError
- type CronTickYielded
- type CroniterError
- type DeliveryQueue
- func (q *DeliveryQueue) ClaimNext(ctx context.Context) (map[string]any, error)
- func (q *DeliveryQueue) Drain(ctx context.Context, send DeliverySend, limit int) (int, error)
- func (q *DeliveryQueue) Enqueue(ctx context.Context, executionID string, job *Job, content string, ...) (map[string]any, error)
- func (q *DeliveryQueue) EnqueueAndWait(ctx context.Context, executionID string, job *Job, content string, ...) (*string, error)
- func (q *DeliveryQueue) GetStatus(ctx context.Context, executionID string) (map[string]any, error)
- func (q *DeliveryQueue) RecoverAbandoned(ctx context.Context) (int, error)
- type DeliverySend
- type Dispatch
- type FireClaimOptions
- type FireOptions
- type GatewayRunner
- type ISOTime
- type InProcessCronScheduler
- type Incident
- type IncidentStore
- func (i *IncidentStore) AckIncident(id string) (bool, error)
- func (i *IncidentStore) CloseIncidentsForRecoveredJob(jobID string) (int, error)
- func (i *IncidentStore) GetIncident(id string) (*Incident, error)
- func (i *IncidentStore) ListIncidents(st *string) ([]*Incident, error)
- func (i *IncidentStore) SetIncidentState(id, st string) (bool, error)
- func (i *IncidentStore) UpsertIncident(jobID, errText string, jobName, outputFile *string) (string, bool, error)
- func (i *IncidentStore) UpsertIncidentTyped(jobID, errText string, jobName, failureType, outputFile *string) (string, bool, error)
- type Job
- func CreateJob(ctx context.Context, h string, o CreateJobOptions) (*Job, error)
- func CreateJobWithSchedulerRegistration(ctx context.Context, h string, spec *jsonutil.Object) (*Job, error)
- func GetJob(ctx context.Context, h, jobID string) (*Job, error)
- func ListJobs(ctx context.Context, h string, includeDisabled bool) ([]*Job, error)
- func LoadJobsForHome(ctx context.Context, h string) ([]*Job, error)
- func PauseJob(ctx context.Context, h, ref string, reason *string) (*Job, error)
- func RearmOneshot(ctx context.Context, h, ref string, runAt any) (*Job, error)
- func ResolveJobRef(ctx context.Context, h string, ref string) (*Job, error)
- func ResumeJob(ctx context.Context, h, ref string) (*Job, error)
- func TriggerJob(ctx context.Context, h, ref string) (*Job, error)
- func TriggerJobWithPrompt(ctx context.Context, h, ref, extraPrompt string) (*Job, error)
- func UpdateJob(ctx context.Context, h, jobID string, updates map[string]any) (*Job, error)
- type Ledger
- func (l *Ledger) AdoptClaimed(ctx context.Context, executionID string) (map[string]any, error)
- func (l *Ledger) Cancellable(ctx context.Context, jobID string) (map[string]any, error)
- func (l *Ledger) Create(ctx context.Context, jobID, source string, scheduled *string) (map[string]any, error)
- func (l *Ledger) Finish(ctx context.Context, executionID string, success bool, ...) (map[string]any, error)
- func (l *Ledger) Get(ctx context.Context, executionID string) (map[string]any, error)
- func (l *Ledger) GiveUp(ctx context.Context, executionID, reason string) (bool, error)
- func (l *Ledger) Latest(ctx context.Context, jobID string) (map[string]any, error)
- func (l *Ledger) LatestMany(ctx context.Context, jobIDs []string) (map[string]map[string]any, error)
- func (l *Ledger) List(ctx context.Context, jobID *string, limit int, beforeClaimedAt *string) ([]map[string]any, error)
- func (l *Ledger) Live(ctx context.Context, jobIDs []string) (map[string]map[string]any, error)
- func (l *Ledger) MarkHandoffPending(ctx context.Context, executionID string) (map[string]any, error)
- func (l *Ledger) MarkRunning(ctx context.Context, executionID string) (map[string]any, error)
- func (l *Ledger) OwnerLive(ctx context.Context, executionID, jobID string) (bool, error)
- func (l *Ledger) RecordMissed(ctx context.Context, jobID string, count int, firstInstant *string, ...) (map[string]any, error)
- func (l *Ledger) RecoverInterrupted(ctx context.Context) (int, error)
- func (l *Ledger) RecoverReceipted(ctx context.Context, executionID, jobID string, success bool, ...) (map[string]any, error)
- func (l *Ledger) SetOccurrence(ctx context.Context, executionID string, instant *string) error
- func (l *Ledger) SettleDeliveryOutcome(ctx context.Context, executionID, outcome string) (bool, error)
- func (l *Ledger) SettleUnstarted(ctx context.Context, executionID, jobID, errText string)
- func (l *Ledger) TerminalizeDeadOwner(ctx context.Context, executionID, reason string) (bool, error)
- func (l *Ledger) TouchProgress(ctx context.Context, executionID string) (bool, error)
- type MarkOptions
- type MonitorOutcome
- type MonitorState
- type NoteRejectedError
- type Notepad
- func (n *Notepad) Clear(jobID string) (int64, error)
- func (n *Notepad) Delete(jobID, key string) (bool, error)
- func (n *Notepad) Get(jobID, key string) (*string, error)
- func (n *Notepad) List(jobID string) ([]*jsonutil.Object, error)
- func (n *Notepad) RenderSection(jobID string) string
- func (n *Notepad) Set(jobID, key, value string) (*jsonutil.Object, error)
- type NullString
- type OwnerPair
- type PendingSlot
- type PinRefusedError
- type ProfileHome
- type ProfileSnapshot
- type Repeat
- type RestartWaitCronCounts
- type RetryState
- type RunningJobDetail
- type Schedule
- type SharedRouteAdapters
- type SkillRefRewrite
- type SkillRefRewriteReport
- type Stamp
- type StartOptions
- type Store
- func (s *Store) AcceptSuggestion(ctx context.Context, ref string, origin map[string]any) (*Job, error)
- func (s *Store) AddSuggestion(title, description, source string, jobSpec any, dedupKey string) (*jsonutil.Object, error)
- func (s *Store) CatchUpOccurrenceCount() int
- func (s *Store) ClearResolvedSuggestions() (int, error)
- func (s *Store) ClearTickerError()
- func (s *Store) CronDir() string
- func (s *Store) DismissSuggestion(ref string) (bool, error)
- func (s *Store) GetSuggestion(ref string) (*jsonutil.Object, error)
- func (s *Store) Home() string
- func (s *Store) JobsFile() string
- func (s *Store) ListPendingSuggestions() ([]any, error)
- func (s *Store) LoadJobs(ctx context.Context) ([]*Job, error)
- func (s *Store) LoadSuggestions() ([]any, error)
- func (s *Store) OutputDir() string
- func (s *Store) RecordTickerError(ctx context.Context, message string)
- func (s *Store) RecordTickerHeartbeat(ctx context.Context, success bool)
- func (s *Store) SaveJobOutput(ctx context.Context, jobID, output string) (string, error)
- func (s *Store) SaveJobs(ctx context.Context, jobs []*Job, removedIDs []string, replace bool) error
- func (s *Store) TickerHeartbeatAge() (float64, bool)
- func (s *Store) TickerHeartbeatWriterAlive() bool
- func (s *Store) TickerLastError() (string, bool)
- func (s *Store) TickerSuccessAge() (float64, bool)
- type StoreDegraded
- type SuggestionAdder
- type SupervisedTickerThread
- type Target
- type UnknownCronCommandError
- type ValueError
Constants ¶
const ( // FireClaimTTLSeconds bounds how long an external fire claim blocks another fire FireClaimTTLSeconds = 300 // FireClaimSkewSeconds is the clock skew tolerated between replicas claiming one occurrence FireClaimSkewSeconds = 60 // ClaimTTLInactivityHeadroom multiplies the inactivity timeout into a run claim TTL ClaimTTLInactivityHeadroom = 3 )
const ( // DispatchHoldTickSlackSeconds is the tick spacing a held one shot's grace restarts after DispatchHoldTickSlackSeconds = 60.0 // DispatchHoldMaxExtensionSeconds bounds how long before the hold end a due one shot is extended DispatchHoldMaxExtensionSeconds = 1800.0 )
const ( // MaxTerminalExecutions bounds the terminal rows the ledger keeps MaxTerminalExecutions = 1000 // HandoffAdoptionGraceSeconds is how long a pending worker handoff is fenced from recovery HandoffAdoptionGraceSeconds = 30.0 // LiveOwnerStaleClaimFloorSeconds floors the stale bound for a claim whose owner is alive LiveOwnerStaleClaimFloorSeconds = 7200.0 )
const ( MinGraceMinutes = 0 MaxGraceMinutes = 24 * 60 )
Bounds of the per job catch up override in minutes, zero meaning never catch up
const ( // StaleCronMatch means the stored instant is an occurrence of the current expression StaleCronMatch = "match" // StaleCronTimezoneMigration means only the stored offset representation changed StaleCronTimezoneMigration = "timezone_migration" // StaleCronExprEdit means a hand edit changed the expression under a stored instant StaleCronExprEdit = "expr_edit" )
const ( BotChatPlatform = "bot-chat" BotChatPolicyPlatform = "tui" )
Bot Chat pseudo platform token and the display policy platform its warnings follow
const ( SilentMarker = "[SILENT]" CronFailureMarker = "[CRON_FAILURE]" )
const ( // BlockedConfigMarker prefixes a preflight refusal that is delivered as a failure notice BlockedConfigMarker = "[blocked_config]" // BlockedConfigSilentMarker prefixes a preflight refusal that is recorded without a notice BlockedConfigSilentMarker = "[blocked_config:silent]" )
const DefaultDeliveryWaitTimeoutSeconds = 300.0
DefaultDeliveryWaitTimeoutSeconds is how long a worker waits for a gateway outcome
const (
// Hidden first argument that routes a binary to one restart safe cron payload
ExternalWorkerEntry = "__icebath_cron_external_worker__"
)
const LowFreeBytes = 100 << 20
LowFreeBytes is the free space below which doctor warns before the store starts failing
const MaxPendingSuggestions = 5
MaxPendingSuggestions caps the pending list so new suggestions are dropped once it is full
const ProbeIntervalSeconds = 60.0
ProbeIntervalSeconds spaces dispatch write retries and idle re probes of a degraded store
const (
// QuotaHoldSlackSeconds pads the provider window so the parked fire lands after it reopens
QuotaHoldSlackSeconds = 60
)
const (
// TickerIntervalSeconds is the scheduler loop period
TickerIntervalSeconds = 60
)
Variables ¶
var ( NotepadMaxValueBytes = 16 * 1024 NotepadMaxKeyChars = 128 NotepadMaxJobTotalBytes = 64 * 1024 )
Notepad size caps, package vars so tests can shrink them
var Catalog = []CatalogEntry{ { Key: "catalog:daily-briefing", Title: "Daily briefing", Description: "Every morning at 8am, a short briefing: today's calendar, " + "weather, and anything urgent waiting on you.", JobSpec: [][2]string{ {"prompt", "Produce a concise morning briefing for the user: today's " + "calendar events, the local weather, and any urgent items " + "(unread important email, due tasks). Keep it short and " + "scannable. If you have no connected data sources, give a brief " + "general good-morning with the date and offer to connect " + "calendar/email."}, {"schedule", "0 8 * * *"}, {"name", "Daily briefing"}, {"deliver", "origin"}, }, }, { Key: "catalog:important-mail-monitor", Title: "Important-mail monitor", Description: "Check your inbox periodically and ping you ONLY about mail " + "that actually needs attention — never the newsletters.", JobSpec: [][2]string{ {"prompt", "Check the user's inbox for new messages since the last run. " + "For each candidate, judge urgency against this rule: surface " + "only mail that needs a reply today, is from a manager/family " + "member, or mentions a deadline. Pipe candidates through the " + "urgency classifier (write them as a JSON list and pipe it into " + "`icebath cron classify --threshold 7 --criteria \"...\"`; it " + "prints only the urgent items and prints nothing when none " + "qualifies) and deliver ONLY what it returns. If nothing " + "clears the bar, respond with [SILENT] so the user is not " + "pinged. Requires a connected mail source; if none is " + "configured, explain how to connect one and then stop."}, {"schedule", "every 30m"}, {"name", "Important-mail monitor"}, {"deliver", "origin"}, }, }, { Key: "catalog:weekly-review", Title: "Weekly review", Description: "Every Sunday evening, a recap of the week: what got done, " + "what's still open, and what's coming up next week.", JobSpec: [][2]string{ {"prompt", "Produce a weekly review for the user: summarize what was " + "accomplished this week, list still-open items, and preview " + "next week's calendar. Pull from whatever sources are connected " + "(calendar, task tools, recent conversations). Keep it tight."}, {"schedule", "0 18 * * 0"}, {"name", "Weekly review"}, {"deliver", "origin"}, }, }, { Key: "catalog:standup-reminder", Title: "Workday start reminder", Description: "A weekday nudge at 9am with your day's agenda and top " + "priorities, so you start focused.", JobSpec: [][2]string{ {"prompt", "Give the user a brief weekday start-of-day nudge: their " + "calendar for today and the 1-3 highest-priority things to " + "focus on, inferred from recent context and any task tools. " + "Encouraging, short, one message."}, {"schedule", "0 9 * * 1-5"}, {"name", "Workday start reminder"}, {"deliver", "origin"}, }, }, }
Built in automations offered out of the box, none of them scheduled until accepted
var FirerFinishedStates = map[string]bool{"completed": true, "failed": true, "cancelled": true}
FirerFinishedStates are outcomes the attempt's own firer booked, final for every recovery path
var IncidentStates = []string{"detected", "alerted", "resolved", "closed"}
IncidentStates lists the lifecycle states, closed being the only terminal one
var JobDefinitionFields = []string{
"name", "prompt", "skills", "skill", "model", "provider", "base_url",
"script", "no_agent", "monitor_script", "monitor_url", "context_from",
"schedule", "schedule_display", "deliver", "origin", "enabled_toolsets",
"workdir", "attach_to_session", "reasoning_effort", "failure_deliver",
"timezone", "grace_minutes", "catch_up",
}
JobDefinitionFields are the authored keys a foreign store refreshes, every other key is scheduler owned
var MaxTerminalDeliveries = 1000
MaxTerminalDeliveries bounds the terminal rows kept before older ones become tombstones
var RegisterWorkerConfigHooks func(ctx context.Context, failureMessage string, level slog.Level)
Registers the owning profile config hooks gateway startup registers, assigned by the binary at startup
var SetupWorkerLogging func(h, mode string) error
Installs the persistent log handler of a home for a mode, assigned by the binary at startup
var UnreachableRetryDelaysSeconds = []int{300, 900, 1800}
UnreachableRetryDelaysSeconds is the bounded re run ladder for fires that never reached the model
var WorkerProcessBoot func()
Process boot runs at import, assigned by the binary and free to relaunch the worker
Functions ¶
func BuildPluginBlueprint ¶
Validated plugin blueprint keyed plugin colon key, the BuildPluginBlueprint service of the plugin host
func ClassifyItemsCommand ¶
func ClassifyItemsCommand(ctx context.Context, a ClassifyArgs, stdin io.Reader, stdout, stderr io.Writer) int
ClassifyItemsCommand scores the candidate items on stdin or in the input file in one auxiliary monitor call and prints only those at or above the threshold, returning the exit status: empty stdout is the silence a cron job delivers nothing for, and a failed scoring call is non-zero so the job reports it
func CronCommand ¶
Dispatches one icebath cron subcommand for the home, returning its exit status
func CronCommandLines ¶
Output lines of the slash cron command in the cron store of home h
func CronStatus ¶
Writes the cron scheduler status of the home to w
func DescribeStoreError ¶
DescribeStoreError renders a store failure as its errno text, its plain text without an errno
func DispatchExternalWorkerEntry ¶
func DispatchExternalWorkerEntry(exit func(code int))
Boots a marked worker's dependencies, then runs one handed off payload when argv carries the entry
func DrainDeliveryQueue ¶
Sends the queued worker results of the ambient home through the live adapters, returning how many went out
func EffectiveJobState ¶
Operator facing state of a job, never paused while enabled and terminal states kept
func ExecuteJobForEvent ¶
func ExecuteJobForEvent(ctx context.Context, h, jobRef string, extraPrompt *string) (map[string]any, error)
ExecuteJobForEvent fires an existing job for an external event through the manual run body
func FireOverdueJobs ¶
Fires jobs whose external fire never arrived once the misfire grace passed, returning how many dispatched
func ForgetStores ¶
func ForgetStores(stores []string)
ForgetStores drops live and just ended outages of the given store keys
func FormatISO ¶
FormatISO renders t as RFC 3339 text with six fractional digits and Z for UTC, the form every stamp the store writes uses
func FreeBytes ¶
FreeBytes is the space a writer can still use under path, root counting the reserved blocks
func GetRunningJobIDs ¶
Snapshot of the executing job ids the gateway drain and work counts read
func GetWedgedJobIDs ¶
Job ids of the home in ctx in flight longer than their stale allowance
func HandleSuggestionsCommand ¶
func HandleSuggestionsCommand(ctx context.Context, args string, origin map[string]any, surface string) (string, error)
Dispatches a /suggestions invocation for the CLI or gateway, origin nil meaning the session env's chat
func HasCredentialPlatform ¶
True when the profile has a bot of its own, a local only adapter map holds no platform credential
func IsJobRunnable ¶
Whether the scheduler may fire the job, enabled and free of pause markers
func IsTerminalJob ¶
Whether the record sits in a terminal scheduler state
func ListExecutions ¶
Durable run attempts of the home's jobs, newest first, one job's when jobID is set, at most limit rows
func MarkRunningJobsInterrupted ¶
Marks every in flight run interrupted with the reason and returns the job ids it marked
func NormalizeGraceMinutes ¶
NormalizeGraceMinutes validates a grace override, nil meaning use the computed window
func NormalizeTimezone ¶
NormalizeTimezone validates a job timezone and returns its IANA key, nil meaning inherit the profile
func NotifyProviderJobsChanged ¶
func NotifyProviderJobsChanged(h string)
Notifies the active scheduler provider that a home's jobs changed
func OutageCovers ¶
OutageCovers reports whether a run due at dueAt within grace fell inside the live or just ended outage
func PrimaryProfileRoutesForCurrentHome ¶
func PrimaryProfileRoutesForCurrentHome(ctx context.Context) []*gateway.ProfileRoute
Enabled primary gateway profile routes that target the served profile, none for the primary home
func ProbeReport ¶
ProbeReport describes why the store under cronDir refuses writes, nil when the probe passes
func ProbeStore ¶
ProbeStore proves the store accepts a write as large as jobs.json, returning the OSError a save would hit
func RecordWorktreeRepo ¶
Records a repo with icebath made worktrees, dropping vanished repos and logging any failure at debug
func RegisterEstopCheck ¶
Installs the estop check every cron entry point consults before dispatching
func RunCanonicalJob ¶
func RunCanonicalJob(ctx context.Context, job *Job, extraPrompt *string, cancel CancelSource, executionID *string) (bool, string, string, *string, error)
Runs the job through the home owner and returns success, output document, final answer and error text
func ScanCronPrompt ¶
Prompt injection finding of a cron prompt, empty when clean
func SchedulerStop ¶
func SchedulerStop(p CronScheduler)
Eager teardown when the provider offers one, the base class no op otherwise
func SeedCatalogSuggestions ¶
func SeedCatalogSuggestions(ctx context.Context, add SuggestionAdder, keys []string) ([]*jsonutil.Object, error)
Registers catalog entries as pending suggestions, keys restricting the set, returning the records created
func SetAgentFactory ¶
func SetAgentFactory(f func(ctx context.Context, o AgentOptions) (CronAgent, error))
Installs the run_agent AIAgent constructor cron runs build their agent with
func SetCleanupStaleAsyncClients ¶
func SetCleanupStaleAsyncClients(f func())
Installs agent.auxiliary_client cleanup_stale_async_clients run after each agent teardown
func SetFormatTurnCompletionExplanation ¶
func SetFormatTurnCompletionExplanation(f func(ctx context.Context, reason string, cause, model *string) string)
Installs AIAgent._format_turn_completion_explanation used to spot a boilerplate turn summary
func SetGatewayRunnerRef ¶
func SetGatewayRunnerRef(fn func() GatewayRunner)
SetGatewayRunnerRef installs the accessor of the running gateway in this process
func SetMaxIterationHandoffCheck ¶
Installs agent.turn_failure_copy is_max_iteration_handoff that tells a budget handoff from a failure
func SetRequestHardInterrupt ¶
Installs agent.interrupt_compat request_hard_interrupt for the inactivity watchdog
func SetStoreTransitionListener ¶
func SetStoreTransitionListener(fn func(event string, record *StoreDegraded))
SetStoreTransitionListener installs the receiver of unwritable and recovered transitions, nil removes it
func ShutdownParallelPools ¶
func ShutdownParallelPools()
ShutdownParallelPools is the atexit teardown of every parallel pool for the binary's exit path
func SwapStoreProbe ¶
Replaces the write probe of the cron store and returns the one it replaced
Types ¶
type AgentOptions ¶
type AgentOptions struct {
Model string
Runtime *provider.Runtime
MaxIterations int
ReasoningConfig map[string]any
PrefillMessages []any
FallbackModel []map[string]any
CredentialPool *provider.Pool
ProvidersAllowed any
ProvidersIgnored any
ProvidersOrder any
ProviderSort any
OpenRouterMinCodingScore any
EnabledToolsets []string
DisabledToolsets []string
QuietMode bool
SkipContextFiles bool
LoadSoulIdentity bool
SkipMemory bool
SkipBackgroundReview bool
Platform string
SessionID string
SessionDB *state.DB
Env *tools.Env
Workdir string
}
AIAgent keyword arguments the cron run path constructs its agent with
type AmbiguousJobReferenceError ¶
AmbiguousJobReferenceError reports a job name matching more than one job
func (*AmbiguousJobReferenceError) Error ¶
func (e *AmbiguousJobReferenceError) Error() string
type AutomationBlueprint ¶
type AutomationBlueprint struct {
Key string
Title string
Description string
Category string
ScheduleTemplate string
PromptTemplate string
Slots []BlueprintSlot
DeliverDefault string
Skills []string
Tags []string
Plugin string
}
AutomationBlueprint is a parameterized automation, Plugin naming its registering plugin
type BlueprintCommandResult ¶
BlueprintCommandResult is the reply text of one blueprint command and the seed for a guided agent turn
func HandleBlueprintCommand ¶
func HandleBlueprintCommand(ctx context.Context, h, args string, origin map[string]any, surface string) (BlueprintCommandResult, error)
Lists, matches, seeds a guided setup or fills and schedules a blueprint for the home
type BlueprintFillError ¶
type BlueprintFillError struct{ Msg string }
Reports slot values that fail validation
func (*BlueprintFillError) Error ¶
func (e *BlueprintFillError) Error() string
type BlueprintSlot ¶
type BlueprintSlot struct {
Name string
Type string
Label string
Default any
Options []any
Optional bool
Help string
Strict bool
}
BlueprintSlot is one fillable field on a blueprint, Options a closed set only when Strict
func NewBlueprintSlot ¶
func NewBlueprintSlot(s BlueprintSlot) (BlueprintSlot, error)
Slot with its type checked against the renderer slot types
type CancelRequest ¶
type CancelRequest struct {
// contains filtered or unexported fields
}
CancelRequest views one execution's cancel marker, set only by the requesting process
func (*CancelRequest) Reason ¶
func (r *CancelRequest) Reason() string
Recorded reason of the marker, the default when it is empty or unreadable
func (*CancelRequest) Set ¶
func (r *CancelRequest) Set()
Refuses a local set, the requesting process owns this source
type CancelSource ¶
CancelSource is a cancellation flag a run polls, with the cause it reports when set
type CatalogEntry ¶
Curated starter automation offered as a suggestion with its stable dedup key and create_job spec
type Claim ¶
type Claim struct {
At string `json:"at,omitempty"`
By string `json:"by,omitempty"`
Outage bool `json:"outage,omitempty"`
ExtraSlot string `json:"extra_slot,omitempty"`
}
Claim marks ownership of one fire or one shot run by a process
type ClassifyArgs ¶
Flags of icebath cron classify
type CombinedCancelEvent ¶
type CombinedCancelEvent struct {
// contains filtered or unexported fields
}
CombinedCancelEvent is set when any source is set and sets every source
func NewCombinedCancelEvent ¶
func NewCombinedCancelEvent(events ...CancelSource) *CombinedCancelEvent
Combines the non nil sources
func (*CombinedCancelEvent) Reason ¶
func (c *CombinedCancelEvent) Reason() string
Cause from the first set source, empty when none is set
type CreateJobOptions ¶
type CreateJobOptions struct {
Prompt *string
Schedule string
Name *string
Repeat any
Deliver *string
Origin map[string]any
Skill *string
Skills any
Model any
Provider any
BaseURL any
Script any
ContextFrom any
EnabledToolsets any
Workdir any
NoAgent bool
AttachToSession any
MonitorScript any
MonitorURL any
ReasoningEffort any
FailureDeliver any
CatchUp any
Paused bool
PausedReason *string
Pinned bool
Interpreter any
Timezone any
GraceMinutes any
}
CreateJobOptions carries every create_job argument
type CronAgent ¶
type CronAgent interface {
RunConversation(ctx context.Context, prompt, taskID string) (map[string]any, error)
GetActivitySummary() map[string]any
Interrupt(message string)
SessionID() string
SessionAPICalls() int
SetEndSessionOnClose(v bool)
Close() error
}
Live agent of one cron run, implemented by the agent package behind the registered factory
type CronArgs ¶
type CronArgs struct {
Command, JobID, IncidentAction, IncidentID, NotepadAction string
All, ClearSkills, Paused, RunNow bool
Limit *int
State, Key, Value, Schedule, Prompt, Skill, PausedReason *string
RunAt, Reason *string
Skills, AddSkills, RemoveSkills []string
NoAgent *bool
Name, Deliver, FailureDeliver, Repeat, Script, Workdir any
Model, ModelProvider, Pinned, MonitorScript, MonitorURL any
Continuity, ReasoningEffort, Interpreter, Timezone any
GraceMinutes, CatchUp any
}
CronArgs is the parsed icebath cron argument namespace, any fields carrying the parser value or nil
type CronExecution ¶
type CronExecution struct {
JobID string
JobName string
ExecutionID string
Source string
ScheduledInstant *string
StartedAt *string
Profile string
}
CronExecution identifies the scheduled occurrence the current code runs inside
func CurrentCronExecution ¶
func CurrentCronExecution(ctx context.Context) *CronExecution
CurrentCronExecution is the occurrence bound to ctx, nil outside a fire and inside delegated children
type CronExecutionUnknown ¶
type CronExecutionUnknown struct{ Msg string }
The owner may have accepted this fire, so it is never booked as failed or refired
func (*CronExecutionUnknown) Error ¶
func (e *CronExecutionUnknown) Error() string
func (*CronExecutionUnknown) ErrorKind ¶
func (e *CronExecutionUnknown) ErrorKind() string
Python class name of the unverified admission error
type CronExpr ¶
type CronExpr struct {
// contains filtered or unexported fields
}
CronExpr is an expression expanded once by the croniter rules, iterated from a wall clock or an instant
func ParseCron ¶
ParseCron expands an expression the way croniter constructs an iterator, failing with its message
func (*CronExpr) Next ¶
Next returns the first match after the wall clock of t, read as a naive datetime and returned in UTC
type CronPromptInjectionBlocked ¶
type CronPromptInjectionBlocked struct{ Msg string }
CronPromptInjectionBlocked reports an assembled prompt that tripped the injection scanner at run time
func (*CronPromptInjectionBlocked) Error ¶
func (e *CronPromptInjectionBlocked) Error() string
type CronPromptRestore ¶
type CronPromptRestore struct {
Restored bool
Prompts int
JobIDs []string
SnapshotID string
Profile string
}
CronPromptRestore reports the degraded prompts restored from one pre update snapshot
func RestoreCronPromptFieldsAllProfiles ¶
func RestoreCronPromptFieldsAllProfiles(ctx context.Context, snapshots []ProfileSnapshot, invokingHome string) []CronPromptRestore
Restores degraded prompts in every sibling profile from its own pre update snapshot
func RestoreCronPromptFieldsIfDegraded ¶
func RestoreCronPromptFieldsIfDegraded(ctx context.Context, h, snapshotID string) (*CronPromptRestore, error)
Restores job prompts an update replaced with the job name from the pre update snapshot, nil when none
type CronScheduler ¶
type CronScheduler interface {
Name() string
Start(ctx context.Context, stop <-chan struct{}, o StartOptions)
}
Decides when a due cron job fires, only the name and start are required
func ResolveCronScheduler ¶
func ResolveCronScheduler(h string) CronScheduler
Active scheduler provider of a home's store
func SchedulerForProfileMode ¶
func SchedulerForProfileMode(h string, p CronScheduler, multiplexProfiles bool) CronScheduler
Built in ticker in place of an external provider once multiplexing, the provider unchanged otherwise
type CronSchedulerRegistrationError ¶
CronSchedulerRegistrationError reports a saved job whose first external trigger was not registered
func (*CronSchedulerRegistrationError) Error ¶
func (e *CronSchedulerRegistrationError) Error() string
func (*CronSchedulerRegistrationError) ToDict ¶
func (e *CronSchedulerRegistrationError) ToDict() *jsonutil.Object
Public partial failure contract without provider details
func (*CronSchedulerRegistrationError) Unwrap ¶
func (e *CronSchedulerRegistrationError) Unwrap() error
func (*CronSchedulerRegistrationError) UserMessage ¶
func (e *CronSchedulerRegistrationError) UserMessage() string
Chat and CLI wording of the partial failure without the exception class
type CronTickYielded ¶
CronTickYielded reports a stale code ticker that yielded its tick to a fresh gateway
func (*CronTickYielded) Error ¶
func (e *CronTickYielded) Error() string
type CroniterError ¶
type CroniterError struct{ Msg string }
CroniterError reports why a cron expression cannot be parsed
func (*CroniterError) Error ¶
func (e *CroniterError) Error() string
type DeliveryQueue ¶
type DeliveryQueue struct {
// contains filtered or unexported fields
}
DeliveryQueue is the profile local durable handoff of cron sends to a live gateway
func DeliveryQueueOf ¶
func DeliveryQueueOf(home string) *DeliveryQueue
Durable delivery queue of a home, the queue file the test override points elsewhere
func (*DeliveryQueue) ClaimNext ¶
Atomically claims the oldest pending send for this process, the job decoded under the job key
func (*DeliveryQueue) Drain ¶
func (q *DeliveryQueue) Drain(ctx context.Context, send DeliverySend, limit int) (int, error)
Delivers up to limit pending rows through send, terminalizing every claimed row
func (*DeliveryQueue) Enqueue ¶
func (q *DeliveryQueue) Enqueue(ctx context.Context, executionID string, job *Job, content string, forFailure bool) (map[string]any, error)
Persists one idempotent delivery request before the worker waits
func (*DeliveryQueue) EnqueueAndWait ¶
func (q *DeliveryQueue) EnqueueAndWait(ctx context.Context, executionID string, job *Job, content string, forFailure bool, timeout *float64) (*string, error)
Queues a delivery and waits for a gateway's terminal at most once outcome, nil when delivered
func (*DeliveryQueue) RecoverAbandoned ¶
func (q *DeliveryQueue) RecoverAbandoned(ctx context.Context) (int, error)
Fences dead delivery owners as unknown without replaying, writing each outcome back
type DeliverySend ¶
DeliverySend performs one queued send, returning the refusal text or nil when delivered
type Dispatch ¶
type Dispatch struct {
ScheduledAt string `json:"scheduled_at"`
DispatchedAt string `json:"dispatched_at"`
LatenessSeconds float64 `json:"lateness_seconds"`
Kind string `json:"kind"`
}
Dispatch records the scheduled versus actual timing of the last recurring dispatch
func (Dispatch) MarshalJSON ¶
Encodes the dispatch stamp in its stored key order with lateness written as a float
type FireClaimOptions ¶
type FireClaimOptions struct {
// Claim age past which an existing claim is stale, the fire claim TTL when nil
TTLSeconds *float64
Force bool
Manual bool
}
FireClaimOptions tunes one external fire claim
type FireOptions ¶
Transport of one fire, the adapters and loop fire_claimed takes
type GatewayRunner ¶
type GatewayRunner interface {
AdaptersForProfile(profile *string) *orderedutil.Map[gateway.Platform, gateway.PlatformAdapter]
GatewayLoop() gateway.EventLoop
}
GatewayRunner is the live gateway a manual run borrows adapters and the event loop from
type InProcessCronScheduler ¶
type InProcessCronScheduler struct{}
Default in process ticker whose start blocks until the stop channel closes
func (*InProcessCronScheduler) Name ¶
func (*InProcessCronScheduler) Name() string
func (*InProcessCronScheduler) Start ¶
func (p *InProcessCronScheduler) Start(ctx context.Context, stop <-chan struct{}, o StartOptions)
Ticks the process home every interval until stopped, recording heartbeat, error and backoff
type Incident ¶
type Incident struct {
ID string
JobID string
ErrorSig string
State string
FailureType string
FirstSeenAt string
LastSeenAt string
AckedAt *string
AlertedAt *string
ClosedAt *string
Error string
OutputFile *string
}
Incident is one cron_incidents row
type IncidentStore ¶
type IncidentStore struct {
// contains filtered or unexported fields
}
IncidentStore is the per home incident table living in the executions database
func (*IncidentStore) AckIncident ¶
func (i *IncidentStore) AckIncident(id string) (bool, error)
Closes an incident on operator acknowledgement, false when missing or already closed
func (*IncidentStore) CloseIncidentsForRecoveredJob ¶
func (i *IncidentStore) CloseIncidentsForRecoveredJob(jobID string) (int, error)
Resolves every open incident of a job after a clean run and returns how many changed
func (*IncidentStore) GetIncident ¶
func (i *IncidentStore) GetIncident(id string) (*Incident, error)
One incident by id, nil when absent
func (*IncidentStore) ListIncidents ¶
func (i *IncidentStore) ListIncidents(st *string) ([]*Incident, error)
Incidents newest activity instant first, optionally filtered by state
func (*IncidentStore) SetIncidentState ¶
func (i *IncidentStore) SetIncidentState(id, st string) (bool, error)
Moves an incident to a state, alerted always restamping alerted_at, closed being terminal
func (*IncidentStore) UpsertIncident ¶
func (i *IncidentStore) UpsertIncident(jobID, errText string, jobName, outputFile *string) (string, bool, error)
Records or refreshes the incident of a job and error, reopening a resolved one
func (*IncidentStore) UpsertIncidentTyped ¶
func (i *IncidentStore) UpsertIncidentTyped(jobID, errText string, jobName, failureType, outputFile *string) (string, bool, error)
Upsert with an explicit failure type, classified from the error text when nil or empty
type Job ¶
type Job struct {
ID string
Name string
Prompt string
Skills []string
Skill *string
Model *string
Provider *string
BaseURL *string
Script *string
NoAgent bool
MonitorScript *string
MonitorURL *string
MonitorState *MonitorState
ContextFrom []string
Schedule *Schedule
ScheduleDisplay string
Repeat *Repeat
Enabled bool
State string
PausedAt *string
PausedReason *string
CreatedAt string
NextRunAt *string
LastRunAt *string
LastStatus *string
LastError *string
LastDeliveryError *string
LastDeliveryUnverified []string
LastFailure *Stamp
FailureStreak int
Deliver *string
Origin map[string]any
EnabledToolsets []string
Workdir *string
// Keys persisted only when explicitly set
AttachToSession *bool
ReasoningEffort *string
FailureDeliver *string
Interpreter *string
Timezone *string
GraceMinutes *int
CatchUp *bool
FireClaim *Claim
RunClaim *Claim
PendingSlot *PendingSlot
ManualRunAt *string
ManualRunRestoreAt *NullString
ManualRunPrompt *string
LastDispatch *Dispatch
LastFireError *Stamp
PreflightAlerted bool
QuotaHoldUntil *string
QuotaHoldCronExpr *string
UnreachableRetry *RetryState
CanonicalCompletions []string
LastDeliveryQueued any
// Keys this package does not know, preserved verbatim
Extra map[string]json.RawMessage
// Read views attached by listings and the due scan, never persisted
LatestExecution map[string]any
LiveExecution map[string]any
ScheduledInstant *string
ExecutionID *string
// contains filtered or unexported fields
}
Job is one stored cron job record
func CreateJobWithSchedulerRegistration ¶
func CreateJobWithSchedulerRegistration(ctx context.Context, h string, spec *jsonutil.Object) (*Job, error)
Creates a job and registers it with the active scheduler provider
func LoadJobsForHome ¶
Every job of the cron store under the home in load order, what the update drain report lists
func RearmOneshot ¶
Re-arms a completed one shot of the home at runAt, nil when nothing matches
func ResolveJobRef ¶
Job of a reference in the cron store of h, the ambient home when h is empty
func TriggerJob ¶
Schedules a job of the home for the next tick by id or name, nil when nothing matches
func TriggerJobWithPrompt ¶
Triggers a job now with an extra prompt appended to this run only
func (*Job) MarshalJSON ¶
func (*Job) UnmarshalJSON ¶
type Ledger ¶
type Ledger struct {
// contains filtered or unexported fields
}
Ledger is the per home executions database recording every claimed attempt
func (*Ledger) AdoptClaimed ¶
Transfers a pending handoff to this worker process and starts it, nil for every loser
func (*Ledger) Cancellable ¶
Job's newest claimed or running attempt under a live owner even when a newer row exists
func (*Ledger) Create ¶
func (l *Ledger) Create(ctx context.Context, jobID, source string, scheduled *string) (map[string]any, error)
Persists a claimed attempt before executor or provider dispatch
func (*Ledger) Finish ¶
func (l *Ledger) Finish(ctx context.Context, executionID string, success bool, errText, deliveryOutcome *string, cancelled bool) (map[string]any, error)
Writes the terminal result of an attempt this process owns, nil when it is not ours or already terminal
func (*Ledger) GiveUp ¶
Records this process's own in flight attempt unknown when the firer gives up on it
func (*Ledger) LatestMany ¶
func (l *Ledger) LatestMany(ctx context.Context, jobIDs []string) (map[string]map[string]any, error)
Latest execution of each job in one query
func (*Ledger) List ¶
func (l *Ledger) List(ctx context.Context, jobID *string, limit int, beforeClaimedAt *string) ([]map[string]any, error)
Newest first execution history with a claimed_at cursor, limit clamped to 1..500
func (*Ledger) MarkHandoffPending ¶
func (l *Ledger) MarkHandoffPending(ctx context.Context, executionID string) (map[string]any, error)
Fences restart recovery while an external worker adopts the claim
func (*Ledger) MarkRunning ¶
Moves one claimed attempt of this process to running exactly once
func (*Ledger) OwnerLive ¶
Attempt's own firer can still finish it, so receipt recovery must not act for it
func (*Ledger) RecordMissed ¶
func (l *Ledger) RecordMissed(ctx context.Context, jobID string, count int, firstInstant *string, detail string) (map[string]any, error)
Books skipped occurrences as one terminal missed row naming the count and the earliest slot
func (*Ledger) RecoverInterrupted ¶
Marks attempts of dead owners and wedged live owners unknown without scheduling retries
func (*Ledger) RecoverReceipted ¶
func (l *Ledger) RecoverReceipted(ctx context.Context, executionID, jobID string, success bool, errText, deliveryOutcome *string) (map[string]any, error)
Settles a verified receipt after owner loss, nil when terminal or its firer is still live
func (*Ledger) SetOccurrence ¶
Binds the store claimed occurrence before a provider hands the attempt to a worker
func (*Ledger) SettleDeliveryOutcome ¶
func (l *Ledger) SettleDeliveryOutcome(ctx context.Context, executionID, outcome string) (bool, error)
Replaces a terminal attempt's queued delivery outcome with the drain's real one
func (*Ledger) SettleUnstarted ¶
Closes the receipt of a run that never started, logging a ledger failure instead of raising it
type MarkOptions ¶
type MarkOptions struct {
Error *string
DeliveryError *string
Status *string
ExpectedFireOwner *string
ExecutionID *string
ModelUnreachable bool
LadderRung bool
QuotaHoldSeconds float64
RecoverConsumedFire bool
}
MarkOptions carries the optional outcome fields of one finished run
type MonitorOutcome ¶
type MonitorOutcome struct {
OK bool
Changed bool
FirstRun bool
ContextBlock *string
Error *string
}
MonitorOutcome is the result of one monitor source evaluation
type MonitorState ¶
type MonitorState struct {
LastOutputHash string `json:"last_output_hash,omitempty"`
LastChangedAt string `json:"last_changed_at,omitempty"`
}
MonitorState is the last observed monitor output hash
type NoteRejectedError ¶
type NoteRejectedError struct{ Msg string }
NoteRejectedError is a notepad write refused for an empty field or a size cap
func (*NoteRejectedError) Error ¶
func (e *NoteRejectedError) Error() string
type Notepad ¶
type Notepad struct {
// contains filtered or unexported fields
}
Notepad is one profile home's per job durable key value store next to the executions ledger
func (*Notepad) Clear ¶
Deletes every key of one job and returns the row count, creating no database when none exists yet
func (*Notepad) RenderSection ¶
Prompt section listing a job's notes, empty for an empty or unreadable notepad
type NullString ¶
NullString is a key that may be present with a null value
func (NullString) MarshalJSON ¶
func (n NullString) MarshalJSON() ([]byte, error)
func (*NullString) UnmarshalJSON ¶
func (n *NullString) UnmarshalJSON(data []byte) error
type OwnerPair ¶
OwnerPair names one execution by job id and fire owner for a restricted shutdown mark
type PendingSlot ¶
type PendingSlot struct {
ScheduledAt string `json:"scheduled_at"`
At string `json:"at"`
By string `json:"by"`
}
PendingSlot is a recurring occurrence taken off the schedule but not yet claimed
type PinRefusedError ¶
type PinRefusedError struct {
Code string
// contains filtered or unexported fields
}
Pin refusal while the config backend cannot serve the profile, unwrapping to the outage
func (*PinRefusedError) Error ¶
func (e *PinRefusedError) Error() string
func (*PinRefusedError) Unwrap ¶
func (e *PinRefusedError) Unwrap() error
type ProfileHome ¶
One profile a multiplex ticker serves, the name nil for a bare home entry
type ProfileSnapshot ¶
type ProfileSnapshot struct {
Name, SnapshotID string
}
ProfileSnapshot names the pre update snapshot taken for one profile
type RestartWaitCronCounts ¶
In flight cron runs split into awaitable, wedged and restart safe for the gateway restart wait
func GetRestartWaitCronCounts ¶
func GetRestartWaitCronCounts(ctx context.Context) RestartWaitCronCounts
Disjoint per run split of the in flight cron runs the restart wait holds for, skips and leaves running
type RetryState ¶
type RetryState struct {
Attempt int `json:"attempt"`
At string `json:"at"`
Expr *string `json:"expr"`
}
RetryState is the unreachable model re run ladder position
type RunningJobDetail ¶
RunningJobDetail describes one in flight run for the drain report
func GetRunningJobDetails ¶
func GetRunningJobDetails() []RunningJobDetail
Per in flight run its job id, elapsed seconds, external worker pid and restart safety
type Schedule ¶
type Schedule struct {
Kind string
Expr string
Minutes int
// Minutes key present with a number, so zero minutes stays distinct from absent
HasMinutes bool
RunAt string
Display string
// Legacy or hand edited keys such as value
Extra map[string]json.RawMessage
// Text of a schedule that was not an object on disk
Raw string
}
Schedule is the parsed schedule a job fires on
func ParseSchedule ¶
Schedule record a schedule string parses to under the cron settings of the home, cron/jobs.py parse_schedule
func (*Schedule) IsRecurring ¶
Reports whether the schedule is a cron or interval schedule
func (Schedule) MarshalJSON ¶
func (*Schedule) UnmarshalJSON ¶
type SharedRouteAdapters ¶
type SharedRouteAdapters struct {
// contains filtered or unexported fields
}
Read only adapter map of a credentialless satellite, resolving a primary adapter only for a route exact target
func NewSharedRouteAdapters ¶
func NewSharedRouteAdapters(adapters any, routes []*gateway.ProfileRoute) *SharedRouteAdapters
Read only adapter map of a credentialless satellite over the primary's adapters and its routes
func (*SharedRouteAdapters) Get ¶
func (a *SharedRouteAdapters) Get(ctx context.Context, platform string, target map[string]any, def any) any
Primary adapter for the platform when a target exact route accepts the target, else the default
func (*SharedRouteAdapters) Len ¶
func (a *SharedRouteAdapters) Len() int
Primary adapters a route can lend, zero while there is no route, so a view that can lend nothing reads as empty
type SkillRefRewrite ¶
type SkillRefRewrite struct {
JobID string
JobName string
Before []string
After []string
Mapped *jsonutil.Object
Dropped []string
}
SkillRefRewrite is one job whose skill references a curator pass rewrote
type SkillRefRewriteReport ¶
type SkillRefRewriteReport struct {
Rewrites []SkillRefRewrite
JobsUpdated int
JobsScanned int
}
SkillRefRewriteReport summarizes a curator skill reference rewrite
type StartOptions ¶
type StartOptions struct {
Adapters any
Loop any
Interval *float64
CanDispatch func() bool
ProfileHomes []ProfileHome
ProfileHomesFn func() ([]ProfileHome, error)
ProfileAdapters map[string]any
DefaultProfile *string
ProfileGate func(name *string, home string) bool
ProfileBotPlatforms map[string]any
}
Inputs of a ticker start, ProfileHomesFn being the live enumerator a multiplex gateway passes
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is one profile home's cron job store under <home>/cron
func (*Store) AcceptSuggestion ¶
func (s *Store) AcceptSuggestion(ctx context.Context, ref string, origin map[string]any) (*Job, error)
Creates the job of a pending suggestion, merging origin, and marks the suggestion accepted
func (*Store) AddSuggestion ¶
func (s *Store) AddSuggestion(title, description, source string, jobSpec any, dedupKey string) (*jsonutil.Object, error)
Registers a pending suggestion, nil when its dedup key was seen or the pending list is full
func (*Store) CatchUpOccurrenceCount ¶
CatchUpOccurrenceCount is how many missed recurring runs collapsed into one catch up run
func (*Store) ClearResolvedSuggestions ¶
Drops accepted records and keeps dismissed ones for their dedup key, returning the count removed
func (*Store) ClearTickerError ¶
func (s *Store) ClearTickerError()
ClearTickerError removes the last tick error marker, ignoring failures
func (*Store) DismissSuggestion ¶
Dismisses a suggestion so its dedup key is never offered again
func (*Store) GetSuggestion ¶
Suggestion by id, one based pending index, or case insensitive exact title
func (*Store) ListPendingSuggestions ¶
Pending suggestions oldest first
func (*Store) LoadSuggestions ¶
Every suggestion record of any status
func (*Store) RecordTickerError ¶
RecordTickerError persists the latest tick failure for status readers in other processes
func (*Store) RecordTickerHeartbeat ¶
RecordTickerHeartbeat stamps loop liveness with the writer pid, plus the last success marker when success
func (*Store) SaveJobOutput ¶
SaveJobOutput writes one run's output as a timestamped markdown file and prunes older ones
func (*Store) SaveJobs ¶
SaveJobs writes jobs under the lock, removedIDs naming deliberate deletes and replace skipping the merge
func (*Store) TickerHeartbeatAge ¶
TickerHeartbeatAge is the seconds since the loop last iterated, false when unknown
func (*Store) TickerHeartbeatWriterAlive ¶
TickerHeartbeatWriterAlive reports whether the pid that wrote the heartbeat still runs
func (*Store) TickerLastError ¶
TickerLastError is the most recent recorded tick error, false when none
func (*Store) TickerSuccessAge ¶
TickerSuccessAge is the seconds since the last tick that finished without error, false when unknown
type StoreDegraded ¶
type StoreDegraded struct {
Store string
Since float64
Error string
RecoveredAt *float64
Sites map[string]bool
Skipped map[runKey]bool
// contains filtered or unexported fields
}
StoreDegraded is one cron store that stopped accepting writes and what that cost
func DegradedRecord ¶
func DegradedRecord(cronDir string) *StoreDegraded
DegradedRecord is the live outage of the store under cronDir, nil while it accepts writes
func DegradedRecords ¶
func DegradedRecords() []*StoreDegraded
DegradedRecords lists every store currently refusing writes
func (*StoreDegraded) NoticeFields ¶
func (r *StoreDegraded) NoticeFields() map[string]any
NoticeFields renders the store, error, start time, fix hint and skipped count for notices
func (*StoreDegraded) SkippedRuns ¶
func (r *StoreDegraded) SkippedRuns() int
SkippedRuns counts the distinct scheduled runs the outage skipped
type SuggestionAdder ¶
type SuggestionAdder func(title, description, source string, jobSpec any, dedupKey string) (*jsonutil.Object, error)
Suggestion registrar the catalog seeds through, the store's add_suggestion shape
type SupervisedTickerThread ¶
type SupervisedTickerThread struct {
// contains filtered or unexported fields
}
Thread shaped handle over the in process ticker whose RestartIfDead respawns a ticker that crashed
func NewSupervisedTickerThread ¶
func NewSupervisedTickerThread(target func(), stop <-chan struct{}, name string) *SupervisedTickerThread
Supervisor for target with stop as its stop event, the thread named cron-scheduler when name is empty
func (*SupervisedTickerThread) IsAlive ¶
func (t *SupervisedTickerThread) IsAlive() bool
Whether the current ticker goroutine is running
func (*SupervisedTickerThread) Join ¶
func (t *SupervisedTickerThread) Join(timeout *time.Duration) error
Waits for the current ticker to end, at most timeout when given, an error when never started
func (*SupervisedTickerThread) RestartIfDead ¶
func (t *SupervisedTickerThread) RestartIfDead() bool
Respawns a ticker that crashed without a stop request, true when a restart happened
func (*SupervisedTickerThread) Restarts ¶
func (t *SupervisedTickerThread) Restarts() int
Respawns issued so far
func (*SupervisedTickerThread) Start ¶
func (t *SupervisedTickerThread) Start() error
Starts the ticker, an error when this handle was already started
type Target ¶
Target is one resolved delivery destination, an empty ThreadID or ResolvedFrom is the Python None
type UnknownCronCommandError ¶
type UnknownCronCommandError struct{ Command string }
Usage exit of an unknown cron subcommand, exit status 1
func (*UnknownCronCommandError) Error ¶
func (e *UnknownCronCommandError) Error() string
type ValueError ¶
type ValueError struct{ Msg string }
ValueError is a job argument or schedule the jobs store rejects, the ValueError of cron.jobs
func (*ValueError) Error ¶
func (e *ValueError) Error() string
Source Files
¶
- api_server_jobs_export.go
- backup_cron_prompts.go
- blueprint_catalog.go
- blueprint_catalog_data.go
- blueprint_plugins.go
- bot_chat_legacy.go
- cancellation.go
- classify_items.go
- cli_blueprint_cmd.go
- cli_cron.go
- cli_cron_cmd.go
- cli_cron_lines.go
- cli_cron_liveness.go
- clock.go
- console_ops.go
- constants.go
- cronexpr.go
- croniter_validate.go
- cronjob_job_args.go
- cronjob_prompt_scan.go
- cronjob_schema.go
- cronjob_tools.go
- crud.go
- crud_export.go
- curator_hooks.go
- delivery_outcome.go
- delivery_queue.go
- delivery_queue_export.go
- dispatch_hold.go
- doctor_exports.go
- duescan.go
- execution_identity.go
- executions.go
- extra_fire.go
- flock_unix.go
- gateway_owner_hooks.go
- housekeeping_export.go
- incidents.go
- job.go
- job_definition.go
- jobs_home_load.go
- jobs_invariants.go
- jobs_model_pin.go
- jobs_oneshot_diagnostics.go
- jobs_time.go
- log.go
- markrun.go
- missed_runs.go
- monitor.go
- monitoring_sources.go
- notepad.go
- occurrences.go
- providers.go
- quota_hold.go
- schedule.go
- scheduler.go
- scheduler_agent.go
- scheduler_agent_hooks.go
- scheduler_authority.go
- scheduler_authority_export.go
- scheduler_authority_run.go
- scheduler_bookkeeping.go
- scheduler_delivery.go
- scheduler_delivery_lane.go
- scheduler_delivery_origin.go
- scheduler_delivery_targets.go
- scheduler_delivery_targets_export.go
- scheduler_detached_worker.go
- scheduler_diagnostics.go
- scheduler_external_worker.go
- scheduler_facade.go
- scheduler_failure.go
- scheduler_failure_copy.go
- scheduler_gateway_gate.go
- scheduler_inflight.go
- scheduler_inflight_details_export.go
- scheduler_inflight_export.go
- scheduler_inflight_guard.go
- scheduler_liveness.go
- scheduler_mode_export.go
- scheduler_ownership.go
- scheduler_preflight.go
- scheduler_preflight_export.go
- scheduler_preflight_job.go
- scheduler_preflight_routes.go
- scheduler_preflight_unix.go
- scheduler_prompt.go
- scheduler_provider.go
- scheduler_registration.go
- scheduler_restart_wait_counts.go
- scheduler_run.go
- scheduler_run_one.go
- scheduler_runtime.go
- scheduler_script.go
- scheduler_script_run.go
- scheduler_script_unix.go
- scheduler_thread.go
- scheduler_tick.go
- scheduler_tick_unix.go
- scheduler_worker_env.go
- scheduler_worker_failure.go
- scheduler_worktree_maintenance.go
- skill_refs.go
- store.go
- store_health.go
- store_health_linux.go
- store_health_unix.go
- store_unix.go
- suggestion_catalog.go
- suggestions.go
- suggestions_cmd.go
- timeutil.go
- unreachable_retry.go
- worker_bootstrap.go
- worktree_registry.go