import { type AgentHandle, type Context } from "@agent-relay/agent";
import type { LocalRunMonitorState } from "./surfaces/cli/flows/local-run-monitor.js";
/** Tuning knobs accepted by {@link createRickyScheduledAgent}. */
export interface RickyScheduledAgentOptions {
    /** Environment used to resolve workspace, channel, and state-root overrides. Defaults to `process.env`. */
    env?: NodeJS.ProcessEnv;
    /** Repo whose persisted run-state should be scanned. Defaults to {@link defaultRickyRepoRoot}. */
    repoRoot?: string;
    /** Channel where terminal-state alerts are posted. Defaults to {@link defaultRickyMonitorChannel}. */
    monitorChannel?: string;
    /** Cron expression for the wake-up cadence. Defaults to every 5 minutes. */
    schedule?: string;
}
/** Resolves the Relaycast/relayfile workspace name from `RICKY_WORKSPACE_ID`. */
export declare function defaultRickyWorkspace(env?: NodeJS.ProcessEnv): string;
/** Resolves the proactive-monitor channel from `RICKY_MONITOR_CHANNEL`. */
export declare function defaultRickyMonitorChannel(env?: NodeJS.ProcessEnv): string;
/** Resolves the repo root to monitor from `RICKY_MONITOR_REPO_ROOT` or the current working directory. */
export declare function defaultRickyRepoRoot(env?: NodeJS.ProcessEnv): string;
/**
 * Legacy in-repo artifact location where `startLocalRunMonitor` writes
 * `state.json` when callers do not pass a `stateRoot` override. The
 * scheduled agent must keep scanning this path because the production
 * CLI flow at `src/surfaces/cli/flows/local-workflow-flow.ts` does not
 * pass `stateRoot` and therefore lands here.
 */
export declare function legacyLocalArtifactRunStateRoot(repoRoot: string): string;
/**
 * Loads persisted `LocalRunMonitorState` documents from one or more state
 * roots. Mirrors the dual-path lookup used by `ricky status --run` so the
 * monitor sees both the XDG state-home tree and the in-repo
 * `.workflow-artifacts/ricky-local-runs/` tree that the local-run flow
 * actually writes to. Runs that appear in multiple roots are deduped by
 * `runId`, preferring the first occurrence.
 */
export declare function listPersistedRunStates(stateRoot: string | readonly string[]): Promise<LocalRunMonitorState[]>;
/** Returns true when a run state has reached a terminal status worth alerting on. */
export declare function shouldNotifyRunState(state: LocalRunMonitorState): boolean;
/** Renders a multi-line monitor alert summarizing a terminal background run. */
export declare function renderRunMonitorAlert(state: LocalRunMonitorState, repoRoot: string): string;
/**
 * Scans every supplied state root for persisted runs and posts a one-shot
 * alert per `(repo, runId, status)` triple via `ctx.once`, so duplicate
 * ticks or peer replicas do not produce duplicate notifications.
 */
export declare function checkPersistedRuns(ctx: Context, input: {
    stateRoots: readonly string[];
    repoRoot: string;
    monitorChannel: string;
}): Promise<void>;
/**
 * Creates the proactive Ricky monitor agent. Wakes on the configured cron
 * schedule, scans both the XDG state root and the in-repo
 * `.workflow-artifacts/ricky-local-runs/` tree, and posts a single alert
 * per terminal run via `ctx.once`.
 */
export declare function createRickyScheduledAgent(options?: RickyScheduledAgentOptions): AgentHandle;
