/** * Schedule `deliverTo` auto-post after a cron-triggered agent run. * * Reads `configurable.mda_schedule.deliver_to` (compiled from defineSchedule) * and posts the final assistant text to Slack when configured. * * Delivery only runs for managed cron invocations: compiled crons stamp both * `metadata.mda_managed` / `metadata.mda_schedule` and * `configurable.mda_schedule.name`. Ordinary HTTP invokes cannot forge that * pair (and `mda_schedule` is a reserved configurable key). */ import type { ManagedMiddleware } from "../runtime/managed-middleware.js"; import type { ChannelAddress } from "./types.js"; /** Override LangGraph run metadata resolution. Test-only. */ export declare function setScheduleMetadataForTests(loader?: () => { mda_managed?: unknown; mda_schedule?: unknown; } | undefined): void; /** Normalized schedule delivery target (camelCase). */ export interface NormalizedScheduleDeliverTo { channel: string; to: { type: "provider_conversation"; conversationId: string; } | { type: "provider_thread"; conversationId: string; threadId: string; }; autoPost: boolean; } /** * Read and normalize `configurable.mda_schedule.deliver_to` from a cron run. * Accepts camelCase (TS compile) and snake_case (Python compile) shapes. */ export declare function readScheduleDeliverTo(configurable: Record | undefined): NormalizedScheduleDeliverTo | undefined; /** Map a deliverTo destination onto a runtime channel address. */ export declare function addressFromDeliverTo(to: NormalizedScheduleDeliverTo["to"]): ChannelAddress; export interface DeliverScheduleResultInput { deliverTo: NormalizedScheduleDeliverTo; replyText: string; /** Override bot token (tests). */ botToken?: string; /** Override post implementation (tests). */ post?: (input: { text: string; conversationId: string; threadId?: string; }) => Promise; } /** * Post schedule result text to the configured channel. Soft-fails (logs) on * missing token / provider errors so cron runs are not marked failed. */ export declare function deliverScheduleResult(input: DeliverScheduleResultInput): Promise<"posted" | "skipped" | "failed">; /** * True when this run is a managed cron fire (not a caller-forged HTTP invoke). */ export declare function isTrustedScheduleDeliveryRun(configurable: Record | undefined): boolean; /** * Always-on middleware that auto-posts schedule results when `deliver_to` is set * on a trusted managed cron run. * * Prefer explicit `runtime.configurable`, then ambient — not * `resolveRuntimeConfigurable`, which can discard a present `mda_schedule` when * the bag lacks `langgraph_auth_user`. * * Production always calls this with no options; `options.deliver` is test-only. */ export declare function createScheduleDeliveryMiddleware(options?: { /** Override deliver implementation (tests). */ _deliver?: typeof deliverScheduleResult; }): ManagedMiddleware; //# sourceMappingURL=schedule-delivery.d.ts.map