Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:0xsline OpenChatCut AcceptExportSubmission

From Leeroopedia
Knowledge Sources
Domains Video_Export, Validation, Media_Processing
Last Updated 2026-10-22 14:00 GMT

Overview

Concrete function that serves as the sole server-render acceptance boundary: validates an export request into a plan and materializes all render-visible media to local paths before returning.

Description

The acceptExportSubmission function combines planExport and materializeServerExportMedia into a single acceptance boundary. It is the gate that all server-side rendering must pass through — no rendering starts until this function returns successfully.

Key behaviors:

  • Plan validation: Calls `planExport(body)` to validate and normalize the request.
  • Sequence graph errors: Wraps sequence-graph validation errors into structured `ExportFailureError`.
  • Media materialization: Calls `materializeServerExportMedia` to download and verify all media.
  • Snapshot reconciliation: Updates the plan's state/project with the materialized snapshot (local paths).
  • Cleanup ownership: Returns a `cleanup()` function that the caller must invoke after rendering to remove temp files.
  • Abort signal support: Honors `mediaOptions.signal` at every stage.
  • Atomic failure: If materialization succeeds but snapshot reconciliation fails, temp files are cleaned up before re-throwing.

Usage

  • Export job submission: Called by the export submission plugin when a new export job starts.
  • Export recovery: Called to re-validate and re-materialize when resuming an interrupted export.

Code Reference

Source Location

  • Repository: OpenChatCut
  • File:*** server/plugins/export-submission.ts

Signature

export interface AcceptedExportSubmission {
  readonly plan: ExportPlan;
  readonly materializedPaths: readonly string[];
  cleanup(): Promise<void>;
}

export async function acceptExportSubmission(
  body: ExportRequest | null,
  mediaOptions?: ServerExportMediaOptions,
): Promise<AcceptedExportSubmission>;

Import

import { acceptExportSubmission, type AcceptedExportSubmission } from '../server/plugins/export-submission.ts';

I/O Contract

Inputs

Name Type Required Description
body null Yes Export request (same as planExport input)
mediaOptions ServerExportMediaOptions No Materialization options (signal, directories, fetcher, maxBytes)

Outputs

Name Type Description
plan ExportPlan Frozen plan with materialized state/project
materializedPaths readonly string[] Local file paths created during materialization
cleanup() Promise<void> Removes temporary materialized files

Usage Examples

Full Export Acceptance

import { acceptExportSubmission } from '../server/plugins/export-submission.ts';

const controller = new AbortController();
const accepted = await acceptExportSubmission(
  { state: timelineState, codec: 'h264', resolution: '1080p' },
  { signal: controller.signal },
);

try {
  // Render using the accepted plan
  await renderExportPlan(accepted.plan, outputFile, updateProgress, controller.signal);
  // ... QA, destination delivery ...
} finally {
  // Always clean up materialized media
  await accepted.cleanup();
}

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment