davinci-resolve-mcp 5.2.6 → 5.2.8
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 +34 -0
- package/README.md +1 -1
- package/README.zh-CN.md +2 -2
- package/docs/reference/api-coverage.md +11 -10
- package/install.py +1 -1
- package/package.json +1 -1
- package/src/granular/common.py +1 -1
- package/src/granular/project.py +6 -1
- package/src/server.py +26 -3
- package/src/utils/destructive_hook.py +17 -3
- package/src/utils/render_target.py +47 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,40 @@
|
|
|
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 v5.2.8 — Three calls stop answering success while dropping the request
|
|
6
|
+
|
|
7
|
+
From #365, #366 and #368 by @willturner-maker.
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **`record_frame_mode` beside `clip_infos` was dropped (#365).** `media_pool` `append_to_timeline` and `create_timeline_from_clips` read the mode only from each row, so `record_frame_mode: "absolute"` passed at the top level was ignored and an absolute frame landed start-relative with `success: true`. The top-level mode now applies to every row that sets none of its own. A row's own mode still wins, and an absolute frame before the timeline start is refused, as it already was per row.
|
|
12
|
+
- **`timeline.duplicate` archived the source timeline (#366).** Version-on-mutate archived the untouched source before every duplicate, leaving `_archived_vNN` siblings that read as evidence of an edit. Duplicate stays registered, so safe mode and the audit log still apply, but it no longer archives. `_versioning.skipped_reason` is `source_timeline_unchanged`.
|
|
13
|
+
- **`render.set_settings` took a `TargetDir` that does not exist (#368).** Resolve accepts it there and refuses only at `add_job` or render start. `set_settings` and the granular `set_render_settings` now refuse it before anything is sent, with code `TARGET_DIR_NOT_FOUND`.
|
|
14
|
+
|
|
15
|
+
### Not changed
|
|
16
|
+
|
|
17
|
+
- **#367** (`get_clips_linked` ignoring `timeline_id`) does not reproduce against the compound tool: the pin switches, the item is found on the pinned timeline and the current timeline is restored. A regression test now covers it.
|
|
18
|
+
|
|
19
|
+
### Not verified here
|
|
20
|
+
|
|
21
|
+
- Offline tests only. The reports were measured on Studio 21.2.0.6; this machine runs Studio 19.1.3.7, and no live Resolve run was made for this release.
|
|
22
|
+
|
|
23
|
+
## What's New in v5.2.7 — Preset and media rows live-tested with fixtures
|
|
24
|
+
|
|
25
|
+
From #363 by @Ghoul0718. No server behaviour changes.
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
|
|
29
|
+
- **`tests/live_preset_fixture_validation.py`**, a live harness for the API coverage rows marked "needs fixture". It builds what each call needs from synthetic ffmpeg media, runs relink and sync in a disposable project that it deletes afterwards, restores the open project, and sweeps every `ZZ_r2104_` preset so each preset list ends as it started. Presets that existed before the run are never deleted. No scripting call creates a burn-in preset, so `--burnin-wait N` waits while a person saves one in Workspace > Data Burn-In.
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
|
|
33
|
+
- **API coverage:** `SaveLayoutPreset`, `ImportRenderPreset`, `ExportRenderPreset`, `ImportBurnInPreset`, `ExportBurnInPreset` and `DeleteBurnInPreset` (Resolve), and `RelinkClips` and `AutoSyncAudio` (MediaPool) move from ⚠️ to ✅. Totals do not change, since both marks count as live-tested. The rows record that preset exports write `<name>.xml` inside a folder (v5.2.6) and that `AutoSyncAudio` over the bridge needs v5.2.5.
|
|
34
|
+
|
|
35
|
+
### Not verified here
|
|
36
|
+
|
|
37
|
+
- The live results are the contributor's, from free 21.0.4.5 on macOS, with the burn-in round trip on a preset saved by hand. This machine runs Studio 19.1.3.7 and did not rerun the harness.
|
|
38
|
+
|
|
5
39
|
## What's New in v5.2.6 — Preset exports report the file Resolve writes
|
|
6
40
|
|
|
7
41
|
From #362 by @Ghoul0718.
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
English | [简体中文](README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
[](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
|
|
6
6
|
[](https://www.npmjs.com/package/davinci-resolve-mcp)
|
|
7
7
|
[](docs/reference/api-coverage.md)
|
|
8
8
|
[-blue.svg)](#server-modes)
|
package/README.zh-CN.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | 简体中文
|
|
4
4
|
|
|
5
|
-
[](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
|
|
6
6
|
[](https://www.npmjs.com/package/davinci-resolve-mcp)
|
|
7
7
|
[](docs/reference/api-coverage.md)
|
|
8
8
|
[-blue.svg)](#服务器模式)
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
[](https://www.python.org/downloads/)
|
|
13
13
|
[](https://opensource.org/licenses/MIT)
|
|
14
14
|
|
|
15
|
-
> 本翻译对应 v5.2.
|
|
15
|
+
> 本翻译对应 v5.2.8 版 README。如与英文原版有出入,以 [英文原版](README.md) 为准。
|
|
16
16
|
|
|
17
17
|
一个 Model Context Protocol (MCP) 服务器,让 AI 助手通过官方脚本 API 控制 DaVinci Resolve Studio(达芬奇)。它提供完整的 API 覆盖,外加带护栏的工作流助手,涵盖剪辑、媒体池整理、渲染设置、审阅标记、调色、Fusion、Fairlight、项目生命周期任务、扩展开发,以及不碰源媒体的媒体分析。
|
|
18
18
|
|
|
@@ -139,7 +139,7 @@ source, these summaries are downstream of it:
|
|
|
139
139
|
| Phase 5 | 6/6 | 100% | Scene cuts, subtitles from audio, graph node cache/tools/enable |
|
|
140
140
|
| Resolve 20 delta | 12/12 | 100% | Resolve 20.0-20.2.2 scripting additions live-tested on 20.3.2 |
|
|
141
141
|
| Resolve 21 delta | 7/7 | 100% | Resolve 21.0 additions that could be executed, live-tested on Studio 21.0.2.4 (`tests/live_resolve21_validation.py`). The other 6 need an AI Extras pack or are unsafe to run — counted as untested, not as passes |
|
|
142
|
-
| Resolve 21.0.4 delta | 11/11 | 100% | Resolve 21.0.4 additions live-tested on free 21.0.4.5 through the in-app bridge (`tests/live_resolve2104_validation.py
|
|
142
|
+
| Resolve 21.0.4 delta | 11/11 | 100% | Resolve 21.0.4 additions live-tested on free 21.0.4.5 through the in-app bridge (`tests/live_resolve2104_validation.py`; `DeleteBurnInPreset` on an existing preset in `tests/live_preset_fixture_validation.py`). `LoadUserPreferencesPreset` swaps the user's global preferences, so it is not executed and stays untested |
|
|
143
143
|
| **Total** | **349/349** | **100%** | **96.7% of the 361 covered methods tested live** |
|
|
144
144
|
|
|
145
145
|
#### Resolve 21 delta detail
|
|
@@ -187,7 +187,8 @@ close them. Eleven of the twelve 21.0.4 rows are now live-tested on free 21.0.4.
|
|
|
187
187
|
through the in-app bridge (`tests/live_resolve2104_validation.py`); they had
|
|
188
188
|
carried contributor reports from Studio 21.0.4.5 (issue #131, issues #135–#138,
|
|
189
189
|
PR #139), and the live run agrees with them. `DeleteBurnInPreset` is tested on a
|
|
190
|
-
missing name
|
|
190
|
+
missing name and on a preset saved by hand, because no scripting API creates a
|
|
191
|
+
burn-in preset to delete.
|
|
191
192
|
`LoadUserPreferencesPreset` stays untested: it swaps the user's global
|
|
192
193
|
preferences for the session, so it is not executed. Likewise
|
|
193
194
|
`DisableBackgroundTasksForCurrentResolveSession` is a
|
|
@@ -223,20 +224,20 @@ Every method in the DaVinci Resolve Scripting API and its test status. Methods a
|
|
|
223
224
|
| 10 | `UpdateLayoutPreset(presetName)` | ✅ | Updates existing preset |
|
|
224
225
|
| 11 | `ExportLayoutPreset(presetName, presetFilePath)` | ✅ | Exports preset to file |
|
|
225
226
|
| 12 | `DeleteLayoutPreset(presetName)` | ✅ | Deletes preset |
|
|
226
|
-
| 13 | `SaveLayoutPreset(presetName)` |
|
|
227
|
+
| 13 | `SaveLayoutPreset(presetName)` | ✅ | Saves a fresh name (listed by `GetLayoutPresetList` afterwards); returns `False` for an existing name and does not list it twice. Live on free 21.0.4.5 through the in-app bridge (`tests/live_preset_fixture_validation.py`) |
|
|
227
228
|
| 14 | `ImportLayoutPreset(presetFilePath, presetName)` | ✅ | Imports preset from file |
|
|
228
229
|
| 15 | `Quit()` | ✅ | Quits DaVinci Resolve |
|
|
229
|
-
| 16 | `ImportRenderPreset(presetPath)` |
|
|
230
|
-
| 17 | `ExportRenderPreset(presetName, exportPath)` |
|
|
231
|
-
| 18 | `ImportBurnInPreset(presetPath)` |
|
|
232
|
-
| 19 | `ExportBurnInPreset(presetName, exportPath)` |
|
|
230
|
+
| 16 | `ImportRenderPreset(presetPath)` | ✅ | Takes the exported `.xml` file; after `DeleteRenderPreset` the import restores the preset under its exported name. Live on free 21.0.4.5 through the in-app bridge (`tests/live_preset_fixture_validation.py`) |
|
|
231
|
+
| 17 | `ExportRenderPreset(presetName, exportPath)` | ✅ | **`exportPath` is a folder**: Resolve creates it and writes `<presetName>.xml` inside (a path ending in `.xml` becomes a folder of that name). Live on free 21.0.4.5 through the in-app bridge (`tests/live_preset_fixture_validation.py`) |
|
|
232
|
+
| 18 | `ImportBurnInPreset(presetPath)` | ✅ | Takes the exported `.xml` file; after `DeleteBurnInPreset` the import restores the preset. Live on free 21.0.4.5 through the in-app bridge, on a preset saved by hand in Workspace > Data Burn-In (`tests/live_preset_fixture_validation.py --burnin-wait`) |
|
|
233
|
+
| 19 | `ExportBurnInPreset(presetName, exportPath)` | ✅ | **`exportPath` is a folder**, as for `ExportRenderPreset`: Resolve writes `<presetName>.xml` inside it. Live on free 21.0.4.5 through the in-app bridge (`tests/live_preset_fixture_validation.py --burnin-wait`) |
|
|
233
234
|
| 20 | `GetKeyframeMode()` | ✅ | Returns keyframe mode |
|
|
234
235
|
| 21 | `SetKeyframeMode(keyframeMode)` | ⚠️ | API accepts; mode must match valid enum |
|
|
235
236
|
| 22 | `GetFairlightPresets()` | ✅ | Returns a preset map. Live on 20.3.2 Studio and 21.0.3 free; **absent below 20.2.2** — confirmed missing on 19.1.3, so the version floor is verified from both sides |
|
|
236
237
|
| 23 | `DisableBackgroundTasksForCurrentResolveSession()` | 🔬 | Resolve 21.0. Present in `dir()`; **not executed** — session-wide, returns `None`, no `Enable...` counterpart, so no undo short of restarting Resolve |
|
|
237
238
|
| 24 | `GetLayoutPresetList()` | ✅ | Resolve 21.0.4. Returns a list (live-tested on free 21.0.4.5 through the in-app bridge (`tests/live_resolve2104_validation.py`)); also reported via a save→list→delete round-trip on Studio 21.0.4.5 in issue #137 |
|
|
238
239
|
| 25 | `GetBurnInPresetList()` | ✅ | Resolve 21.0.4. Returns a list (live-tested on free 21.0.4.5 through the in-app bridge (`tests/live_resolve2104_validation.py`)); reported returning a list on Studio 21.0.4.5 in issue #136 |
|
|
239
|
-
| 26 | `DeleteBurnInPreset(presetName)` |
|
|
240
|
+
| 26 | `DeleteBurnInPreset(presetName)` | ✅ | Resolve 21.0.4. Deletes an existing preset (gone from `GetBurnInPresetList`); returns `False` for a name that does not exist and leaves the list unchanged. No scripting API creates a burn-in preset, so the real delete runs on one saved by hand (`tests/live_preset_fixture_validation.py --burnin-wait`); the missing-name case is in `tests/live_resolve2104_validation.py`. Live on free 21.0.4.5 through the in-app bridge |
|
|
240
241
|
| 27 | `GetUserPreferencesPresetList()` | ✅ | Resolve 21.0.4. Returns a list of names; a saved preset appears and a deleted one disappears (live-tested on free 21.0.4.5 through the in-app bridge (`tests/live_resolve2104_validation.py`)); also issue #138 on Studio 21.0.4.5 |
|
|
241
242
|
| 28 | `SaveUserPreferencesPreset(presetName)` | ✅ | Resolve 21.0.4. Returns `True` and the preset is listed (live-tested on free 21.0.4.5 through the in-app bridge (`tests/live_resolve2104_validation.py`)) |
|
|
242
243
|
| 29 | `LoadUserPreferencesPreset(presetName)` | 🔬 | Resolve 21.0.4. `dir()`-present on 21.0.4.5; **not executed** even by the reporter — swaps the user's global preferences session-wide (issue #138) |
|
|
@@ -359,13 +360,13 @@ Every method in the DaVinci Resolve Scripting API and its test status. Methods a
|
|
|
359
360
|
| 16 | `GetClipMatteList(item)` | ✅ | Returns matte paths |
|
|
360
361
|
| 17 | `GetTimelineMatteList(folder)` | ✅ | Returns matte items |
|
|
361
362
|
| 18 | `DeleteClipMattes(item, [paths])` | ✅ | Deletes clip mattes |
|
|
362
|
-
| 19 | `RelinkClips([items], folderPath)` |
|
|
363
|
+
| 19 | `RelinkClips([items], folderPath)` | ✅ | After the clip's file is moved, relinking to the new folder returns True and the clip's `File Path` points into it. Live on free 21.0.4.5 through the in-app bridge (`tests/live_preset_fixture_validation.py`) |
|
|
363
364
|
| 20 | `UnlinkClips([items])` | ✅ | Unlinks clips |
|
|
364
365
|
| 21 | `ImportMedia([items])` | ✅ | Imports media files |
|
|
365
366
|
| 22 | `ExportMetadata(fileName, [clips])` | ✅ | Exports metadata CSV |
|
|
366
367
|
| 23 | `GetUniqueId()` | ✅ | Returns UUID string |
|
|
367
368
|
| 24 | `CreateStereoClip(left, right)` | ✅ | Creates stereo pair |
|
|
368
|
-
| 25 | `AutoSyncAudio([items], {settings})` |
|
|
369
|
+
| 25 | `AutoSyncAudio([items], {settings})` | ✅ | Waveform sync of a video and a separate audio file sharing a noise track sets the video's `Synced Audio` property. Live on free 21.0.4.5 through the in-app bridge (`tests/live_preset_fixture_validation.py`); over the bridge this needs the settings dict's number keys kept (PR #361), without which Resolve ignores the settings and returns `False` |
|
|
369
370
|
| 26 | `GetSelectedClips()` | ✅ | Returns selected clips |
|
|
370
371
|
| 27 | `SetSelectedClip(item)` | ✅ | Selects clip |
|
|
371
372
|
|
package/install.py
CHANGED
|
@@ -37,7 +37,7 @@ from src.utils.update_check import (
|
|
|
37
37
|
|
|
38
38
|
# ─── Version ──────────────────────────────────────────────────────────────────
|
|
39
39
|
|
|
40
|
-
VERSION = "5.2.
|
|
40
|
+
VERSION = "5.2.8"
|
|
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
package/src/granular/common.py
CHANGED
|
@@ -93,7 +93,7 @@ if not logging.getLogger().handlers:
|
|
|
93
93
|
handlers=[logging.StreamHandler()],
|
|
94
94
|
)
|
|
95
95
|
|
|
96
|
-
VERSION = "5.2.
|
|
96
|
+
VERSION = "5.2.8"
|
|
97
97
|
logger = logging.getLogger("davinci-resolve-mcp")
|
|
98
98
|
logger.info(f"Starting DaVinci Resolve MCP Server v{VERSION}")
|
|
99
99
|
logger.info(f"Detected platform: {get_platform()}")
|
package/src/granular/project.py
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
from src.granular.common import * # noqa: F401,F403
|
|
4
4
|
from src.utils.bool_params import recognised_bool
|
|
5
5
|
from src.utils.page_lock import restoring_page
|
|
6
|
+
from src.utils.render_target import missing_target_dir, missing_target_dir_message
|
|
6
7
|
|
|
7
8
|
resolve = ResolveProxy()
|
|
8
9
|
|
|
@@ -1222,7 +1223,8 @@ def set_render_settings(settings: Dict[str, Any]) -> Dict[str, Any]:
|
|
|
1222
1223
|
Args:
|
|
1223
1224
|
settings: Dict of render settings. All documented keys are forwarded:
|
|
1224
1225
|
SelectAllFrames (bool), MarkIn (int), MarkOut (int),
|
|
1225
|
-
TargetDir (str
|
|
1226
|
+
TargetDir (str; must be an existing directory, refused before the
|
|
1227
|
+
call otherwise), CustomName (str), UniqueFilenameStyle (0=Prefix/1=Suffix),
|
|
1226
1228
|
ExportVideo (bool), ExportAudio (bool), FormatWidth (int),
|
|
1227
1229
|
FormatHeight (int), FrameRate (float), PixelAspectRatio (float),
|
|
1228
1230
|
VideoQuality (int/str), AudioCodec (str), AudioBitDepth (int),
|
|
@@ -1243,6 +1245,9 @@ def set_render_settings(settings: Dict[str, Any]) -> Dict[str, Any]:
|
|
|
1243
1245
|
if coerced is None:
|
|
1244
1246
|
return {"error": "UseUniqueFilenames must be a boolean (true/false)"}
|
|
1245
1247
|
settings = dict(settings, UseUniqueFilenames=coerced)
|
|
1248
|
+
missing_target = missing_target_dir(settings)
|
|
1249
|
+
if missing_target is not None:
|
|
1250
|
+
return {"error": missing_target_dir_message(missing_target)}
|
|
1246
1251
|
resolve = get_resolve()
|
|
1247
1252
|
if resolve is None:
|
|
1248
1253
|
return {"error": "Not connected to DaVinci Resolve"}
|
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 = "5.2.
|
|
14
|
+
VERSION = "5.2.8"
|
|
15
15
|
|
|
16
16
|
import base64
|
|
17
17
|
import os
|
|
@@ -64,6 +64,7 @@ from src.utils.film_cues import export_cue_sheet as _export_film_cue_sheet
|
|
|
64
64
|
from src.utils.cdl import normalize_cdl_payload
|
|
65
65
|
from src.utils.media_paths import media_exists as _media_exists
|
|
66
66
|
from src.utils.preset_files import preset_export_file as _preset_export_file
|
|
67
|
+
from src.utils.render_target import missing_target_dir_error as _missing_target_dir_error
|
|
67
68
|
from src.utils import archive_guard
|
|
68
69
|
from src.utils import subtitle_append_guard
|
|
69
70
|
from src.utils import typed_api_search
|
|
@@ -3917,6 +3918,24 @@ def _normalize_record_frame(
|
|
|
3917
3918
|
return start + rf, None
|
|
3918
3919
|
|
|
3919
3920
|
|
|
3921
|
+
def _rows_with_default_record_frame_mode(rows, p):
|
|
3922
|
+
"""Apply a top-level record_frame_mode to clip_infos rows that set none.
|
|
3923
|
+
|
|
3924
|
+
The mode used to be read only per row, so `record_frame_mode` passed beside
|
|
3925
|
+
`clip_infos` was dropped and an absolute frame landed start-relative with
|
|
3926
|
+
success (issue #365). A row's own mode still wins.
|
|
3927
|
+
"""
|
|
3928
|
+
mode = p.get("record_frame_mode", p.get("recordFrameMode"))
|
|
3929
|
+
if mode is None or not isinstance(rows, list):
|
|
3930
|
+
return rows
|
|
3931
|
+
out = []
|
|
3932
|
+
for ci in rows:
|
|
3933
|
+
if isinstance(ci, dict) and "record_frame_mode" not in ci and "recordFrameMode" not in ci:
|
|
3934
|
+
ci = {**ci, "record_frame_mode": mode}
|
|
3935
|
+
out.append(ci)
|
|
3936
|
+
return out
|
|
3937
|
+
|
|
3938
|
+
|
|
3920
3939
|
def _timeline_start_frame(tl) -> Optional[int]:
|
|
3921
3940
|
if not tl:
|
|
3922
3941
|
return None
|
|
@@ -23248,6 +23267,10 @@ def render(action: str, params: Optional[Dict[str, Any]] = None) -> Dict[str, An
|
|
|
23248
23267
|
category="invalid_input",
|
|
23249
23268
|
reason="Nothing was sent to SetRenderSettings.",
|
|
23250
23269
|
)
|
|
23270
|
+
target_refusal = _missing_target_dir_error(settings)
|
|
23271
|
+
if target_refusal:
|
|
23272
|
+
message = target_refusal.pop("message")
|
|
23273
|
+
return _err(message, **target_refusal)
|
|
23251
23274
|
result = {"success": bool(proj.SetRenderSettings(settings))}
|
|
23252
23275
|
if ignored_settings:
|
|
23253
23276
|
result["ignored_settings"] = ignored_settings
|
|
@@ -23570,7 +23593,7 @@ def media_pool(action: str, params: Optional[Dict[str, Any]] = None) -> Dict[str
|
|
|
23570
23593
|
if policy_result:
|
|
23571
23594
|
return policy_result
|
|
23572
23595
|
if p.get("clip_infos") is not None:
|
|
23573
|
-
raw = p["clip_infos"]
|
|
23596
|
+
raw = _rows_with_default_record_frame_mode(p["clip_infos"], p)
|
|
23574
23597
|
if not isinstance(raw, list):
|
|
23575
23598
|
return _err("clip_infos must be a list")
|
|
23576
23599
|
if not raw:
|
|
@@ -23677,7 +23700,7 @@ def media_pool(action: str, params: Optional[Dict[str, Any]] = None) -> Dict[str
|
|
|
23677
23700
|
"timelines_before": before_n, "timelines_after": after_n}
|
|
23678
23701
|
elif action == "append_to_timeline":
|
|
23679
23702
|
if p.get("clip_infos") is not None:
|
|
23680
|
-
raw = p["clip_infos"]
|
|
23703
|
+
raw = _rows_with_default_record_frame_mode(p["clip_infos"], p)
|
|
23681
23704
|
if not isinstance(raw, list):
|
|
23682
23705
|
return _err("clip_infos must be a list")
|
|
23683
23706
|
if not raw:
|
|
@@ -321,6 +321,17 @@ NON_TIMELINE_WRITE_TOOLS: frozenset = frozenset({
|
|
|
321
321
|
})
|
|
322
322
|
|
|
323
323
|
|
|
324
|
+
#: Registered timeline actions that leave the working timeline unchanged. They
|
|
325
|
+
#: keep every gate (safe mode, dry-run refusal, the audit log) but skip
|
|
326
|
+
#: version-on-mutate archiving. `timeline.duplicate` copies the current timeline
|
|
327
|
+
#: into a new one; archiving the untouched source before it wrote an
|
|
328
|
+
#: `_archived_vNN` sibling that read as evidence of an edit that never happened
|
|
329
|
+
#: (issue #366).
|
|
330
|
+
NON_MUTATING_TIMELINE_ACTIONS: FrozenSet[Tuple[str, str]] = frozenset({
|
|
331
|
+
("timeline", "duplicate"),
|
|
332
|
+
})
|
|
333
|
+
|
|
334
|
+
|
|
324
335
|
# ── Strict-mode allowlist ───────────────────────────────────────────────────
|
|
325
336
|
#
|
|
326
337
|
# Actions in this set REFUSE to run if the version-on-mutate archive fails. For
|
|
@@ -1282,7 +1293,10 @@ def destructive_op(tool_name: str) -> Callable[[Callable[..., Any]], Callable[..
|
|
|
1282
1293
|
recognised=risk_recognised,
|
|
1283
1294
|
)
|
|
1284
1295
|
|
|
1285
|
-
if tool_name in NON_TIMELINE_WRITE_TOOLS
|
|
1296
|
+
if (tool_name in NON_TIMELINE_WRITE_TOOLS
|
|
1297
|
+
or (tool_name, action) in NON_MUTATING_TIMELINE_ACTIONS):
|
|
1298
|
+
skipped_reason = ("not_a_timeline_mutation" if tool_name in NON_TIMELINE_WRITE_TOOLS
|
|
1299
|
+
else "source_timeline_unchanged")
|
|
1286
1300
|
result = fn(action, params, *args, **kwargs)
|
|
1287
1301
|
_audit_security_event(
|
|
1288
1302
|
operation_id=operation_id,
|
|
@@ -1291,14 +1305,14 @@ def destructive_op(tool_name: str) -> Callable[[Callable[..., Any]], Callable[..
|
|
|
1291
1305
|
risk_level=risk_level,
|
|
1292
1306
|
status="allowed",
|
|
1293
1307
|
params=params,
|
|
1294
|
-
reason=
|
|
1308
|
+
reason=skipped_reason,
|
|
1295
1309
|
recognised=risk_recognised,
|
|
1296
1310
|
)
|
|
1297
1311
|
if isinstance(result, dict):
|
|
1298
1312
|
result.setdefault("_versioning", {
|
|
1299
1313
|
"analysis_run_id": None,
|
|
1300
1314
|
"archived": False,
|
|
1301
|
-
"skipped_reason":
|
|
1315
|
+
"skipped_reason": skipped_reason,
|
|
1302
1316
|
})
|
|
1303
1317
|
return _annotate_security(
|
|
1304
1318
|
result,
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""Render TargetDir validation shared by the compound and granular servers.
|
|
2
|
+
|
|
3
|
+
`Project.SetRenderSettings` takes a TargetDir that does not exist and answers
|
|
4
|
+
True; the refusal only surfaces later, at `AddRenderJob` or when the job
|
|
5
|
+
starts (issue #368). The server runs on the machine Resolve renders on, so a
|
|
6
|
+
directory this process cannot see is one Resolve cannot write to either.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import os
|
|
12
|
+
from typing import Any, Dict, Optional
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def missing_target_dir(settings: Any) -> Optional[str]:
|
|
16
|
+
"""The TargetDir from `settings` when it names no existing directory, else None.
|
|
17
|
+
|
|
18
|
+
Only a non-empty string is checked; an absent key leaves the project's
|
|
19
|
+
current target alone, and other types are left to Resolve to refuse.
|
|
20
|
+
"""
|
|
21
|
+
if not isinstance(settings, dict):
|
|
22
|
+
return None
|
|
23
|
+
target = settings.get("TargetDir")
|
|
24
|
+
if not isinstance(target, str) or not target.strip():
|
|
25
|
+
return None
|
|
26
|
+
return None if os.path.isdir(target) else target
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def missing_target_dir_message(target: str) -> str:
|
|
30
|
+
return (
|
|
31
|
+
f"TargetDir does not exist: {target}. Nothing was sent to SetRenderSettings; "
|
|
32
|
+
"Resolve would accept it here and refuse only at add_job or render start."
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def missing_target_dir_error(settings: Any) -> Optional[Dict[str, Any]]:
|
|
37
|
+
"""Fields for a refusal, or None when TargetDir is absent or exists."""
|
|
38
|
+
target = missing_target_dir(settings)
|
|
39
|
+
if target is None:
|
|
40
|
+
return None
|
|
41
|
+
return {
|
|
42
|
+
"message": missing_target_dir_message(target),
|
|
43
|
+
"code": "TARGET_DIR_NOT_FOUND",
|
|
44
|
+
"category": "invalid_input",
|
|
45
|
+
"remediation": "Create the directory first, or pass an existing TargetDir.",
|
|
46
|
+
"state": {"TargetDir": target},
|
|
47
|
+
}
|