/**
 * Scheduled routines management.
 *
 * Registers the `agents routines` command tree for creating, editing,
 * running, pausing, and removing cron-scheduled agent invocations.
 * Also exposes scheduler lifecycle controls (start/stop/status/logs).
 */
import type { Command } from 'commander';
export { buildRoutineListJson } from '../lib/scheduling/routines.js';
import type { JobConfig, RunMeta } from '../lib/scheduling/routines.js';
import type { DeviceRegistry } from '../lib/devices/registry.js';
/**
 * Human-friendly wall-clock a run took (e.g. "  · 3 min", "  · 45 sec"), or ""
 * when it hasn't completed or timestamps are unparseable. Leading separator lets
 * callers drop it straight into a status line.
 */
export declare function formatRunDuration(startedAt: string, completedAt: string | null): string;
/**
 * The last run THIS device can speak for.
 *
 * A run record is written by whichever daemon fired the routine, into that
 * machine's own runs dir — records carry no device attribution, so a record
 * found here only ever describes this device's history. When a routine is
 * pinned away from this machine (`devices:` excludes it) any local record is a
 * leftover from before the pin, and reporting it as the routine's status paints
 * another device's healthy routine red. Report nothing instead; the local
 * history stays readable via `agents routines runs <name>`, and the owning
 * device's status via `agents routines list --device <name>`.
 */
export interface RoutineListGroup {
    key: string;
    title: string;
    jobs: JobConfig[];
    /**
     * Whether this device's run records describe the group. False for a
     * `Device: <peer>` group — the rows are the same routine seen from a machine
     * that does not fire it there, so Last Status is not ours to report.
     */
    local: boolean;
}
export declare function groupRoutineJobsByDevice(jobs: JobConfig[], registry: DeviceRegistry, self?: string): RoutineListGroup[];
/**
 * Group routines by their `projects` metadata field.
 * Named projects come first (alphabetically), followed by All projects, Cross-project,
 * Operations (no project), and Unknown projects (stale names).
 */
export declare function groupRoutineJobsByProject(jobs: JobConfig[], knownProjectNames: Set<string>): RoutineListGroup[];
export declare function buildRunsJson(runs: RunMeta[]): Record<string, unknown>[];
/**
 * The short, human reason a run did not simply complete — for inline display in
 * the list/detail so "why did it fail" needs no dig into the run dir. Prefers the
 * concrete `errorMessage` (which carries `auth_failed: …`, OAuth-revoked, timeouts),
 * then the readiness block for a `blocked` run, then the mapped skip reason. Returns
 * null for a healthy (`completed`/`running`) run, which needs no annotation.
 */
export declare function runFailureReason(run: RunMeta): string | null;
/** Register the `agents routines` command tree. */
export declare function registerRoutinesCommands(program: Command): void;
