Formerly KrillinAI, VideoTranslation and Dubbing Tool for 120+ Languages. Open-source AI workspace for creators, powered by Codex. Video downloader, video translation, create videos, images, audios, and edits with Agents in one place. For your Social Media like YouTube, TikTok, Instagram, etc.
TypeScript agent-skillscodex-clideskop-appdubbingimage-generationlocalizationskillsttsvideo-editingvideo-generationvideo-transcriptionvideo-translation
import type { CreatorJob, CreatorStageRun } from '@opencreator/protocol';
export function downloadWorkdirStageId(job: CreatorJob, stage: CreatorStageRun): string {
if (job.templateId !== 'video-download' || job.templateVersion < 2 || stage.stageId !== 'download') return stage.id;
const workdirStageId = stage.progress.downloadWorkdirStageRunId;
if (typeof workdirStageId !== 'string') return stage.id;
let current = stage;
const visited = new Set([current.id]);
if (current.id === workdirStageId) return current.id;
while (typeof current.progress.resumedFromStageRunId === 'string') {
const previous = job.stages.find(candidate => candidate.id === current.progress.resumedFromStageRunId);
if (!previous || visited.has(previous.id) || previous.stageId !== 'download'
|| !['canceled', 'interrupted'].includes(previous.status)
|| previous.progress.downloadControl === 'canceled'
|| previous.progress.optionId !== stage.progress.optionId
|| previous.progress.sourceUrl !== stage.progress.sourceUrl
|| previous.progress.probeArtifactId !== stage.progress.probeArtifactId) break;
visited.add(previous.id);
current = previous;
if (current.id === workdirStageId) return current.id;
}
return stage.id;
}