davinci-resolve-mcp 4.18.2 → 4.18.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,86 @@
2
2
 
3
3
  Release history for the DaVinci Resolve MCP Server. The latest release is summarized in the root README; older entries live here to keep the README focused.
4
4
 
5
+ ## What's New in v4.18.4 — Silent Resolve calls from #336 are on the ledger
6
+
7
+ No tool behavior changed. Six calls reported on Studio 21.1.2.10 return
8
+ success, or an empty list, without doing the work their names suggest. They
9
+ are now `submit: bug` entries, so `lookup_api_truth` finds them before an
10
+ agent calls them.
11
+
12
+ ### Documentation
13
+
14
+ - **Timeline.DeleteGaps** returns True and leaves clip starts unchanged.
15
+ - **MediaPool.AddToPhotoAlbum** returns `[]` and the album stays empty.
16
+ `CreatePhotoAlbumFromPhotos` placed photos in the same session. On Studio
17
+ 19.1.3.7 those photo-album methods are absent from `dir(MediaPool)`.
18
+ - **Timeline.ExportFrame** reports every offset out of range when
19
+ `GetStartFrame()` and `GetEndFrame()` are both 86400.
20
+ `TimelineItem.ExportFrame` exported the same frames.
21
+ - **TimelineItem.SetPosition** and **Timeline.MoveItems** return False for
22
+ every input tried in that session.
23
+ - **TimelineItem.SetLeftOffset** returns True and extends the clip from
24
+ source media (a start near frame 400 jumped to about -86000). Setting the
25
+ offset back to 0 does not restore the edit. This server only reads
26
+ `GetLeftOffset`, so the ledger records the fact without a refusal gate.
27
+ - **Timeline.AddMarker** at relative frame 0 returns False, and so does
28
+ `AddMarker(StartFrame)`. `AddMarker(200)` returned True. The server
29
+ already reports `success: false` when the API returns false.
30
+
31
+ ### Validation
32
+
33
+ - The six symbols are findable through `lookup_api_truth`, and the
34
+ limitations report was regenerated (43 missing capabilities, 68 bugs).
35
+ - Static checks: API parity, limitations and read/write drift guards, agent
36
+ rules, undefined names, duplicate definitions, action-list drift, panel
37
+ docs, tool counts, and release-surface drift.
38
+ - Live Resolve on this machine is Studio 19.1.3.7, project "Untitled
39
+ Project", no current timeline. `dir(MediaPool)` confirms the photo-album
40
+ methods are absent. Timeline and TimelineItem methods were not probed.
41
+ The 21.1.2.10 results are @CaptRauti's report and were not re-measured
42
+ here.
43
+ - The control-panel guide was reviewed. No navigation or diagnostic card
44
+ changed, so screenshots were not regenerated.
45
+
46
+ ## What's New in v4.18.3 — A subtitle clipInfo no longer takes Resolve down
47
+
48
+ On Studio 21.1.2.10, `AppendToTimeline` with a clipInfo for an imported SRT
49
+ aborts Resolve. The clipInfo builders now refuse that payload before the call.
50
+
51
+ ### Fixed
52
+
53
+ - **A subtitle clipInfo is refused on Resolve 21.1+** (#335, thanks
54
+ @blacksky3810). `media_pool append_to_timeline` and the other clipInfo
55
+ builders return `SUBTITLE_APPEND_CRASH` instead of forwarding the call.
56
+ On Studio 21.1.2.10 that call aborts Resolve (`Sm2MpObject.cpp:546`). The
57
+ plain `clip_ids` form is unchanged: it does not crash, and on that build it
58
+ also places nothing. Builds older than 21.1 still forward the clipInfo;
59
+ that route was reported working on Studio 21.0.4.5 (#169). An unreadable
60
+ version is refused too.
61
+ - **An allowed media root of `/` contains its files** (#334, thanks
62
+ @Dev-next-gen). The path check built the prefix as `root + separator`, so
63
+ `/` became `//` and a Windows drive root doubled its separator. Every clip
64
+ was then reported outside the allowed roots.
65
+
66
+ ### Documentation
67
+
68
+ - The SRT-import `api_truth` entry now records the 21.1.2 crash and the
69
+ silent plain-form no-op, and the limitations report was regenerated.
70
+
71
+ ### Validation
72
+
73
+ - Focused unit tests: the 21.1.2 clipInfo never reaches `AppendToTimeline`,
74
+ an unreadable version is refused, 21.0.4.5 still forwards, a video clipInfo
75
+ still forwards, and the granular builder returns the same code.
76
+ - Static checks: API parity, limitations and read/write drift guards, agent
77
+ rules, undefined names, duplicate definitions, action-list drift, panel
78
+ docs, tool counts, and release-surface drift.
79
+ - Live Resolve on this machine is Studio 19.1.3.7. The refusal applies at
80
+ 21.1 and above, so it was not exercised against the open project. The
81
+ 21.1.2 crash was not reproduced here.
82
+ - Control-panel guide reviewed. No panel navigation or visible UI changed,
83
+ so screenshots were not regenerated.
84
+
5
85
  ## What's New in v4.18.2 — The rest of the `$` replacement bugs
6
86
 
7
87
  v4.18.1 fixed `replace()` calls that put user text in with an interpolated
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  English | [简体中文](README.zh-CN.md)
4
4
 
5
- [![Version](https://img.shields.io/badge/version-4.18.2-blue.svg)](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
5
+ [![Version](https://img.shields.io/badge/version-4.18.4-blue.svg)](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
6
6
  [![npm](https://img.shields.io/npm/v/davinci-resolve-mcp.svg?label=npm&color=CB3837)](https://www.npmjs.com/package/davinci-resolve-mcp)
7
7
  [![API Coverage](https://img.shields.io/badge/API%20Coverage-100%25-brightgreen.svg)](docs/reference/api-coverage.md)
8
8
  [![Tools](https://img.shields.io/badge/MCP%20Tools-37%20(390%20full)-blue.svg)](#server-modes)
package/README.zh-CN.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [English](README.md) | 简体中文
4
4
 
5
- [![Version](https://img.shields.io/badge/version-4.18.2-blue.svg)](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
5
+ [![Version](https://img.shields.io/badge/version-4.18.4-blue.svg)](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
6
6
  [![npm](https://img.shields.io/npm/v/davinci-resolve-mcp.svg?label=npm&color=CB3837)](https://www.npmjs.com/package/davinci-resolve-mcp)
7
7
  [![API Coverage](https://img.shields.io/badge/API%20Coverage-100%25-brightgreen.svg)](docs/reference/api-coverage.md)
8
8
  [![Tools](https://img.shields.io/badge/MCP%20Tools-37%20(390%20full)-blue.svg)](#服务器模式)
@@ -12,7 +12,7 @@
12
12
  [![Python](https://img.shields.io/badge/python-3.10+-green.svg)](https://www.python.org/downloads/)
13
13
  [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
14
14
 
15
- > 本翻译对应 v4.18.2 版 README。如与英文原版有出入,以 [英文原版](README.md) 为准。
15
+ > 本翻译对应 v4.18.4 版 README。如与英文原版有出入,以 [英文原版](README.md) 为准。
16
16
 
17
17
  一个 Model Context Protocol (MCP) 服务器,让 AI 助手通过官方脚本 API 控制 DaVinci Resolve Studio(达芬奇)。它提供完整的 API 覆盖,外加带护栏的工作流助手,涵盖剪辑、媒体池整理、渲染设置、审阅标记、调色、Fusion、Fairlight、项目生命周期任务、扩展开发,以及不碰源媒体的媒体分析。
18
18
 
package/docs/SKILL.md CHANGED
@@ -2300,12 +2300,19 @@ media_pool(action="import_bounded_media", params={
2300
2300
  # reported 301 frames). Treat that as an observed configuration-specific result,
2301
2301
  # not a guarantee for every Resolve version or media type.
2302
2302
  media_pool(action="media_pool_boundary_report", params={"selected": True, "depth": 2})
2303
- # Positioned append (MediaPool.AppendToTimeline([{clipInfo}, ...])) — e.g. rebuild a subtitle row after delete_clips
2303
+ # Positioned append (MediaPool.AppendToTimeline([{clipInfo}, ...]))
2304
2304
  media_pool(action="append_to_timeline", params={"clip_infos": [
2305
2305
  {"clip_id": "<uuid>", "start_frame": 0, "end_frame": 100, "record_frame": 1200, "track_index": 4}
2306
2306
  ]})
2307
2307
  ```
2308
2308
 
2309
+ A clipInfo whose MediaPoolItem Type is `Subtitle` is refused on Resolve 21.1
2310
+ and above, and when the connected version cannot be read, with
2311
+ `SUBTITLE_APPEND_CRASH`. On Studio 21.1.2.10 that call aborts Resolve
2312
+ (`Sm2MpObject.cpp:546`, issue #335). The plain `clip_ids` form does not crash,
2313
+ and on that build it also places nothing. Builds older than 21.1 still forward
2314
+ the clipInfo; that route was reported working on Studio 21.0.4.5 (issue #169).
2315
+
2309
2316
  When Resolve answers `AppendToTimeline` with None/False/[], either form fails
2310
2317
  with `APPEND_TO_TIMELINE_FAILED`, not `success` with `count: 0`, and keeps
2311
2318
  `verified_operation` (the current timeline's item count before and after) on
@@ -12,7 +12,7 @@ that none exists).
12
12
 
13
13
  **Verified on:** DaVinci Resolve Studio 21.0.2
14
14
 
15
- **Totals:** 43 missing capabilities, 61 bugs / unreliable behaviors.
15
+ **Totals:** 43 missing capabilities, 68 bugs / unreliable behaviors.
16
16
 
17
17
  The authoritative source is the runtime-queryable `api_truth` ledger
18
18
  (`resolve_control api_truth "<query>"`); this document is generated from
@@ -181,8 +181,8 @@ equivalent, blocking full automation.
181
181
  ### Speech recognition engine selection and SRT import
182
182
 
183
183
  - **Object:** `Timeline`
184
- - **Behavior:** Timeline.CreateSubtitlesFromAudio(autoCaptionSettings) always uses the built-in Resolve speech recognition engine. There is no API parameter to select an alternative provider (e.g. whisper-cli, Google Speech, AWS Transcribe). The language selection via resolve.AUTO_CAPTION_LANGUAGE_* is the only customization; the engine itself cannot be changed. There is no dedicated subtitle import method. However, MediaPool.ImportMedia(srt) + AppendToTimeline was reported working on Studio 21.0.4.5 (issue #169). Whether that route carries word timing for animated presets on 21.1 has not been verified; SRT contains only cue timing.
185
- - **Workaround / current handling:** Use Resolve's engine for CreateSubtitlesFromAudio. For external SRT, test ImportMedia + AppendToTimeline on the exact installed build or import through the UI. Use project_db write_captions for explicit word timings with Resolve fully quit; do not assume SRT supplies them.
184
+ - **Behavior:** Timeline.CreateSubtitlesFromAudio(autoCaptionSettings) always uses the built-in Resolve speech recognition engine. There is no API parameter to select an alternative provider (e.g. whisper-cli, Google Speech, AWS Transcribe). The language selection via resolve.AUTO_CAPTION_LANGUAGE_* is the only customization; the engine itself cannot be changed. There is no dedicated subtitle import method. MediaPool.ImportMedia(srt) + AppendToTimeline was reported working on Studio 21.0.4.5 (issue #169). On Studio 21.1.2.10 the clipInfo form of that append aborts Resolve and the plain form places nothing (issue #335). Whether either route carries word timing for animated presets has not been verified; SRT contains only cue timing.
185
+ - **Workaround / current handling:** Use Resolve's engine for CreateSubtitlesFromAudio. For external SRT on 21.1.2, import through the UI. clipInfo append of a subtitle item is refused on 21.1+ (see MediaPool.AppendToTimeline subtitle clipInfo). Use project_db write_captions for explicit word timings with Resolve fully quit; do not assume SRT supplies them.
186
186
  - **Tags:** missing-method, subtitle, transcription, speech-recognition, asr
187
187
 
188
188
  ### Media Pool folder rename
@@ -573,6 +573,69 @@ values, or automation-hostile modal prompts.
573
573
  - **Reference:** [issue #123](https://github.com/samuelgursky/davinci-resolve-mcp/issues/123)
574
574
  - **Tags:** render, subtitle, silent-failure, unverified-cause, deliver
575
575
 
576
+ ### MediaPool.AppendToTimeline (subtitle clipInfo)
577
+
578
+ - **Object:** `MediaPool`
579
+ - **Signature:** `([{clipInfo}]) -> [TimelineItem]`
580
+ - **Behavior:** On Studio 21.1.2.10 (Windows), AppendToTimeline with a clipInfo dict for an imported SRT MediaPoolItem (Type Subtitle) aborts Resolve: assertion at Sm2MpObject.cpp:546, reproduced 2/2. The call hangs, then the process is gone. The plain list form AppendToTimeline([item]) does not crash and places nothing. ImportMedia(srt) + AppendToTimeline was reported working on Studio 21.0.4.5 (issue #169). Which clipInfo field triggers the abort was not isolated. Builds 21.1.0 and 21.1.1 were not measured.
581
+ - **Workaround / current handling:** media_pool append_to_timeline, the granular append_to_timeline, and the other clipInfo builders refuse a Type=Subtitle item on Resolve 21.1 and above, and when the connected version cannot be read, with SUBTITLE_APPEND_CRASH, before AppendToTimeline is called. On a build older than 21.1 the call is still forwarded. Import the SRT through the UI on 21.1.2.
582
+ - **Reference:** [issue #335](https://github.com/samuelgursky/davinci-resolve-mcp/issues/335)
583
+ - **Tags:** crash, subtitle, timeline, silent-failure
584
+
585
+ ### Timeline.DeleteGaps
586
+
587
+ - **Object:** `Timeline`
588
+ - **Signature:** `() -> bool`
589
+ - **Behavior:** On Studio 21.1.2.10 (Windows), DeleteGaps() returned True and left every clip start unchanged, with gaps at 0/200 and again at 0/200/400. This server does not call DeleteGaps. Not re-measured here.
590
+ - **Workaround / current handling:** Read the clip starts before and after. Treat equal readings as failure even when the call returned True. Close the gaps in the Edit page until a build shows the starts actually move.
591
+ - **Reference:** [issue #336](https://github.com/samuelgursky/davinci-resolve-mcp/issues/336)
592
+ - **Tags:** silent-failure, timeline, edit
593
+
594
+ ### MediaPool.AddToPhotoAlbum
595
+
596
+ - **Object:** `MediaPool`
597
+ - **Signature:** `(clips) -> [MediaPoolItem]`
598
+ - **Behavior:** On Studio 21.1.2.10 (Windows), AddToPhotoAlbum returned [] and the album's GetPhotoList() stayed empty, including after SetCurrentPhotoAlbum. CreatePhotoAlbumFromPhotos placed photos in the same session. On Studio 19.1.3.7 (2026-11-01, dir() of the open project's MediaPool), AddToPhotoAlbum, CreateEmptyPhotoAlbum, CreatePhotoAlbumFromPhotos, and GetCurrentPhotoAlbum are absent.
599
+ - **Workaround / current handling:** On 21.1.2, count the album's photos before and after and treat an unchanged count as failure. On 19.1.3.7 the methods are not there; do not call them.
600
+ - **Reference:** [issue #336](https://github.com/samuelgursky/davinci-resolve-mcp/issues/336)
601
+ - **Tags:** silent-failure, media-pool, missing-method
602
+
603
+ ### Timeline.ExportFrame
604
+
605
+ - **Object:** `Timeline`
606
+ - **Signature:** `(frameOffset, settings) -> dict`
607
+ - **Behavior:** On Studio 21.1.2.10 (Windows), Timeline.ExportFrame returned {'success': False, 'error': 'frameOffset is out of range for the timeline'} for offsets 0, 5, 100, 200, 216000, and 216010. The same frames exported through TimelineItem.ExportFrame. The timeline reported StartTimecode 01:00:00:00, StartFrame 86400, and EndFrame 86400. Not re-measured here; this machine had no current timeline to dir().
608
+ - **Workaround / current handling:** Export through TimelineItem.ExportFrame. If GetStartFrame() and GetEndFrame() are equal, the timeline export has no frame range to address.
609
+ - **Reference:** [issue #336](https://github.com/samuelgursky/davinci-resolve-mcp/issues/336)
610
+ - **Tags:** silent-failure, timeline, export
611
+
612
+ ### TimelineItem.SetPosition / Timeline.MoveItems
613
+
614
+ - **Object:** `TimelineItem / Timeline`
615
+ - **Signature:** `SetPosition(...) -> bool; MoveItems(...) -> bool`
616
+ - **Behavior:** On Studio 21.1.2.10 (Windows), TimelineItem.SetPosition and Timeline.MoveItems returned False for video clips and stills, for int and float start frames, for a no-op startFrame equal to the clip's current frame, for both moveLinkedItems values, and with or without subframePrecision. Timeline.SetCurrentTimecode succeeded in the same session. This server does not call either method. Not re-measured here.
617
+ - **Workaround / current handling:** Do not treat False from these two as a bad argument. On 21.1.2.10 they returned False for every input tried. Move the clip in the Edit page.
618
+ - **Reference:** [issue #336](https://github.com/samuelgursky/davinci-resolve-mcp/issues/336)
619
+ - **Tags:** unreliable-return, timeline, edit
620
+
621
+ ### TimelineItem.SetLeftOffset
622
+
623
+ - **Object:** `TimelineItem`
624
+ - **Signature:** `(offset, ...) -> bool`
625
+ - **Behavior:** On Studio 21.1.2.10 (Windows), SetLeftOffset(5.0, False, True) on a clip at frame 400 with duration 120 returned True, moved the start to about -86000, and grew the duration to about 86515. Setting the offset back to 0 left the clip at about -86000. The call extends the clip from source media. It does not nudge the edit point, and the edit does not come back. A live gap probe on an older build recorded SetLeftOffset as absent. This server only reads GetLeftOffset. Not re-measured here.
626
+ - **Workaround / current handling:** Do not call SetLeftOffset to trim a handle. There is no API undo. Any future wrapper has to say that the call extends from source media and require an explicit confirm before it runs.
627
+ - **Reference:** [issue #336](https://github.com/samuelgursky/davinci-resolve-mcp/issues/336)
628
+ - **Tags:** silent-failure, timeline, edit, destructive
629
+
630
+ ### Timeline.AddMarker at relative frame 0
631
+
632
+ - **Object:** `Timeline`
633
+ - **Signature:** `(frameId, color, name, note, duration, customData) -> bool`
634
+ - **Behavior:** On Studio 21.1.2.10 (Windows), with StartFrame 86400, AddMarker(0) returned False and AddMarker(86400) returned False. AddMarker(200) returned True. Other clips accepted their relative GetStart(). Related to issue #34. This server already reports success false when AddMarker returns false. Not re-measured here.
635
+ - **Workaround / current handling:** Place the marker at a relative frame other than 0 when frame 0 is refused. Do not retry the same call with StartFrame added: that also returned False on 21.1.2.10.
636
+ - **Reference:** [issue #336](https://github.com/samuelgursky/davinci-resolve-mcp/issues/336)
637
+ - **Tags:** unreliable-return, timeline, marker
638
+
576
639
  ### hasattr() / getattr() on Resolve API objects (attribute fabrication)
577
640
 
578
641
  - **Object:** `(all Resolve scripting objects)`
package/install.py CHANGED
@@ -37,7 +37,7 @@ from src.utils.update_check import (
37
37
 
38
38
  # ─── Version ──────────────────────────────────────────────────────────────────
39
39
 
40
- VERSION = "4.18.2"
40
+ VERSION = "4.18.4"
41
41
  # Only hard floor: mcp[cli] requires Python 3.10+. There is no upper bound —
42
42
  # Resolve's scripting bridge loads into newer interpreters on recent builds
43
43
  # (Python 3.14 verified against Resolve Studio 20.3.2). Older Resolve builds
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "davinci-resolve-mcp",
3
- "version": "4.18.2",
3
+ "version": "4.18.4",
4
4
  "description": "NPM bootstrapper for the DaVinci Resolve MCP Server.",
5
5
  "license": "MIT",
6
6
  "author": "Samuel Gursky <samgursky@gmail.com>",
@@ -20,6 +20,7 @@ for path in (SRC_DIR, PROJECT_DIR):
20
20
  from mcp.server.fastmcp import FastMCP
21
21
  from mcp.types import ToolAnnotations
22
22
  from src.utils.mcp_error_flag import ErrorFlaggingFastMCP
23
+ from src.utils import subtitle_append_guard
23
24
 
24
25
  from src.utils.app_control import (
25
26
  get_app_state,
@@ -92,7 +93,7 @@ if not logging.getLogger().handlers:
92
93
  handlers=[logging.StreamHandler()],
93
94
  )
94
95
 
95
- VERSION = "4.18.2"
96
+ VERSION = "4.18.4"
96
97
  logger = logging.getLogger("davinci-resolve-mcp")
97
98
  logger.info(f"Starting DaVinci Resolve MCP Server v{VERSION}")
98
99
  logger.info(f"Detected platform: {get_platform()}")
@@ -679,6 +680,23 @@ def _normalize_record_frame(ci, index, timeline_start_frame=None):
679
680
  return start + rf, None
680
681
 
681
682
 
683
+ def _resolve_version_string():
684
+ """Connected Resolve version, or None. Called only for a subtitle clipInfo."""
685
+ try:
686
+ resolve = get_resolve()
687
+ except Exception:
688
+ return None
689
+ if resolve is None:
690
+ return None
691
+ getter = getattr(resolve, "GetVersionString", None)
692
+ if not callable(getter):
693
+ return None
694
+ try:
695
+ return getter()
696
+ except Exception:
697
+ return None
698
+
699
+
682
700
  def _build_append_clip_info_dict(root, ci, index, timeline_start_frame=None):
683
701
  """Build one MediaPool.AppendToTimeline clipInfo map (6 keys per docs line 221).
684
702
 
@@ -716,6 +734,16 @@ def _build_append_clip_info_dict(root, ci, index, timeline_start_frame=None):
716
734
  mt = ci.get("mediaType", ci.get("media_type"))
717
735
  if mt is not None:
718
736
  out["mediaType"] = mt
737
+ if subtitle_append_guard.is_subtitle_item(mp_item):
738
+ message = subtitle_append_guard.refusal_message(
739
+ out, _resolve_version_string(), index=index,
740
+ )
741
+ if message:
742
+ return None, {
743
+ "error": message,
744
+ "code": "SUBTITLE_APPEND_CRASH",
745
+ "retryable": False,
746
+ }
719
747
  return out, None
720
748
 
721
749
 
@@ -195,6 +195,9 @@ def append_to_timeline(
195
195
  relative to the current timeline start frame by default; pass
196
196
  record_frame_mode="absolute" for raw Resolve recordFrame values.
197
197
  Returns timeline_item_id per appended item.
198
+ A MediaPoolItem whose Type is Subtitle is refused on Resolve 21.1+
199
+ with code SUBTITLE_APPEND_CRASH. On Studio 21.1.2.10 that clipInfo
200
+ aborts Resolve (issue #335).
198
201
  """
199
202
  project, mp, err = _get_mp()
200
203
  if err:
package/src/server.py CHANGED
@@ -11,7 +11,7 @@ Usage:
11
11
  python src/server.py --full # Start the 377-tool granular server instead
12
12
  """
13
13
 
14
- VERSION = "4.18.2"
14
+ VERSION = "4.18.4"
15
15
 
16
16
  import base64
17
17
  import os
@@ -63,6 +63,7 @@ from src.utils.resolve211_edits import validate_edit_options, validate_transitio
63
63
  from src.utils.cdl import normalize_cdl_payload
64
64
  from src.utils.media_paths import media_exists as _media_exists
65
65
  from src.utils import archive_guard
66
+ from src.utils import subtitle_append_guard
66
67
  from src.utils import typed_api_search
67
68
  from src.utils import lut_files
68
69
  from src.utils import resolve_writes as _resolve_writes
@@ -3912,6 +3913,68 @@ def _timeline_start_frame(tl) -> Optional[int]:
3912
3913
  return None
3913
3914
 
3914
3915
 
3916
+ def _connected_resolve_version():
3917
+ """The connected Resolve version string, or None when it cannot be read.
3918
+
3919
+ Only called once a payload is already known to contain a subtitle clipInfo,
3920
+ so a missing connection is not an excuse to launch Resolve from a test.
3921
+ """
3922
+ try:
3923
+ resolve = get_resolve()
3924
+ except Exception:
3925
+ return None
3926
+ if resolve is None:
3927
+ return None
3928
+ getter = getattr(resolve, "GetVersionString", None)
3929
+ if not callable(getter):
3930
+ return None
3931
+ try:
3932
+ return getter()
3933
+ except Exception:
3934
+ return None
3935
+
3936
+
3937
+ def _payload_has_subtitle_clipinfo(payload) -> bool:
3938
+ rows = [payload] if isinstance(payload, dict) else payload
3939
+ if not isinstance(rows, list):
3940
+ return False
3941
+ for row in rows:
3942
+ if isinstance(row, dict) and subtitle_append_guard.is_subtitle_item(row.get("mediaPoolItem")):
3943
+ return True
3944
+ return False
3945
+
3946
+
3947
+ def _subtitle_append_block(payload, index=None):
3948
+ """Structured refusal for a subtitle clipInfo that would abort Resolve 21.1.
3949
+
3950
+ None when the payload may be forwarded. Clip objects, the plain
3951
+ AppendToTimeline([item]) form, are not clipInfos and are not refused.
3952
+ The version is read only after a subtitle clipInfo is present, so a
3953
+ normal append does not touch the Resolve connection from here.
3954
+ """
3955
+ if not _payload_has_subtitle_clipinfo(payload):
3956
+ return None
3957
+ message = subtitle_append_guard.refusal_message(
3958
+ payload, _connected_resolve_version(), index=index,
3959
+ )
3960
+ if not message:
3961
+ return None
3962
+ return _err(
3963
+ message,
3964
+ code="SUBTITLE_APPEND_CRASH",
3965
+ category="unsupported",
3966
+ retryable=False,
3967
+ reason=subtitle_append_guard.MEASURED,
3968
+ remediation=(
3969
+ "Do not send a clipInfo for a subtitle MediaPoolItem on Resolve 21.1. "
3970
+ "On Studio 21.1.2.10 that call aborts Resolve. The plain clip_ids form "
3971
+ "does not crash, and on that build it also places nothing. Import the "
3972
+ "SRT in the Resolve UI, or use project_db write_captions with Resolve "
3973
+ "fully quit."
3974
+ ),
3975
+ )
3976
+
3977
+
3915
3978
  def _build_append_clip_info_dict(
3916
3979
  root,
3917
3980
  ci: Dict[str, Any],
@@ -3965,6 +4028,9 @@ def _build_append_clip_info_dict(
3965
4028
  mt = ci.get("mediaType", ci.get("media_type"))
3966
4029
  if mt is not None:
3967
4030
  out["mediaType"] = mt
4031
+ blocked = _subtitle_append_block(out, index=index)
4032
+ if blocked:
4033
+ return None, blocked
3968
4034
  return out, None
3969
4035
 
3970
4036
 
@@ -4512,14 +4578,18 @@ def _append_clip_info_from_timeline_item(
4512
4578
  if src_end_excl is None or src_end_excl <= src_start:
4513
4579
  return None, _err("invalid source range")
4514
4580
  record = int(record_frame) if record_frame is not None else t_start + int(record_frame_offset)
4515
- return {
4581
+ info = {
4516
4582
  "mediaPoolItem": mpi,
4517
4583
  "startFrame": src_start,
4518
4584
  "endFrame": src_end_excl,
4519
4585
  "recordFrame": record,
4520
4586
  "trackIndex": int(target_track_index),
4521
4587
  "mediaType": int(media_type),
4522
- }, None
4588
+ }
4589
+ blocked = _subtitle_append_block(info)
4590
+ if blocked:
4591
+ return None, blocked
4592
+ return info, None
4523
4593
 
4524
4594
 
4525
4595
  def _find_appended_timeline_item_summary(
@@ -15603,6 +15673,9 @@ def _compare_timeline_append_readback(before, observed, expected_count: int):
15603
15673
 
15604
15674
 
15605
15675
  def _append_to_timeline_with_verification(proj, mp, append_payload, requested: Dict[str, Any], expected_count: int):
15676
+ blocked = _subtitle_append_block(append_payload)
15677
+ if blocked:
15678
+ return None, None, None, blocked
15606
15679
  raw_result = {"value": None}
15607
15680
  before = _timeline_append_readback_snapshot(proj)
15608
15681
 
@@ -15622,7 +15695,7 @@ def _append_to_timeline_with_verification(proj, mp, append_payload, requested: D
15622
15695
  intent=requested,
15623
15696
  label="media_pool.append_to_timeline",
15624
15697
  )
15625
- return raw_result["value"], verification, before
15698
+ return raw_result["value"], verification, before, None
15626
15699
 
15627
15700
 
15628
15701
  def _append_to_timeline_verified_operation(requested: Dict[str, Any], verification: Dict[str, Any], before):
@@ -23261,6 +23334,10 @@ def media_pool(action: str, params: Optional[Dict[str, Any]] = None) -> Dict[str
23261
23334
  record_frame is relative to the current timeline start frame by default;
23262
23335
  pass record_frame_mode="absolute" for raw Resolve recordFrame values.
23263
23336
  Returns timeline_item_id per item.
23337
+ A MediaPoolItem whose Type is Subtitle is refused on Resolve 21.1+
23338
+ (and when the version cannot be read) with SUBTITLE_APPEND_CRASH,
23339
+ before AppendToTimeline. On Studio 21.1.2.10 that clipInfo aborts
23340
+ Resolve (issue #335). Builds older than 21.1 are still forwarded.
23264
23341
  Either form: Resolve answering None/False/[] is APPEND_TO_TIMELINE_FAILED,
23265
23342
  with verified_operation (the timeline readback) kept on the error;
23266
23343
  retryable only when the readback shows nothing was appended.
@@ -23523,13 +23600,15 @@ def media_pool(action: str, params: Optional[Dict[str, Any]] = None) -> Dict[str
23523
23600
  "clip_info_count": len(raw),
23524
23601
  "expected_count": len(built),
23525
23602
  }
23526
- result, verification, before = _append_to_timeline_with_verification(
23603
+ result, verification, before, blocked = _append_to_timeline_with_verification(
23527
23604
  proj,
23528
23605
  mp,
23529
23606
  built,
23530
23607
  requested,
23531
23608
  len(built),
23532
23609
  )
23610
+ if blocked:
23611
+ return blocked
23533
23612
  if not result:
23534
23613
  return _append_to_timeline_failed(
23535
23614
  "Failed to append clip_infos to timeline", result, requested, verification, before,
@@ -23561,13 +23640,15 @@ def media_pool(action: str, params: Optional[Dict[str, Any]] = None) -> Dict[str
23561
23640
  "resolved_clip_count": len(clips),
23562
23641
  "expected_count": len(clips),
23563
23642
  }
23564
- result, verification, before = _append_to_timeline_with_verification(
23643
+ result, verification, before, blocked = _append_to_timeline_with_verification(
23565
23644
  proj,
23566
23645
  mp,
23567
23646
  clips,
23568
23647
  requested,
23569
23648
  len(clips),
23570
23649
  )
23650
+ if blocked:
23651
+ return blocked
23571
23652
  if not result:
23572
23653
  return _append_to_timeline_failed(
23573
23654
  "Failed to append clip_ids to timeline", result, requested, verification, before,
@@ -1758,19 +1758,166 @@ API_TRUTH: List[Dict[str, Any]] = [
1758
1758
  "The language selection via resolve.AUTO_CAPTION_LANGUAGE_* "
1759
1759
  "is the only customization; the engine itself cannot be "
1760
1760
  "changed. There is no dedicated subtitle import method. "
1761
- "However, MediaPool.ImportMedia(srt) + AppendToTimeline was "
1762
- "reported working on Studio 21.0.4.5 (issue #169). Whether "
1763
- "that route carries word timing for animated presets on "
1764
- "21.1 has not been verified; SRT contains only cue timing.",
1761
+ "MediaPool.ImportMedia(srt) + AppendToTimeline was reported "
1762
+ "working on Studio 21.0.4.5 (issue #169). On Studio 21.1.2.10 "
1763
+ "the clipInfo form of that append aborts Resolve and the plain "
1764
+ "form places nothing (issue #335). Whether either route carries "
1765
+ "word timing for animated presets has not been verified; SRT "
1766
+ "contains only cue timing.",
1765
1767
  "recommended": "Use Resolve's engine for CreateSubtitlesFromAudio. "
1766
- "For external SRT, test ImportMedia + AppendToTimeline "
1767
- "on the exact installed build or import through the UI. "
1768
+ "For external SRT on 21.1.2, import through the UI. "
1769
+ "clipInfo append of a subtitle item is refused on 21.1+ "
1770
+ "(see MediaPool.AppendToTimeline subtitle clipInfo). "
1768
1771
  "Use project_db write_captions for explicit word timings "
1769
1772
  "with Resolve fully quit; do not assume SRT supplies them.",
1770
1773
  "tags": ["missing-method", "subtitle", "transcription",
1771
1774
  "speech-recognition", "asr"],
1772
1775
  "submit": "missing",
1773
1776
  },
1777
+ {
1778
+ "symbol": "MediaPool.AppendToTimeline (subtitle clipInfo)",
1779
+ "object": "MediaPool",
1780
+ "signature": "([{clipInfo}]) -> [TimelineItem]",
1781
+ "reality": "On Studio 21.1.2.10 (Windows), AppendToTimeline with a "
1782
+ "clipInfo dict for an imported SRT MediaPoolItem (Type "
1783
+ "Subtitle) aborts Resolve: assertion at Sm2MpObject.cpp:546, "
1784
+ "reproduced 2/2. The call hangs, then the process is gone. "
1785
+ "The plain list form AppendToTimeline([item]) does not crash "
1786
+ "and places nothing. ImportMedia(srt) + AppendToTimeline was "
1787
+ "reported working on Studio 21.0.4.5 (issue #169). Which "
1788
+ "clipInfo field triggers the abort was not isolated. Builds "
1789
+ "21.1.0 and 21.1.1 were not measured.",
1790
+ "recommended": "media_pool append_to_timeline, the granular "
1791
+ "append_to_timeline, and the other clipInfo builders "
1792
+ "refuse a Type=Subtitle item on Resolve 21.1 and above, "
1793
+ "and when the connected version cannot be read, with "
1794
+ "SUBTITLE_APPEND_CRASH, before AppendToTimeline is called. "
1795
+ "On a build older than 21.1 the call is still forwarded. "
1796
+ "Import the SRT through the UI on 21.1.2.",
1797
+ "tags": ["crash", "subtitle", "timeline", "silent-failure"],
1798
+ "submit": "bug",
1799
+ "issue": 335,
1800
+ "mitigation": ["subtitle_append_guard"],
1801
+ "verified_on": "Reported on DaVinci Resolve Studio 21.1.2.10 (Windows); not re-measured here",
1802
+ },
1803
+ {
1804
+ "symbol": "Timeline.DeleteGaps",
1805
+ "object": "Timeline",
1806
+ "signature": "() -> bool",
1807
+ "reality": "On Studio 21.1.2.10 (Windows), DeleteGaps() returned True "
1808
+ "and left every clip start unchanged, with gaps at 0/200 and "
1809
+ "again at 0/200/400. This server does not call DeleteGaps. "
1810
+ "Not re-measured here.",
1811
+ "recommended": "Read the clip starts before and after. Treat equal "
1812
+ "readings as failure even when the call returned True. "
1813
+ "Close the gaps in the Edit page until a build shows "
1814
+ "the starts actually move.",
1815
+ "tags": ["silent-failure", "timeline", "edit"],
1816
+ "submit": "bug",
1817
+ "issue": 336,
1818
+ "verified_on": "Reported on DaVinci Resolve Studio 21.1.2.10 (Windows); not re-measured here",
1819
+ },
1820
+ {
1821
+ "symbol": "MediaPool.AddToPhotoAlbum",
1822
+ "object": "MediaPool",
1823
+ "signature": "(clips) -> [MediaPoolItem]",
1824
+ "reality": "On Studio 21.1.2.10 (Windows), AddToPhotoAlbum returned [] "
1825
+ "and the album's GetPhotoList() stayed empty, including "
1826
+ "after SetCurrentPhotoAlbum. CreatePhotoAlbumFromPhotos "
1827
+ "placed photos in the same session. On Studio 19.1.3.7 "
1828
+ "(2026-11-01, dir() of the open project's MediaPool), "
1829
+ "AddToPhotoAlbum, CreateEmptyPhotoAlbum, "
1830
+ "CreatePhotoAlbumFromPhotos, and GetCurrentPhotoAlbum are "
1831
+ "absent.",
1832
+ "recommended": "On 21.1.2, count the album's photos before and after "
1833
+ "and treat an unchanged count as failure. On 19.1.3.7 "
1834
+ "the methods are not there; do not call them.",
1835
+ "tags": ["silent-failure", "media-pool", "missing-method"],
1836
+ "submit": "bug",
1837
+ "issue": 336,
1838
+ "verified_on": "dir() on Studio 19.1.3.7; the empty-list result is reported on 21.1.2.10 and was not re-measured here",
1839
+ },
1840
+ {
1841
+ "symbol": "Timeline.ExportFrame",
1842
+ "object": "Timeline",
1843
+ "signature": "(frameOffset, settings) -> dict",
1844
+ "reality": "On Studio 21.1.2.10 (Windows), Timeline.ExportFrame returned "
1845
+ "{'success': False, 'error': 'frameOffset is out of range "
1846
+ "for the timeline'} for offsets 0, 5, 100, 200, 216000, and "
1847
+ "216010. The same frames exported through "
1848
+ "TimelineItem.ExportFrame. The timeline reported "
1849
+ "StartTimecode 01:00:00:00, StartFrame 86400, and EndFrame "
1850
+ "86400. Not re-measured here; this machine had no current "
1851
+ "timeline to dir().",
1852
+ "recommended": "Export through TimelineItem.ExportFrame. If "
1853
+ "GetStartFrame() and GetEndFrame() are equal, the "
1854
+ "timeline export has no frame range to address.",
1855
+ "tags": ["silent-failure", "timeline", "export"],
1856
+ "submit": "bug",
1857
+ "issue": 336,
1858
+ "verified_on": "Reported on DaVinci Resolve Studio 21.1.2.10 (Windows); not re-measured here",
1859
+ },
1860
+ {
1861
+ "symbol": "TimelineItem.SetPosition / Timeline.MoveItems",
1862
+ "object": "TimelineItem / Timeline",
1863
+ "signature": "SetPosition(...) -> bool; MoveItems(...) -> bool",
1864
+ "reality": "On Studio 21.1.2.10 (Windows), TimelineItem.SetPosition "
1865
+ "and Timeline.MoveItems returned False for video clips and "
1866
+ "stills, for int and float start frames, for a no-op "
1867
+ "startFrame equal to the clip's current frame, for both "
1868
+ "moveLinkedItems values, and with or without "
1869
+ "subframePrecision. Timeline.SetCurrentTimecode succeeded "
1870
+ "in the same session. This server does not call either "
1871
+ "method. Not re-measured here.",
1872
+ "recommended": "Do not treat False from these two as a bad argument. "
1873
+ "On 21.1.2.10 they returned False for every input tried. "
1874
+ "Move the clip in the Edit page.",
1875
+ "tags": ["unreliable-return", "timeline", "edit"],
1876
+ "submit": "bug",
1877
+ "issue": 336,
1878
+ "verified_on": "Reported on DaVinci Resolve Studio 21.1.2.10 (Windows); not re-measured here",
1879
+ },
1880
+ {
1881
+ "symbol": "TimelineItem.SetLeftOffset",
1882
+ "object": "TimelineItem",
1883
+ "signature": "(offset, ...) -> bool",
1884
+ "reality": "On Studio 21.1.2.10 (Windows), SetLeftOffset(5.0, False, "
1885
+ "True) on a clip at frame 400 with duration 120 returned "
1886
+ "True, moved the start to about -86000, and grew the "
1887
+ "duration to about 86515. Setting the offset back to 0 "
1888
+ "left the clip at about -86000. The call extends the clip "
1889
+ "from source media. It does not nudge the edit point, and "
1890
+ "the edit does not come back. A live gap probe on an older "
1891
+ "build recorded SetLeftOffset as absent. This server only "
1892
+ "reads GetLeftOffset. Not re-measured here.",
1893
+ "recommended": "Do not call SetLeftOffset to trim a handle. There is "
1894
+ "no API undo. Any future wrapper has to say that the "
1895
+ "call extends from source media and require an explicit "
1896
+ "confirm before it runs.",
1897
+ "tags": ["silent-failure", "timeline", "edit", "destructive"],
1898
+ "submit": "bug",
1899
+ "issue": 336,
1900
+ "verified_on": "Reported on DaVinci Resolve Studio 21.1.2.10 (Windows); not re-measured here",
1901
+ },
1902
+ {
1903
+ "symbol": "Timeline.AddMarker at relative frame 0",
1904
+ "object": "Timeline",
1905
+ "signature": "(frameId, color, name, note, duration, customData) -> bool",
1906
+ "reality": "On Studio 21.1.2.10 (Windows), with StartFrame 86400, "
1907
+ "AddMarker(0) returned False and AddMarker(86400) returned "
1908
+ "False. AddMarker(200) returned True. Other clips accepted "
1909
+ "their relative GetStart(). Related to issue #34. This "
1910
+ "server already reports success false when AddMarker "
1911
+ "returns false. Not re-measured here.",
1912
+ "recommended": "Place the marker at a relative frame other than 0 "
1913
+ "when frame 0 is refused. Do not retry the same call "
1914
+ "with StartFrame added: that also returned False on "
1915
+ "21.1.2.10.",
1916
+ "tags": ["unreliable-return", "timeline", "marker"],
1917
+ "submit": "bug",
1918
+ "issue": 336,
1919
+ "verified_on": "Reported on DaVinci Resolve Studio 21.1.2.10 (Windows); not re-measured here",
1920
+ },
1774
1921
  {
1775
1922
  "symbol": "Media Pool folder rename",
1776
1923
  "object": "MediaPool",
@@ -238,6 +238,10 @@ def _probe_pool_clip_marker_roundtrip(ctx):
238
238
 
239
239
  @probe("pool.append_to_timeline", "media_pool", timeout=60, needs=("clip", "timeline"), destructive=True)
240
240
  def _probe_pool_append_to_timeline(ctx):
241
+ from src.utils.subtitle_append_guard import is_subtitle_item
242
+ if is_subtitle_item(ctx.clip):
243
+ return ("refused: a subtitle clipInfo aborts Resolve 21.1.2 "
244
+ "(Sm2MpObject.cpp:546, issue #335)")
241
245
  pool = ctx.project.GetMediaPool()
242
246
  before = ctx.timeline.GetEndFrame()
243
247
  frames = int(ctx.clip.GetClipProperty("Frames") or 0)
@@ -122,7 +122,7 @@ class PathPolicy:
122
122
 
123
123
  @staticmethod
124
124
  def _under(path: str, roots: Tuple[str, ...]) -> bool:
125
- return any(path == root or path.startswith(root + os.sep) for root in roots)
125
+ return any(path == root or path.startswith(os.path.join(root, "")) for root in roots)
126
126
 
127
127
  def input_file(self, raw: Any) -> str:
128
128
  if not isinstance(raw, str) or not raw:
@@ -0,0 +1,91 @@
1
+ """Refuse a subtitle clipInfo before AppendToTimeline can abort Resolve.
2
+
3
+ On Studio 21.1.2.10 (Windows), ``MediaPool.AppendToTimeline`` with a clipInfo
4
+ dict whose ``mediaPoolItem`` has ``GetClipProperty("Type") == "Subtitle"``
5
+ aborts the process: assertion at ``Sm2MpObject.cpp:546``, reproduced twice
6
+ (issue #335). The plain list form, ``AppendToTimeline([item])``, does not
7
+ crash, and on that build it also places nothing.
8
+
9
+ ``ImportMedia`` plus ``AppendToTimeline`` was reported working on Studio
10
+ 21.0.4.5 (issue #169). Builds 21.1.0 and 21.1.1 were not measured. Every
11
+ 21.1 build is refused, and so is a subtitle clipInfo when the connected
12
+ version cannot be read: forwarding the call is what takes Resolve down.
13
+ """
14
+
15
+ from typing import Any, Optional
16
+
17
+ from src.utils.resolve_versions import at_least
18
+
19
+ #: First build line on which the clipInfo form is refused.
20
+ FLOOR = "21.1"
21
+
22
+ MEASURED = (
23
+ "Reported on DaVinci Resolve Studio 21.1.2.10 (Windows), reproduced 2/2: "
24
+ "MediaPool.AppendToTimeline with a clipInfo for a Type=Subtitle MediaPoolItem "
25
+ "aborts Resolve (Sm2MpObject.cpp:546). The plain clip list does not crash and "
26
+ "places nothing. ImportMedia + AppendToTimeline was reported working on Studio "
27
+ "21.0.4.5 (issue #169). 21.1.0 and 21.1.1 were not measured."
28
+ )
29
+
30
+
31
+ def is_subtitle_item(item: Any) -> bool:
32
+ """True when the MediaPoolItem reports Type Subtitle.
33
+
34
+ A missing getter, a failed read, or a non-string (Resolve returns False
35
+ for an unknown property) is not a subtitle. Only an explicit type match
36
+ refuses the call.
37
+ """
38
+ getter = getattr(item, "GetClipProperty", None)
39
+ if not callable(getter):
40
+ return False
41
+ try:
42
+ value = getter("Type")
43
+ except Exception:
44
+ return False
45
+ if not isinstance(value, str):
46
+ return False
47
+ return value.strip().casefold() == "subtitle"
48
+
49
+
50
+ def refuses(version: Any) -> bool:
51
+ """True when this version must not receive a subtitle clipInfo.
52
+
53
+ ``None`` from :func:`at_least` means the version did not parse. That is
54
+ refused too.
55
+ """
56
+ affected = at_least(version, FLOOR)
57
+ return affected is None or affected
58
+
59
+
60
+ def refusal_message(payload: Any, version: Any, index: Optional[int] = None) -> Optional[str]:
61
+ """The refusal text, or None when the payload may be forwarded.
62
+
63
+ ``payload`` is one clipInfo dict or a list of them. Clip objects, the
64
+ plain ``AppendToTimeline([item])`` form, are not clipInfos and are left
65
+ alone.
66
+ """
67
+ rows = [payload] if isinstance(payload, dict) else payload
68
+ if not isinstance(rows, list):
69
+ return None
70
+ hits = []
71
+ for i, row in enumerate(rows):
72
+ if not isinstance(row, dict):
73
+ continue
74
+ item = row.get("mediaPoolItem")
75
+ if item is not None and is_subtitle_item(item):
76
+ hits.append(i)
77
+ if not hits or not refuses(version):
78
+ return None
79
+ shown = hits[0] if index is None else index
80
+ if at_least(version, FLOOR) is None:
81
+ return (
82
+ f"clip_infos[{shown}] is a subtitle MediaPoolItem, and the connected "
83
+ "Resolve version could not be read. AppendToTimeline with a clipInfo "
84
+ "for that item aborts Resolve Studio 21.1.2.10 (Sm2MpObject.cpp:546, "
85
+ "issue #335), so the call is refused."
86
+ )
87
+ return (
88
+ f"clip_infos[{shown}] is a subtitle MediaPoolItem. On Resolve {version}, "
89
+ "AppendToTimeline with a clipInfo for that item is refused: on Studio "
90
+ "21.1.2.10 it aborts Resolve (Sm2MpObject.cpp:546, issue #335)."
91
+ )