import type { ChannelAdapter } from "#channel/adapter.js";
import { type Session } from "#channel/session.js";
import type { Runtime } from "#channel/types.js";
import type { ScheduleRunHandler } from "#public/definitions/schedule.js";
import type { ResolvedChannelDefinition } from "#runtime/types.js";
export { SCHEDULE_APP_AUTH } from "#channel/schedule-auth.js";
/**
 * Durable adapter kind used when a schedule fires without targeting a
 * channel — the markdown form, and the synthesized run the dispatcher
 * builds for it.
 *
 * Framework-owned — authored code never constructs a schedule adapter
 * directly. Registered in `FRAMEWORK_ADAPTERS`.
 */
export declare const SCHEDULE_ADAPTER_KIND = "schedule";
export declare const SCHEDULE_ADAPTER: ChannelAdapter;
/**
 * Loaded shape of one schedule for the dispatcher. Either `run` is
 * defined (authored handler) or `markdown` is defined (fire-and-forget).
 */
export interface ScheduleDispatchInput {
    readonly scheduleId: string;
    readonly run?: ScheduleRunHandler;
    readonly markdown?: string;
}
/**
 * Dispatches scheduled task execution.
 *
 * For handler schedules: builds {@link ScheduleHandlerArgs} against the
 * request-scoped channel bundle and invokes the author's `run`. The
 * author owns control flow — `args.receive(channel, …)` hands work off
 * to a channel; `args.waitUntil(promise)` extends the task lifetime
 * so the dispatcher awaits in-flight work before settling.
 *
 * For markdown schedules: synthesizes a channel-less run that starts a
 * session with {@link SCHEDULE_ADAPTER} in task mode and the markdown
 * body as the message.
 *
 * Returns a {@link ScheduleDispatchResult} carrying any sessions the
 * handler started (for telemetry / task-result observability) and the
 * `waitUntil` promises the handler registered.
 */
export interface ScheduleDispatchResult {
    readonly sessions: readonly Session[];
    readonly waitUntilTasks: readonly Promise<unknown>[];
}
export declare class ScheduleDispatcher {
    private readonly runtime;
    private readonly channels;
    constructor(config: {
        readonly runtime: Runtime;
        readonly channels: readonly ResolvedChannelDefinition[];
    });
    trigger(input: ScheduleDispatchInput): Promise<ScheduleDispatchResult>;
    private runMarkdown;
}
/**
 * Convenience: extract a `run` function from one loaded schedule module
 * value, or throw with the file path so misconfigured modules fail
 * obviously instead of crashing deep inside the dispatcher.
 */
export declare function expectScheduleRun(value: unknown, logicalPath: string, exportName: string | undefined): ScheduleRunHandler;
