# Transcript assembly helper

This asset plans a deterministic, lexical rough assembly from a required target
script and one or more Premiere transcript JSON files. It does not access or
mutate Premiere. The caller owns the temporary `sourceId` mapping and applies a
validated plan later.

Run the entry point with Python isolation and the complete sibling toolkit:

```sh
python3 -I transcript_assembly.py \
  --srt-toolkit-dir ../srt-caption-toolkit \
  --lexical-alignment-dir ../lexical-alignment \
  analyze \
  --session-manifest session.json \
  --target-file target.txt \
  --output-dir output
```

`session.json` has contract version 1 and an ordered `sources` array. Each source
contains a unique `sourceId`, contiguous `sourceOrder`, `transcriptPath`, positive
`durationMs`, and boolean `hasVideo` / `hasAudio`. Relative transcript paths are
resolved from the manifest directory. Optional top-level settings are
`handleBeforeSeconds`, `handleAfterSeconds`, and `blockGapSeconds`.

The Recipe may instead provide a frozen TSV with `sourceId`, `selectionIndex`,
`displayName`, `captureDateRaw`, `durationSeconds`, `transcriptPath`, `hasVideo`,
and `hasAudio`. Complete coherent capture dates determine session order;
otherwise the complete selection keeps Premiere selection-API order.

The helper writes `analysis.json`, `placements.tsv`, `sequence-markers.tsv`,
`source-markers.tsv`, and `summary.tsv`. Run `validate-plan` over all five files
before any host mutation. Validation requires the tables to be exact projections
of the analysis, enforces source bounds and lane pairing, rejects adjacent target
units that claim overlapping source words, and audits allowed non-adjacent reuse.
