// A run's work folder: what each step reads of the steps before it. Every step is a command of its own (the server runs // them one at a time, with the model calls in between), so what they share is written here, never held in memory. import { execFile } from "node:child_process"; import { mkdir, readFile } from "node:fs/promises"; import { join, resolve } from "node:path"; import { promisify } from "node:util"; import { BodyReader } from "./body.js"; import { selfCommand } from "./cutouts.js"; import { type Clip, clipOf, cutsIn, refuse, smallOf, wordsOf } from "./clip.js"; import { appendTo, isOwnFile, ownOrMissing, workFolder, writeOver } from "./output.js"; import { Refused } from "./refused.js"; import { type Json, type JsonObject, listOf, objectOf, readJson, round } from "./json.js"; import { type Effect, type LibraryVersion, libraryVersion, pool } from "./library.js"; import { isMotion, type Motion, readHeads, readMotion } from "./motion.js"; import { type Placed, type Style, stylesFrom } from "./plan.js"; import { isCaption, type Preset, presetAt } from "./preset.js"; import type { Word } from "./words.js"; export interface State extends Partial { project: string; library: string; clip: string; run_id: string; /** A style preset of the library: /presets/