/** * Type definitions for Heartbeat API */ import type { CronJob, JobResult } from '../scheduler/types.js'; /** * API representation of a cron job */ export interface ApiCronJob { id: string; name: string; cron_expr: string; prompt: string; enabled: boolean; last_run: number | null; next_run: number | null; channel?: string; } /** * Request body for creating a cron job */ export interface CreateCronJobRequest { name: string; cron_expr: string; prompt: string; enabled?: boolean; channel?: string; } /** * Request body for updating a cron job */ export interface UpdateCronJobRequest { name?: string; cron_expr?: string; prompt?: string; enabled?: boolean; channel?: string; } /** * Response for cron job list */ export interface ListCronJobsResponse { jobs: ApiCronJob[]; } /** * Response for single cron job */ export interface GetCronJobResponse { job: ApiCronJob; } /** * Response for cron job creation */ export interface CreateCronJobResponse { id: string; created: boolean; } /** * Response for cron job update */ export interface UpdateCronJobResponse { updated: boolean; } /** * Response for cron job deletion */ export interface DeleteCronJobResponse { deleted: boolean; } /** * Response for immediate job execution */ export interface RunCronJobResponse { execution_id: string; started: boolean; } /** * Execution log entry */ export interface ExecutionLog { id: string; started_at: number; finished_at: number | null; status: 'running' | 'success' | 'failed'; output: string | null; error: string | null; } /** * Response for execution logs */ export interface GetLogsResponse { logs: ExecutionLog[]; } /** * Query parameters for logs endpoint */ export interface GetLogsQuery { limit?: number; offset?: number; } /** * Last execution info for heartbeat status */ export interface LastExecution { id: string; started_at: number; status: 'success' | 'failed'; } /** * Response for heartbeat status */ export interface HeartbeatStatusResponse { status: 'active' | 'inactive'; active_jobs: number; last_execution: LastExecution | null; } /** * Request body for manual heartbeat trigger */ export interface TriggerHeartbeatRequest { prompt?: string; } /** * Response for heartbeat trigger */ export interface TriggerHeartbeatResponse { execution_id: string; started: boolean; } /** * API error codes */ export type ApiErrorCode = 'BAD_REQUEST' | 'NOT_FOUND' | 'VALIDATION_ERROR' | 'JOB_RUNNING' | 'INTERNAL_ERROR'; /** * API error response */ export interface ApiErrorResponse { error: string; code?: ApiErrorCode; details?: Record; } /** * Custom API error class */ export declare class ApiError extends Error { readonly statusCode: number; readonly code: ApiErrorCode; readonly details?: Record | undefined; constructor(message: string, statusCode: number, code?: ApiErrorCode, details?: Record | undefined); toResponse(): ApiErrorResponse; } /** * Convert internal CronJob to API format */ export declare function toApiCronJob(job: CronJob): ApiCronJob; /** * Convert JobResult to ExecutionLog format */ export declare function toExecutionLog(id: string, result: JobResult): ExecutionLog; //# sourceMappingURL=types.d.ts.map