apply_script
Apply the edits authored in timeline.md to the timeline. This is the commit step for Script: it diffs the file against the live state, commits atomically (any row error rolls back the whole apply), then re-materializes timeline.md clean (no ~~…~~).
Workflow: call read_script, edit timeline.md, then call this tool on the transport read_script established. On workspace surfaces, edit timeline.md in place and call apply_script() with no timelineMd; when read_script returned the file inline, pass the full edited text via apply_script({timelineMd: "<edited>"}). Pass preview: true to see the result without committing. The timelineMd parameter documents the file format and edit syntax.
At commit time:
Author the whole arrangement (reorders, repeats, several versions back to back) and commit it in one apply.
Matching tolerates case, punctuation, and word-boundary whitespace, not changed words. If the transcript text itself is wrong, use
manage_transcriptactionfixfirst.An existing
[sN@M]row keeps its identity when edited, moved, or deleted; only a new replay row is a bare[sN]. Never widen a user-approved inline strike to a whole-line deletion.Middle deletions or moves split clips around the kept ranges; more clips is expected, not a failure.
If the timeline changed since
read_script, apply refuses: callread_scriptagain, review, then re-edit.A very large commit is rejected before writing: commit fewer edits per pass (
trackisolates one track), then callread_scriptagain.
The result is a bounded summary; preview adds positional and removed-row detail.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "apply_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| track | No | Track alias (e.g. V1, A1) or track UUID. Usually unnecessary; the default speech track is used. | |
| preview | No | Preview the result without modifying the timeline. | |
| projectId | No | Project for this call (full ID or unambiguous prefix). Explicit-timeline calls never change the target of later calls; legacy project selection applies otherwise. | |
| timelineId | No | ||
| timelineMd | No | Full edited timeline.md content. Required when read_script returned it inline (no workspace filesystem); omit on workspace surfaces, where ChatCut reads your in-place edits from disk. Format: keep the top `# Timeline`, `script-stamp`, `script-timeline`, `script-track`, and `<!-- script:body -->` markers. `## V1` / `## A2` are track sections; `### <filename>` source regions sit under them (preserve the H3 text exactly); body order is playback order. Rows: `[sN] text` is a spoken segment (`[sN@2]` the second play of the same segment); `[cN] Nf` a non-transcript clip; `[gap Nf]` empty track time (black on the only video track); `[silence=Ns]` a pause, shown only with showSilence; `@speaker` lines are render-only. library/*.md files are not timeline files: copy their `[sN]` rows under a matching `### <filename>` region instead of pasting the file. Edits: strike playback with `~~…~~`, e.g. `[s5] keep ~~drop~~ keep`, `[s1] 过去~~呢~~一个月`, or `~~[s5] whole row~~` (or delete the line); every strike opens and closes on one line. Trim text at a row's start or end to keep part of it. Move lines to reorder. Replay a segment with a bare library `[sN]` row; keep the `@N` of an existing occurrence you edit, move, or delete. `[sN]` text must stay a contiguous substring of what was spoken: never rewrite or add words, and never add spaces to Chinese text. Cut a pause with `~~[silence=0.8s]~~`, shorten it with `[silence=0.8s→0.2s]`; use clean_script for whole-track pause changes. Do not add a bare `[gap]` on the main video track for breathing room. |