Pipeline Module
The pipeline orchestrator manages the full lifecycle of a content run: fetching, processing, video generation, and publishing.
PipelineService
run(): Promise<Result<PipelineRunStatus, PipelineError>>
Executes one complete pipeline iteration:
- Guard checks — rejects if already running or daily limit reached
- Fetch — scrapes Reddit for a suitable post (with retry)
- Process — branches on
videoFormatconfig:messages: LLM rewrite → MessageRendererclassic: TTS → VideoService
- Publish — uploads to TikTok via CamoufoxTikTokProvider
- Persist — stores run metadata in SQLite
getCurrentStatus(): PipelineRunStatus | null
Returns the current or most recent pipeline run status.
getRecentRuns(limit: number): PipelineRunStatus[]
Returns recent runs from the database.
PipelineScheduler
Cron-based automatic scheduling:
- Schedule:
POSTING_CRON(default: every 4 hours) - Random jitter: 0–30 minutes added to each trigger
- Tracks next scheduled run time
PipelineRunStatus
typescript
interface PipelineRunStatus {
id: string;
status: 'running' | 'complete' | 'failed';
stage: PipelineStage;
startedAt: string;
completedAt: string | null;
postId: string | null;
postTitle: string | null;
tiktokUrl: string | null;
errorMessage: string | null;
durationMs: number | null;
}Stages
fetching → rewriting → message_rendering → synthesizing → compositing → publishing → complete | failed
Retry Strategy
- Retryable stages: fetching, TTS, video generation
- Max retries:
PIPELINE_RETRY_MAX_ATTEMPTS(default: 2) - Backoff:
delay = PIPELINE_RETRY_DELAY_MS * attempt(linear) - Non-retryable:
DAILY_LIMIT_REACHED,ALREADY_RUNNING,NO_POSTS_AVAILABLE,CAPTCHA_DETECTED