import type { CronConfig, CronKind } from "./crons.js"; export type CronRefResult = { kind: "ok"; id: string; } | { kind: "ambiguous"; matches: string[]; } | { kind: "missing"; }; /** * v1.3.2 §8 — user-authored dynamic crons. * * The 4 built-in crons stay hardcoded in `CRONS[]` (their cron is * resolved from workspace.yaml). This adds an *additive* path: a user drops a * `crons/.yaml` definition next to its `crons/.md` prompt, and * the scheduler registers it on top of the built-ins. No built-in is removed * (backward-safe); the registry "dynamic-ization" of the built-ins themselves * is a follow-up. * * A CronDef is shaped to be a superset of CronConfig (+ cron + enabled) * so it flows straight into the existing `runCronForProduct`. */ export interface CronDef extends CronConfig { /** node-cron expression (5/6-field). Empty for one-shot defs (see `at`). */ cron: string; /** * v1.3.3 §C — one-shot run time (absolute ISO 8601). When set, the cron runs * exactly once at this time then auto-deletes (delete-after-run); `cron` is * ignored. Mutually exclusive with a recurring `cron` expression. */ at?: string; /** * v1.3.4 §C — IANA timezone override for this cron. When absent, the * scheduler uses the workspace/user timezone. Validated (CRON_TZ_INVALID). */ timezone?: string; /** * v1.3.4 §A — jitter: a `s|m` upper bound on a random pre-run delay to * spread simultaneous fires (thundering-herd). Absent/0 = fire on the dot. */ maxRandomDelay?: string; enabled: boolean; } export declare function coerceCronDef(raw: Record, fallbackId: string): CronDef; /** * Load every `crons/.yaml` user definition (best-effort: unparsable * files are skipped). Validation is a separate pass (`validateCronDef`). */ export declare function loadCronDefs(schedulesDir: string): CronDef[]; export declare function cronYamlPath(id: string, dir: string): string; export declare function cronMdPath(id: string, dir: string): string; /** Deterministic, stable-field-order YAML for a cron definition. */ export declare function serializeCronDef(def: CronDef): string; /** Read a single def by id (null if its yaml is absent/unparsable). */ export declare function readCronDef(id: string, dir: string): CronDef | null; /** Write a def's yaml (overwrites). Optionally scaffold the prompt md if absent. */ export declare function writeCronDef(def: CronDef, dir: string, scaffoldPrompt?: boolean): void; /** Patch selected fields of an existing def. Returns the new def, or null if absent. */ export declare function patchCronDef(id: string, patch: Partial, dir: string): CronDef | null; /** Toggle the enabled flag (pause ≠ delete). Returns the new def, or null if absent. */ export declare function setCronEnabled(id: string, enabled: boolean, dir: string): CronDef | null; /** * Delete a cron's backing files. By default archives them under * `/_archived/` (recoverable); pass `{ hard: true }` to remove outright. * Returns the list of removed/moved paths. */ export declare function deleteCronFiles(id: string, dir: string, opts?: { hard?: boolean; }): string[]; /** * Resolve a user-supplied reference (id OR case-insensitive name) to a single * user-cron id. Mirrors Hermes' "hex id or name, ambiguous refused" behavior. * Built-in crons are out of scope here (the CLI rejects edits to them). */ export declare function resolveCronRef(ref: string, dir: string): CronRefResult; /** * A preset is a built-in cron prompt that SHIPS in the bundle (`crons/.md`) * but is NOT scheduled by default — the user opts in via `solosquad cron preset * `, which writes a def into the org crons dir and copies the bundled * prompt in (so it becomes user-owned + editable). This keeps default-on cron * noise low while making the prompt discoverable/enable-able with one command. */ export interface CronPreset { id: string; name: string; kind: CronKind; /** Default node-cron schedule (overridable at enable time). */ cron: string; emoji: string; memoryTargets: string[]; /** One-line description shown in the CLI. */ description: string; } export declare const CRON_PRESETS: Record;