/** * Validate a user-supplied webhook URL before the scheduler POSTs to it. * Defends against accidental misconfig and basic SSRF: no protocols other * than http(s); no loopback / RFC1918 / link-local destinations unless the * operator explicitly opts in via AGIM_ALLOW_PRIVATE_WEBHOOKS=1. * * Note: this is a lexical check (IP literals + "localhost"). DNS-rebinding * mitigation requires an at-fetch-time guard; tracked separately. */ export declare function validateWebhookUrl(raw: string): { ok: true; url: URL; } | { ok: false; reason: string; }; /** * At-fetch-time SSRF guard: DNS-resolve a webhook host and reject targets * that land in private / loopback / link-local space. This is the piece the * lexical validateWebhookUrl can't do — it only sees the (WHATWG-normalized) * host string, so a hostname that RESOLVES into a private range (DNS * rebinding, split-horizon DNS, or an attacker domain whose A-record points * at 169.254.169.254 / 10.x / 127.x) passes it. (Numeric IP literals like * `2130706433` are already normalised to dotted-quad by `new URL`, so the * lexical check catches those; the residual gap is hostnames.) Honours the * same AGIM_ALLOW_PRIVATE_WEBHOOKS=1 escape hatch. Fail-closed: a DNS * failure is treated as not-allowed. */ export declare function assertWebhookHostPublic(host: string): Promise<{ ok: true; } | { ok: false; reason: string; }>; export interface Schedule { id: number; name: string; agent: string; prompt: string; cron: string; enabled: number; next_run: string; last_run: string | null; notify_url: string | null; created_at: string; /** IM userId of the originating caller, or '' for legacy / system rows. */ creator_id: string; /** Workspace this schedule was created under, or '' if unknown. */ workspace_id: string; } /** Filter / scoping options for owner-sensitive schedule APIs. Identical * semantics to {@link OwnerOpts} on job-board.ts. */ export interface OwnerOpts { creatorId?: string; /** Optional agent-name filter, mirrors job-board.OwnerOpts.agent. */ agent?: string; } export interface CreateScheduleInput { name: string; agent: string; prompt: string; cron: string; notifyUrl?: string; enabled?: boolean; /** IM userId of the originating caller. Empty / undefined → '' (legacy). */ creatorId?: string; /** Workspace this schedule was created under. */ workspaceId?: string; } export declare function createSchedule(input: CreateScheduleInput): number; export declare function listSchedules(limit?: number, opts?: OwnerOpts): Schedule[]; export declare function getSchedule(id: number, opts?: OwnerOpts): Schedule | null; export declare function deleteSchedule(id: number, opts?: OwnerOpts): boolean; export declare function setEnabled(id: number, enabled: boolean, opts?: OwnerOpts): boolean; /** Run one tick — exposed for tests so they don't have to wait for setInterval. */ export declare function tick(now?: Date): Promise; /** Start the periodic ticker. Idempotent. */ export declare function startScheduler(): void; export declare function stopScheduler(): void; /** Close the underlying SQLite handle. Called by cli.ts on graceful * shutdown so the WAL is checkpointed before exit (L2). */ export declare function closeScheduleDb(): void; //# sourceMappingURL=schedule.d.ts.map