- Cron-based task scheduling with SchedulerService (create, pause, resume, delete) - One-shot executor using `claude -p` with stream-json output for rich log display - CLAUDECODE env var stripped to prevent nested session detection - JsonScheduleRepository for persistent schedule/run/log storage - Full IPC pipeline: handlers, preload bridge, API types, HttpClient stubs - ScheduleSection UI with create/edit dialog, run history, status badges - ScheduleRunLogDialog with CliLogsRichView (thinking blocks, tool cards, markdown) - Real-time run status updates via store subscription - Retry logic with configurable max retries and auto-pause on consecutive failures - CronScheduleInput with human-readable descriptions via cronstrue - 3 test suites: SchedulerService, ScheduledTaskExecutor, JsonScheduleRepository
24 lines
1 KiB
TypeScript
24 lines
1 KiB
TypeScript
/**
|
|
* Schedule repository interface — abstracts storage backend.
|
|
*
|
|
* Current implementation: JsonScheduleRepository (JSON files on disk).
|
|
* Future upgrade path: Drizzle + sql.js (WASM, no native modules).
|
|
*/
|
|
|
|
import type { Schedule, ScheduleRun } from '@shared/types';
|
|
|
|
export interface ScheduleRepository {
|
|
listSchedules(): Promise<Schedule[]>;
|
|
getSchedule(id: string): Promise<Schedule | null>;
|
|
getSchedulesByTeam(teamName: string): Promise<Schedule[]>;
|
|
saveSchedule(schedule: Schedule): Promise<void>;
|
|
deleteSchedule(id: string): Promise<void>;
|
|
|
|
listRuns(scheduleId: string, opts?: { limit?: number; offset?: number }): Promise<ScheduleRun[]>;
|
|
getLatestRun(scheduleId: string): Promise<ScheduleRun | null>;
|
|
saveRun(run: ScheduleRun): Promise<void>;
|
|
pruneOldRuns(scheduleId: string, keepCount: number): Promise<number>;
|
|
|
|
saveRunLogs(scheduleId: string, runId: string, stdout: string, stderr: string): Promise<void>;
|
|
getRunLogs(scheduleId: string, runId: string): Promise<{ stdout: string; stderr: string }>;
|
|
}
|