davinci-resolve-mcp 2.217.0 → 2.218.1
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 +124 -0
- package/README.md +4 -4
- package/README.zh-CN.md +5 -5
- package/docs/SKILL.md +3 -1
- package/docs/contributing.md +1 -1
- package/docs/install.md +2 -2
- package/docs/reference/api-coverage.md +3 -1
- package/docs/reference/api-limitations.md +1 -1
- package/docs/reference/readwrite-symmetry.md +3 -3
- package/docs/reference/resolve211-native-transitions.md +65 -0
- package/install.py +2 -2
- package/package.json +1 -1
- package/src/granular/common.py +1 -1
- package/src/granular/resolve_211.py +19 -2
- package/src/resolve_mcp_server.py +1 -1
- package/src/server.py +17 -6
- package/src/utils/api_truth.py +12 -3
- package/src/utils/destructive_hook.py +1 -0
- package/src/utils/execution_lifecycle.py +1 -0
- package/src/utils/resolve211_edits.py +29 -0
- package/src/utils/resolve_runtime.py +101 -15
- package/src/utils/resolve_versions.py +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,130 @@
|
|
|
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 v2.218.1 — Windows 11 process detection survives the removal of WMIC
|
|
6
|
+
|
|
7
|
+
Reported by @Nikibakht (#210), verified on Windows 11 Pro build 26200.
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **Every tool refused with `RESOLVE_NOT_RUNNING` on Windows 11 build 26200+,
|
|
12
|
+
while Resolve was running in front of the user.** Process detection read the
|
|
13
|
+
running Resolve's command line through `wmic`, which **Microsoft removed in
|
|
14
|
+
build 26200** — it is neither on `PATH` nor at `C:\Windows\System32\wbem`.
|
|
15
|
+
Spawning it raised `FileNotFoundError`, the read returned `None`, and `None`
|
|
16
|
+
correctly means "cannot determine whether Resolve is running", so the server
|
|
17
|
+
refused to act and declined to launch. The detection logic was right; the
|
|
18
|
+
reader it depended on had ceased to exist.
|
|
19
|
+
- Windows now tries a chain of readers — `wmic`, then Windows PowerShell's
|
|
20
|
+
`Get-CimInstance Win32_Process`, then `pwsh` — and uses the first that
|
|
21
|
+
answers. `None` is returned only when **no** reader ran; a reader that ran
|
|
22
|
+
and found nothing still returns an empty list, which is a different answer.
|
|
23
|
+
Machines that still have WMIC are unaffected, and keeping it first costs
|
|
24
|
+
nothing, because a missing binary fails instantly rather than burning the
|
|
25
|
+
ten-second timeout.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- The PowerShell reader returns **`ProcessId`, `Name`, `ExecutablePath` and
|
|
30
|
+
`CommandLine`**, not the command line alone, so Windows now fills the same
|
|
31
|
+
two-column process table as macOS and Linux. The columns fail independently,
|
|
32
|
+
and @Nikibakht measured how: querying as an unelevated user on build 26200, a
|
|
33
|
+
process the caller cannot fully read still returns its row with `ProcessId`
|
|
34
|
+
and `Name` populated and `CommandLine` NULL — the *column* is
|
|
35
|
+
access-restricted, not the row. Reading only the command line would turn
|
|
36
|
+
such an instance into no row at all: an empty list, which does not mean
|
|
37
|
+
"cannot tell", it means "nothing is running", and that is the answer that
|
|
38
|
+
launches a second Resolve on top of a live one.
|
|
39
|
+
- `Name` is in that query because of the same measurement. It showed `Name`
|
|
40
|
+
surviving the access restriction; it did **not** show `ExecutablePath`
|
|
41
|
+
surviving it, and for a protected process that field is commonly empty too,
|
|
42
|
+
so the executable column falls back to the bare process name — which the
|
|
43
|
+
existing match patterns already accept. An instance is counted on either
|
|
44
|
+
column, and the mode is reported as unknown rather than guessed when the
|
|
45
|
+
argument vector is unreadable, since `-nogui` is only ever visible there.
|
|
46
|
+
Windows rows also carry real pids instead of the synthetic negative ones the
|
|
47
|
+
WMIC branch invents.
|
|
48
|
+
|
|
49
|
+
### Validation
|
|
50
|
+
|
|
51
|
+
- Full suite green: 3,446 passed, 1 skipped. Ten new tests cover the reader chain: a machine with no WMIC, `-nogui`
|
|
52
|
+
surviving the new reader, an unreadable command line still counting as an
|
|
53
|
+
instance, a row where only the process name survives, WMIC still winning
|
|
54
|
+
where it exists, an empty answer ending the chain rather than falling
|
|
55
|
+
through, a broken reader falling through, no reader at all staying
|
|
56
|
+
undeterminable, and the two parsing edges (a command line containing tabs, a
|
|
57
|
+
non-numeric pid).
|
|
58
|
+
- **Not verified on Windows hardware by this project — there is none here.**
|
|
59
|
+
The WMIC absence, the `FileNotFoundError` it raises inside the server's own
|
|
60
|
+
venv, and the access-restricted row shape were all measured by @Nikibakht on
|
|
61
|
+
Windows 11 Pro build 26200. The local half is the unit coverage above, run
|
|
62
|
+
against a faked process spawn.
|
|
63
|
+
- One thing remains **untested by anyone**: an actual Resolve running elevated
|
|
64
|
+
or under a different Windows account. The reporter runs it as the same
|
|
65
|
+
unelevated user and said so rather than guessing; the access-restricted row
|
|
66
|
+
shape above is a proxy measured on other processes in that same access
|
|
67
|
+
class. The fallback is written so that it costs nothing if that case never
|
|
68
|
+
arises.
|
|
69
|
+
|
|
70
|
+
## What's New in v2.218.0 — native Resolve 21.1 transition creation
|
|
71
|
+
|
|
72
|
+
Contributed by @legionsound (#209), live-validated on Studio 21.1.0.14.
|
|
73
|
+
|
|
74
|
+
### Added
|
|
75
|
+
|
|
76
|
+
- **`timeline_item add_transition`**, with the granular twin
|
|
77
|
+
`add_timeline_item_transition`, calling 21.1's native `AddTransition`. The
|
|
78
|
+
`options` dictionary requires `type` (e.g. `"Cross Dissolve"`), `category`
|
|
79
|
+
(`simple` | `fusion` | `ofx` | `audio`), `position` (`start` | `end`) and
|
|
80
|
+
`alignment` (`left` | `center` | `right`); `duration` in frames is optional
|
|
81
|
+
and, when omitted or null, is forwarded as given rather than replaced with an
|
|
82
|
+
invented default. Unknown keys, blank types, unrecognised enum values and
|
|
83
|
+
non-positive or fractional durations are refused before any write. A native
|
|
84
|
+
`None` or `False` stays `success: false`; a build without the method returns
|
|
85
|
+
the 21.1 floor error, confirmed here on Studio 19.1.3.7.
|
|
86
|
+
- The result reports the **transition Resolve actually created** — its id, name,
|
|
87
|
+
start, end and duration read back off the returned object — rather than
|
|
88
|
+
echoing the requested duration. Inserting a transition can change the track's
|
|
89
|
+
item indexes, and the tool documentation says so.
|
|
90
|
+
|
|
91
|
+
### Changed
|
|
92
|
+
|
|
93
|
+
- `add_transition` is registered in **both** write tables: the
|
|
94
|
+
`destructive_hook` action registry and the MEDIUM-risk set in
|
|
95
|
+
`execution_lifecycle`. Without both, safe mode, the dry-run refusal, the audit
|
|
96
|
+
log and the operation log would all treat a timeline mutation as a read. Tool
|
|
97
|
+
count 367 → 368 across the docs and the generated agent-rule files.
|
|
98
|
+
- The existing offline `.drp` transition workflow is unchanged and still the
|
|
99
|
+
render-proven route on builds below 21.1; the native call is an addition, not
|
|
100
|
+
a replacement.
|
|
101
|
+
|
|
102
|
+
### Documentation
|
|
103
|
+
|
|
104
|
+
- `docs/reference/resolve211-native-transitions.md` records the fixture and its
|
|
105
|
+
limits, and the `api_truth` entry for `TimelineItem.AddTransition` is upgraded
|
|
106
|
+
from "signature only, never invoked" to a contributor measurement — while
|
|
107
|
+
keeping the standing 21.1 gap it does not close: there is still no accessor
|
|
108
|
+
for an existing transition's type, alignment or duration beyond its name and
|
|
109
|
+
frame range, and no clone verb.
|
|
110
|
+
|
|
111
|
+
### Validation
|
|
112
|
+
|
|
113
|
+
- Full suite green: 3,436 passed, 1 skipped. Static checks, drift guards and
|
|
114
|
+
the agent-rule generator all clean.
|
|
115
|
+
- Write registration probed directly rather than inferred:
|
|
116
|
+
`classify_operation_risk("timeline_item", "add_transition")` returns MEDIUM /
|
|
117
|
+
destructive / recognised, and `destructive_hook.is_destructive` agrees.
|
|
118
|
+
- No live Resolve run on this machine, which is Studio 19.1.3.7 — below the 21.1
|
|
119
|
+
floor, where every one of these calls correctly refuses. The rendered
|
|
120
|
+
evidence is @legionsound's, measured on Studio 21.1.0.14: a 24-frame centered
|
|
121
|
+
Cross Dissolve with source handles landed at frames 59–83 around a cut at 71
|
|
122
|
+
with adjacent clip spans unchanged, both server modes rendered byte-identical
|
|
123
|
+
142-frame ProRes movies with a progressive red-to-blue blend, and the
|
|
124
|
+
zero-handle case failed cleanly with no transition written. That covers the
|
|
125
|
+
tested Cross Dissolve fixture, not every effect the API accepts — other
|
|
126
|
+
alignments, automatic duration, audio and Fusion/OFX transitions, and repeated
|
|
127
|
+
insertion remain unverified.
|
|
128
|
+
|
|
5
129
|
## What's New in v2.217.0 — native Resolve 21.1 speed and fade setters, registered as the mutations they are
|
|
6
130
|
|
|
7
131
|
Contributed by @legionsound (#208), live-validated on Studio 21.1.0.14.
|
package/README.md
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
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
|
-
[-blue.svg)](#server-modes)
|
|
9
9
|
[-18%20tools-blueviolet.svg)](#server-modes)
|
|
10
10
|
[](docs/reference/api-coverage.md#test-results)
|
|
11
11
|
[](https://www.blackmagicdesign.com/products/davinciresolve)
|
|
@@ -133,7 +133,7 @@ The command starts a loopback-only server and opens the control panel in your br
|
|
|
133
133
|
| Mode | Entry point | Tools | Best for |
|
|
134
134
|
|------|-------------|-------|----------|
|
|
135
135
|
| Compound | `src/server.py` | 36 | Default mode for most assistants. Related Resolve operations are grouped behind action parameters to keep context usage low. |
|
|
136
|
-
| Full / granular | `src/server.py --full` or `src/resolve_mcp_server.py` |
|
|
136
|
+
| Full / granular | `src/server.py --full` or `src/resolve_mcp_server.py` | 368 | Power users who want one MCP tool per Resolve API method. |
|
|
137
137
|
|
|
138
138
|
The compound server is recommended unless you specifically need the granular one-tool-per-method surface.
|
|
139
139
|
|
|
@@ -365,7 +365,7 @@ The default server is a local stdio process launched by your MCP client; it does
|
|
|
365
365
|
|
|
366
366
|
| Metric | Value |
|
|
367
367
|
|--------|-------|
|
|
368
|
-
| MCP Tools | **36** compound / **
|
|
368
|
+
| MCP Tools | **36** compound / **368** granular (live server) |
|
|
369
369
|
| Advanced (offline) tools | **18** — .drp/.drt/.drx + DB authoring, no Resolve running |
|
|
370
370
|
| Kernel Actions | **136** guarded workflow actions across 9 compound tools |
|
|
371
371
|
| API Methods Covered | **361/361** (100%) |
|
package/README.zh-CN.md
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
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
|
-
[-blue.svg)](#服务器模式)
|
|
9
9
|
[-18%20tools-blueviolet.svg)](#服务器模式)
|
|
10
10
|
[](docs/reference/api-coverage.md#test-results)
|
|
11
11
|
[](https://www.blackmagicdesign.com/products/davinciresolve)
|
|
12
12
|
[](https://www.python.org/downloads/)
|
|
13
13
|
[](https://opensource.org/licenses/MIT)
|
|
14
14
|
|
|
15
|
-
> 本翻译对应 v2.
|
|
15
|
+
> 本翻译对应 v2.218.1 版 README。如与英文原版有出入,以 [英文原版](README.md) 为准。
|
|
16
16
|
|
|
17
17
|
一个 Model Context Protocol (MCP) 服务器,让 AI 助手通过官方脚本 API 控制 DaVinci Resolve Studio(达芬奇)。它提供完整的 API 覆盖,外加带护栏的工作流助手,涵盖剪辑、媒体池整理、渲染设置、审阅标记、调色、Fusion、Fairlight、项目生命周期任务、扩展开发,以及不碰源媒体的媒体分析。
|
|
18
18
|
|
|
@@ -88,7 +88,7 @@ venv/bin/python -m src.control_panel
|
|
|
88
88
|
| 模式 | 入口 | 工具数 | 适合谁 |
|
|
89
89
|
|------|------|--------|--------|
|
|
90
90
|
| Compound(复合) | `src/server.py` | 36 | 大多数助手的默认模式。相关的 Resolve 操作按 action 参数分组,压低上下文占用。 |
|
|
91
|
-
| Full / granular(细粒度) | `src/server.py --full` 或 `src/resolve_mcp_server.py` |
|
|
91
|
+
| Full / granular(细粒度) | `src/server.py --full` 或 `src/resolve_mcp_server.py` | 368 | 想要"一个 Resolve API 方法 = 一个 MCP 工具"的重度用户。 |
|
|
92
92
|
|
|
93
93
|
除非你明确需要一方法一工具的细粒度界面,否则推荐复合模式。
|
|
94
94
|
|
|
@@ -226,7 +226,7 @@ DRX 调色写入**针对 Resolve Studio 做过实机校准**:调色参数默
|
|
|
226
226
|
|
|
227
227
|
| 指标 | 数值 |
|
|
228
228
|
|------|------|
|
|
229
|
-
| MCP 工具 | **36** 复合 / **
|
|
229
|
+
| MCP 工具 | **36** 复合 / **368** 细粒度(实时服务器) |
|
|
230
230
|
| Advanced(离线)工具 | **18**——.drp/.drt/.drx + 数据库创作,无需 Resolve 运行 |
|
|
231
231
|
| 内核 action | 9 个复合工具下 **136** 个带护栏的工作流 action |
|
|
232
232
|
| API 方法覆盖 | **361/361**(100%) |
|
package/docs/SKILL.md
CHANGED
|
@@ -345,7 +345,7 @@ to the user as verified.
|
|
|
345
345
|
| Mode | Entry point | Tool count | Use when |
|
|
346
346
|
|---|---|---|---|
|
|
347
347
|
| Compound (default) | `src/server.py` | 36 tools | Most workflows — keeps context lean |
|
|
348
|
-
| Granular (full) | `src/server.py --full` |
|
|
348
|
+
| Granular (full) | `src/server.py --full` | 368 tools | Power users needing one tool per API method |
|
|
349
349
|
|
|
350
350
|
Resolve 21.1 adds [twelve read-only discovery controls](reference/resolve211-read-controls.md)
|
|
351
351
|
for edition, presets, audio formats/codecs, normalization modes, speed, fades
|
|
@@ -2481,3 +2481,5 @@ setups:
|
|
|
2481
2481
|
The full API reference is in `docs/reference/resolve_scripting_api.txt`.
|
|
2482
2482
|
|
|
2483
2483
|
Native Resolve 21.1 speed and fade setters: see [speed/fades](reference/resolve211-speed-fades.md) for options, version guards and contributor validation limits.
|
|
2484
|
+
|
|
2485
|
+
Native 21.1 transition creation: see [transition controls](reference/resolve211-native-transitions.md) for options, item-index changes and contributor-rendered evidence.
|
package/docs/contributing.md
CHANGED
|
@@ -64,7 +64,7 @@ davinci-resolve-mcp/
|
|
|
64
64
|
├── install.py # Universal installer (macOS/Windows/Linux)
|
|
65
65
|
├── src/
|
|
66
66
|
│ ├── server.py # Compound MCP server — 36 tools (default)
|
|
67
|
-
│ ├── resolve_mcp_server.py # Thin full-server entrypoint —
|
|
67
|
+
│ ├── resolve_mcp_server.py # Thin full-server entrypoint — 368 tools
|
|
68
68
|
│ ├── granular/ # Modular full-server implementation
|
|
69
69
|
│ └── utils/ # Platform detection, Resolve connection helpers
|
|
70
70
|
├── tests/ # offline suite (test_*.py) + live harnesses (live_*.py):
|
package/docs/install.md
CHANGED
|
@@ -144,7 +144,7 @@ The MCP server comes in two modes:
|
|
|
144
144
|
| Mode | File | Tools | Best For |
|
|
145
145
|
|------|------|-------|----------|
|
|
146
146
|
| **Compound** (default) | `src/server.py` | 36 | Most users — fast, clean, low context usage |
|
|
147
|
-
| **Full** | `src/resolve_mcp_server.py` |
|
|
147
|
+
| **Full** | `src/resolve_mcp_server.py` | 368 | Power users who want one tool per API method |
|
|
148
148
|
|
|
149
149
|
The compound server's `timeline_item` tool includes dedicated actions for common workflows:
|
|
150
150
|
|
|
@@ -159,7 +159,7 @@ The compound server's `timeline_item` tool includes dedicated actions for common
|
|
|
159
159
|
|
|
160
160
|
The installer uses the compound server by default. To use the full server:
|
|
161
161
|
```bash
|
|
162
|
-
python src/server.py --full # Launch full
|
|
162
|
+
python src/server.py --full # Launch full 368-tool server
|
|
163
163
|
# Or point your MCP config directly at src/resolve_mcp_server.py
|
|
164
164
|
```
|
|
165
165
|
|
|
@@ -25,7 +25,7 @@ Every non-deprecated method in the bundled legacy README is represented. This
|
|
|
25
25
|
does not claim complete coverage of the newer Resolve 21.1 typed API. The
|
|
26
26
|
default compound server exposes **36 tools** that group related operations by
|
|
27
27
|
action parameter, keeping LLM context windows lean. The full granular server
|
|
28
|
-
provides **
|
|
28
|
+
provides **368 individual tools** for power users. The legacy coverage spans
|
|
29
29
|
13 API object classes. MCP-level kernel actions are tracked separately in
|
|
30
30
|
[Kernel Action Coverage](../kernels/README.md).
|
|
31
31
|
|
|
@@ -631,3 +631,5 @@ Every method in the DaVinci Resolve Scripting API and its test status. Methods a
|
|
|
631
631
|
---
|
|
632
632
|
|
|
633
633
|
Native speed and fade setters in both interfaces are documented in [Resolve 21.1 speed/fades](resolve211-speed-fades.md), including sampled video validation and unverified cases.
|
|
634
|
+
|
|
635
|
+
Native 21.1 transition creation: see [transition controls](resolve211-native-transitions.md) for options, item-index changes and contributor-rendered evidence.
|
|
@@ -82,7 +82,7 @@ equivalent, blocking full automation.
|
|
|
82
82
|
### Transition create / copy / clone
|
|
83
83
|
|
|
84
84
|
- **Object:** `Timeline / TimelineItem`
|
|
85
|
-
- **Behavior:** CREATION IS FIXED IN 21.1, READBACK IS NOT. Reported by @billcarroll (PR #197) from an attribute probe on Studio 21.1.0.14 (2026-09-08; not reproduced here, no 21.1 install): TimelineItem.AddTransition resolves to a <BlackmagicFusion.PyFunctionCall object>, not None. Its stub signature is AddTransition(transitionOptions) -> TimelineItem | None, where transitionOptions carries type (e.g. 'Cross Dissolve'), category ('simple'|'fusion'|'ofx'|'audio'), position ('start'|'end'), alignment ('left'|'center'|'right') and an optional duration in frames.
|
|
85
|
+
- **Behavior:** CREATION IS FIXED IN 21.1, READBACK IS NOT. Reported by @billcarroll (PR #197) from an attribute probe on Studio 21.1.0.14 (2026-09-08; not reproduced here, no 21.1 install): TimelineItem.AddTransition resolves to a <BlackmagicFusion.PyFunctionCall object>, not None. Its stub signature is AddTransition(transitionOptions) -> TimelineItem | None, where transitionOptions carries type (e.g. 'Cross Dissolve'), category ('simple'|'fusion'|'ofx'|'audio'), position ('start'|'end'), alignment ('left'|'center'|'right') and an optional duration in frames. That original probe did not invoke the method. UPDATE, contributor-validated by @legionsound on Studio 21.1.0.14, macOS, 2026-09-09 (not reproduced by the maintainer on 19.1.3.7): a synthetic red/blue pair with handles accepted a 24-frame centered Cross Dissolve. GetStart/End returned 59/83 around cut 71, GetDuration returned 24, and source clip spans were unchanged. Both community interfaces rendered identical 142-frame movies with a progressive red-to-blue blend. With zero handles the native call returned None. This validates that fixture, not other effects, audio transitions or alignments. See resolve211-native-transitions.md. WHAT REMAINS MISSING ON 21.1: reading a transition back. There is still no accessor for an existing transition's type, alignment or duration beyond its name string and frame range, and no clone verb — alignment and duration are write-only arguments to AddTransition. The pre-21.1 statement, kept as the historical record: there was no method to ADD or CLONE an edit transition — no AddTransition/CreateTransition/AddVideoTransition on Timeline or TimelineItem (dir(), 21.0.4.5). CORRECTION, measured on Studio 21.0.4.5 (2026-08-12): this entry previously said transitions applied in the UI are 'invisible to and unmodifiable by scripts'. BOTH HALVES WERE WRONG and are withdrawn. A transition IS a first-class timeline item: a 12-frame Cross Dissolve applied through the Edit-page right-click menu enumerates in GetItemListInTrack('video', 1) as GetName()=='Cross Dissolve', GetStart()==86426, GetDuration()==12 — centered on a cut at 86432 — with a stable GetUniqueId() and a working GetTrackTypeAndIndex(). A transition authored offline into a .drp and imported reads IDENTICALLY, so the route that created it does not matter. It is also REMOVABLE: Timeline.DeleteClips([transition], False) returns True and deletes it, leaving both adjacent clips at their original starts and durations. THE DISCRIMINATOR between a transition item and a clip item is GetProperty(): a transition returns an EMPTY dict where a video clip returns 26 transform keys; it also has no MediaPoolItem and no Fusion comp. WHAT IS GENUINELY MISSING (pre-21.1: creation too; on 21.1+ read the paragraph above): cloning, and any type/alignment/parameter detail — the transition's kind is knowable ONLY from its name string, and there is no way to read its alignment (centered/start/end) or edit its duration. AUDIO NUANCE (measured 2026-09-01 on 19.1.3.7, E113): an audio cross-fade enumerates in GetItemListInTrack('audio', n) with an EMPTY GetName() (24 frames, centered on the cut, between the two clips) — so on audio lanes even the kind is not readable from the name. The discriminator that holds for BOTH: GetMediaPoolItem() is None AND GetProperty() is empty — BUT a Solid Color generator AND a subtitle item read the same way (GetProperty() None, no MediaPoolItem; measured E115), so that pair only separates clips from non-clips. What separates a transition from a generator is GEOMETRY: a transition straddles a cut (one neighbour ends inside its span, another starts inside it) while a generator owns its span. timeline.get_items reports `kind` on that basis.
|
|
86
86
|
- **Workaround / current handling:** Automated QC of existing transitions IS possible and is the main practical need — enumerate GetItemListInTrack, treat any item whose GetProperty() is empty and whose GetMediaPoolItem() is None as a transition, and read its name, start and duration. Removal is scriptable via Timeline.DeleteClips. To CREATE one, either apply it in the Resolve UI, or author it offline and import: the advanced server's drp place_transition writes a cross dissolve at an abutting cut ({track, atFrame, durationFrames}) and it round-trips into Resolve 21.0.4.5 reading back at the expected centered range. On 21.1+ prefer TimelineItem.AddTransition, which takes the type, category, edge, alignment and duration directly.
|
|
87
87
|
- **Tags:** missing-method, timeline, transition
|
|
88
88
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Read/Write Symmetry Audit
|
|
4
4
|
|
|
5
|
-
- write-style action occurrences scanned: **
|
|
5
|
+
- write-style action occurrences scanned: **120**
|
|
6
6
|
- write-style action occurrences with a matching read: **73**
|
|
7
7
|
- distinct high-signal `set_` actions without a direct/known readback: **4**
|
|
8
8
|
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
- `set_keyframe_interpolation`
|
|
14
14
|
- `set_node_enabled`
|
|
15
15
|
|
|
16
|
-
## Low-signal (create/add/insert/apply/import — usually expected):
|
|
16
|
+
## Low-signal (create/add/insert/apply/import — usually expected): 42 distinct names
|
|
17
17
|
|
|
18
|
-
`add_clip_mattes`, `add_comp`, `add_fusion_mask`, `add_subfolder`, `add_sync_event_markers`, `add_timeline_mattes`, `add_track`, `add_version`, `apply_arri_cdl_lut`, `apply_cuts`, `apply_fairlight_preset`, `apply_grade_from_drx`, `apply_look_to_items`, `apply_spec`, `apply_trace_plan`, `create_compound_clip`, `create_fusion_clip`, `create_magic_mask`, `create_stereo_clip`, `create_subtitles`, `create_timeline`, `create_timeline_from_clips`, `create_variant_from_ranges`, `import_comp`, `import_folder`, `import_from_drp`, `import_into_timeline`, `import_media`, `import_preset`, `import_project`, `import_render`, `import_timeline`, `import_timeline_checked`, `import_to_pool`, `insert_audio`, `insert_fusion_composition`, `insert_fusion_generator`, `insert_fusion_title`, `insert_generator`, `insert_ofx_generator`, `insert_title`
|
|
18
|
+
`add_clip_mattes`, `add_comp`, `add_fusion_mask`, `add_subfolder`, `add_sync_event_markers`, `add_timeline_mattes`, `add_track`, `add_transition`, `add_version`, `apply_arri_cdl_lut`, `apply_cuts`, `apply_fairlight_preset`, `apply_grade_from_drx`, `apply_look_to_items`, `apply_spec`, `apply_trace_plan`, `create_compound_clip`, `create_fusion_clip`, `create_magic_mask`, `create_stereo_clip`, `create_subtitles`, `create_timeline`, `create_timeline_from_clips`, `create_variant_from_ranges`, `import_comp`, `import_folder`, `import_from_drp`, `import_into_timeline`, `import_media`, `import_preset`, `import_project`, `import_render`, `import_timeline`, `import_timeline_checked`, `import_to_pool`, `insert_audio`, `insert_fusion_composition`, `insert_fusion_generator`, `insert_fusion_title`, `insert_generator`, `insert_ofx_generator`, `insert_title`
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Native Resolve 21.1 transitions
|
|
2
|
+
|
|
3
|
+
`timeline_item("add_transition", {"options": {...}, ...})` and granular
|
|
4
|
+
`add_timeline_item_transition(options, track_type="video", track_index=1,
|
|
5
|
+
item_index=0)` call TimelineItem.AddTransition. This is an additional native
|
|
6
|
+
route; the existing offline project-file transition workflow remains available.
|
|
7
|
+
|
|
8
|
+
Required options are `type` (non-empty native transition name), `category`
|
|
9
|
+
(`simple`, `fusion`, `ofx`, `audio`), `position` (`start`, `end`) and `alignment`
|
|
10
|
+
(`left`, `center`, `right`). Optional `duration` is a positive integer in frames,
|
|
11
|
+
or null/omitted to request Resolve's automatic duration. Unknown keys and malformed
|
|
12
|
+
values are refused before writes. The wrapper does not guess which transition
|
|
13
|
+
names are installed, calculate source handles, or silently substitute an effect.
|
|
14
|
+
|
|
15
|
+
Example options:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{"type":"Cross Dissolve","category":"simple","position":"end","alignment":"center","duration":24}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The result is `success: false` when the native API returns None/False. Otherwise
|
|
22
|
+
`transition` contains its actual id, name, start, end and duration. Actual values
|
|
23
|
+
come from the returned item, not the requested options. A created object is not
|
|
24
|
+
proof of a correct render; verify output for each effect and source configuration.
|
|
25
|
+
|
|
26
|
+
Native transitions appear in GetItemListInTrack on the measured build. Adding one
|
|
27
|
+
therefore changes subsequent item indexes. Re-query the track before selecting
|
|
28
|
+
another item. Track indexes remain 1-based and item indexes 0-based.
|
|
29
|
+
|
|
30
|
+
The method has a 21.1 floor and is registered as a destructive write and MEDIUM
|
|
31
|
+
risk in both classifier tables. Explicit compound dry-run requests are refused
|
|
32
|
+
before the handler because this action has no native dry-run implementation.
|
|
33
|
+
Granular tool annotations also identify a destructive, non-idempotent write.
|
|
34
|
+
|
|
35
|
+
## Contributor evidence and limits
|
|
36
|
+
|
|
37
|
+
Contributor-validated on macOS Studio **21.1.0.14**, using generated red/blue
|
|
38
|
+
six-second clips in a disposable 24 fps project. A 24-frame centered Cross
|
|
39
|
+
Dissolve with source handles returned start 59/end 83 around cut 71, without
|
|
40
|
+
moving either source clip. ProRes movie rendering completed. The rendered
|
|
41
|
+
boundary changed from red through a red/blue blend to blue. The same request
|
|
42
|
+
with zero outgoing/incoming handles returned failure and no transition.
|
|
43
|
+
|
|
44
|
+
The included scratch test exercises both community interfaces and creates render
|
|
45
|
+
jobs for independent movie inspection. Unit tests cover actual returned spans,
|
|
46
|
+
missing native methods, None/False failures, malformed options, optional duration,
|
|
47
|
+
write classification, and dry-run refusal. Audio transitions, Fusion/OFX effects,
|
|
48
|
+
other alignments, automatic duration and repeated insertion are not live-validated
|
|
49
|
+
by this contribution. Support for their documented options is pass-through.
|
|
50
|
+
|
|
51
|
+
`python tests/live_resolve211_transitions.py OUTPUT_DIR` requires a disposable
|
|
52
|
+
project named `Codex Native Transition Validation 20260909`, set to 640x360/24 fps,
|
|
53
|
+
with synthetic red.mov and blue.mov in its root bin. Generate each with FFmpeg:
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
ffmpeg -f lavfi -i 'color=c=red:s=640x360:r=24:d=6' \
|
|
57
|
+
-c:v prores_ks -profile:v 0 -pix_fmt yuv422p10le red.mov
|
|
58
|
+
ffmpeg -f lavfi -i 'color=c=blue:s=640x360:r=24:d=6' \
|
|
59
|
+
-c:v prores_ks -profile:v 0 -pix_fmt yuv422p10le blue.mov
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
It creates disposable timelines, renders movies and saves the scratch project.
|
|
63
|
+
Do not supply production media. Inspect frames 47, 65, 71, 77 and 95 in the
|
|
64
|
+
resulting movies: red before the overlap, progressively more blue through the
|
|
65
|
+
transition, then blue afterward. Also verify frame count and source-clip spans.
|
package/install.py
CHANGED
|
@@ -37,7 +37,7 @@ from src.utils.update_check import (
|
|
|
37
37
|
|
|
38
38
|
# ─── Version ──────────────────────────────────────────────────────────────────
|
|
39
39
|
|
|
40
|
-
VERSION = "2.
|
|
40
|
+
VERSION = "2.218.1"
|
|
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
|
|
@@ -1543,7 +1543,7 @@ def verify_resolve_connection(python_path, api_path, lib_path):
|
|
|
1543
1543
|
|
|
1544
1544
|
def print_banner():
|
|
1545
1545
|
title = f"DaVinci Resolve MCP Server — Installer v{VERSION}"
|
|
1546
|
-
subtitle = "36 compound ·
|
|
1546
|
+
subtitle = "36 compound · 368 full · 3 platforms"
|
|
1547
1547
|
print()
|
|
1548
1548
|
print(bold(" ╔══════════════════════════════════════════════════════╗"))
|
|
1549
1549
|
print(bold(f" ║{title:^54}║"))
|
package/package.json
CHANGED
package/src/granular/common.py
CHANGED
|
@@ -87,7 +87,7 @@ if not logging.getLogger().handlers:
|
|
|
87
87
|
handlers=[logging.StreamHandler()],
|
|
88
88
|
)
|
|
89
89
|
|
|
90
|
-
VERSION = "2.
|
|
90
|
+
VERSION = "2.218.1"
|
|
91
91
|
logger = logging.getLogger("davinci-resolve-mcp")
|
|
92
92
|
logger.info(f"Starting DaVinci Resolve MCP Server v{VERSION}")
|
|
93
93
|
logger.info(f"Detected platform: {get_platform()}")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Native Resolve 21.1 discovery and editing controls."""
|
|
2
|
-
from src.utils.resolve211_edits import validate_edit_options
|
|
2
|
+
from src.utils.resolve211_edits import validate_edit_options, validate_transition_options, transition_result
|
|
3
3
|
from src.granular.common import (
|
|
4
|
-
mcp, READ_ONLY_TOOL, WRITE_TOOL, get_resolve, get_current_project,
|
|
4
|
+
mcp, READ_ONLY_TOOL, WRITE_TOOL, DESTRUCTIVE_TOOL, get_resolve, get_current_project,
|
|
5
5
|
_get_timeline, _get_timeline_item, _requires_method, has_method,
|
|
6
6
|
)
|
|
7
7
|
|
|
@@ -181,3 +181,20 @@ def set_timeline_item_fades(options: dict, track_type: str = "video", track_inde
|
|
|
181
181
|
if missing:
|
|
182
182
|
return missing
|
|
183
183
|
return {"success": bool(item.SetFades(dict(options)))}
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
@mcp.tool(annotations=DESTRUCTIVE_TOOL)
|
|
187
|
+
def add_timeline_item_transition(options: dict, track_type: str = "video", track_index: int = 1, item_index: int = 0) -> dict:
|
|
188
|
+
"""Add a native 21.1 transition using type/category/position/alignment and optional duration in frames. Returns actual span; clip indexes can change after insertion."""
|
|
189
|
+
error = validate_transition_options(options)
|
|
190
|
+
if error:
|
|
191
|
+
return {"error": error}
|
|
192
|
+
if track_type not in ("video", "audio") or track_index < 1 or item_index < 0:
|
|
193
|
+
return {"error": "Use video/audio, a 1-based track index and a non-negative item index"}
|
|
194
|
+
item, error = _get_timeline_item(track_type, track_index, item_index)
|
|
195
|
+
if error:
|
|
196
|
+
return error
|
|
197
|
+
missing = _requires_method(item, "AddTransition", "21.1")
|
|
198
|
+
if missing:
|
|
199
|
+
return missing
|
|
200
|
+
return transition_result(item.AddTransition(dict(options)))
|
|
@@ -34,7 +34,7 @@ from src.utils.update_check import start_background_update_check
|
|
|
34
34
|
if __name__ == "__main__":
|
|
35
35
|
try:
|
|
36
36
|
start_background_update_check(VERSION, project_dir, logger)
|
|
37
|
-
logger.info(f"Starting DaVinci Resolve MCP Server v{VERSION} (
|
|
37
|
+
logger.info(f"Starting DaVinci Resolve MCP Server v{VERSION} (368 granular tools)")
|
|
38
38
|
run_fastmcp_stdio(mcp)
|
|
39
39
|
except KeyboardInterrupt:
|
|
40
40
|
logger.info("Server shutdown requested")
|
package/src/server.py
CHANGED
|
@@ -8,10 +8,10 @@ Each tool groups related operations via an 'action' parameter.
|
|
|
8
8
|
|
|
9
9
|
Usage:
|
|
10
10
|
python src/server.py # Start the MCP server
|
|
11
|
-
python src/server.py --full # Start the
|
|
11
|
+
python src/server.py --full # Start the 368-tool granular server instead
|
|
12
12
|
"""
|
|
13
13
|
|
|
14
|
-
VERSION = "2.
|
|
14
|
+
VERSION = "2.218.1"
|
|
15
15
|
|
|
16
16
|
import base64
|
|
17
17
|
import os
|
|
@@ -42,7 +42,7 @@ for p in [current_dir, project_dir]:
|
|
|
42
42
|
if p not in sys.path:
|
|
43
43
|
sys.path.insert(0, p)
|
|
44
44
|
|
|
45
|
-
from src.utils.resolve211_edits import validate_edit_options
|
|
45
|
+
from src.utils.resolve211_edits import validate_edit_options, validate_transition_options, transition_result
|
|
46
46
|
|
|
47
47
|
# Platform-specific Resolve paths
|
|
48
48
|
from src.utils.cdl import normalize_cdl_payload
|
|
@@ -26274,6 +26274,7 @@ def timeline_item(action: str, params: Optional[Dict[str, Any]] = None) -> Dict[
|
|
|
26274
26274
|
Identify by track_type, track_index, item_index (item_index is 0-BASED: 0 = first clip; track_index is 1-based).
|
|
26275
26275
|
|
|
26276
26276
|
Actions:
|
|
26277
|
+
add_transition(options, ...) -> {success, transition?} — native 21.1 transition; reports actual span.
|
|
26277
26278
|
set_speed(options, ...) -> {success} — native 21.1 speed options; RippleTimeline defaults false.
|
|
26278
26279
|
set_fades(options, ...) -> {success} — native 21.1 FadeIn/FadeOut integer frames.
|
|
26279
26280
|
get_speed(...) -> {speed} — documented on Resolve 21.1+.
|
|
@@ -26330,6 +26331,16 @@ def timeline_item(action: str, params: Optional[Dict[str, Any]] = None) -> Dict[
|
|
|
26330
26331
|
if err:
|
|
26331
26332
|
return err
|
|
26332
26333
|
|
|
26334
|
+
if action == "add_transition":
|
|
26335
|
+
options = p.get("options")
|
|
26336
|
+
error = validate_transition_options(options)
|
|
26337
|
+
if error:
|
|
26338
|
+
return _err(error)
|
|
26339
|
+
missing = _requires_method(item, "AddTransition", "21.1")
|
|
26340
|
+
if missing:
|
|
26341
|
+
return missing
|
|
26342
|
+
return transition_result(item.AddTransition(dict(options)))
|
|
26343
|
+
|
|
26333
26344
|
if action in ("set_speed", "set_fades"):
|
|
26334
26345
|
options = p.get("options")
|
|
26335
26346
|
error = validate_edit_options(action, options)
|
|
@@ -26541,7 +26552,7 @@ def timeline_item(action: str, params: Optional[Dict[str, Any]] = None) -> Dict[
|
|
|
26541
26552
|
return _err(f"Invalid interpolation. Must be one of: {', '.join(valid)}")
|
|
26542
26553
|
return {"success": bool(item.SetKeyframeInterpolation(p["property"], p["frame"], p["interpolation"]))}
|
|
26543
26554
|
|
|
26544
|
-
return _unknown(action, ["set_speed","set_fades","get_speed","get_fades","get_output_blanking","get_use_timeline_for_output_blanking","get_name","get_property","set_property","get_duration","get_start","get_end","get_source_start_frame","get_source_end_frame","get_source_start_time","get_source_end_time","get_left_offset","get_right_offset","set_clip_enabled","get_clip_enabled","update_sidecar","get_unique_id","get_media_pool_item","get_stereo_convergence","get_stereo_left_window","get_stereo_right_window","get_linked_items","get_track_type_and_index","get_source_audio_mapping","load_burnin_preset","set_name","get_voice_isolation_state","set_voice_isolation_state","get_retime","set_retime","get_transform","set_transform","get_crop","set_crop","get_composite","set_composite","get_audio","set_audio","get_keyframes","add_keyframe","modify_keyframe","delete_keyframe","set_keyframe_interpolation"])
|
|
26555
|
+
return _unknown(action, ["add_transition","set_speed","set_fades","get_speed","get_fades","get_output_blanking","get_use_timeline_for_output_blanking","get_name","get_property","set_property","get_duration","get_start","get_end","get_source_start_frame","get_source_end_frame","get_source_start_time","get_source_end_time","get_left_offset","get_right_offset","set_clip_enabled","get_clip_enabled","update_sidecar","get_unique_id","get_media_pool_item","get_stereo_convergence","get_stereo_left_window","get_stereo_right_window","get_linked_items","get_track_type_and_index","get_source_audio_mapping","load_burnin_preset","set_name","get_voice_isolation_state","set_voice_isolation_state","get_retime","set_retime","get_transform","set_transform","get_crop","set_crop","get_composite","set_composite","get_audio","set_audio","get_keyframes","add_keyframe","modify_keyframe","delete_keyframe","set_keyframe_interpolation"])
|
|
26545
26556
|
|
|
26546
26557
|
|
|
26547
26558
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
@@ -32663,9 +32674,9 @@ if __name__ == "__main__":
|
|
|
32663
32674
|
start_background_update_check(VERSION, project_dir, logger, env=_setup_update_env())
|
|
32664
32675
|
_install_threaded_tool_dispatch(mcp)
|
|
32665
32676
|
|
|
32666
|
-
# Support --full flag to run the
|
|
32677
|
+
# Support --full flag to run the 368-tool granular server instead
|
|
32667
32678
|
if "--full" in sys.argv:
|
|
32668
|
-
logger.info("Starting full
|
|
32679
|
+
logger.info("Starting full 368-tool granular server...")
|
|
32669
32680
|
sys.argv = [arg for arg in sys.argv if arg != "--full"]
|
|
32670
32681
|
from src.granular import mcp as granular_mcp
|
|
32671
32682
|
|
package/src/utils/api_truth.py
CHANGED
|
@@ -904,9 +904,18 @@ API_TRUTH: List[Dict[str, Any]] = [
|
|
|
904
904
|
"None, where transitionOptions carries type (e.g. 'Cross "
|
|
905
905
|
"Dissolve'), category ('simple'|'fusion'|'ofx'|'audio'), position "
|
|
906
906
|
"('start'|'end'), alignment ('left'|'center'|'right') and an "
|
|
907
|
-
"optional duration in frames.
|
|
908
|
-
"the
|
|
909
|
-
"
|
|
907
|
+
"optional duration in frames. That original probe did not invoke "
|
|
908
|
+
"the method. UPDATE, contributor-validated by @legionsound on "
|
|
909
|
+
"Studio 21.1.0.14, macOS, 2026-09-09 (not reproduced by the "
|
|
910
|
+
"maintainer on 19.1.3.7): a synthetic red/blue pair with handles "
|
|
911
|
+
"accepted a 24-frame centered Cross Dissolve. GetStart/End "
|
|
912
|
+
"returned 59/83 around cut 71, GetDuration returned 24, and "
|
|
913
|
+
"source clip spans were unchanged. Both community interfaces "
|
|
914
|
+
"rendered identical 142-frame movies with a progressive "
|
|
915
|
+
"red-to-blue blend. With zero handles the native call returned "
|
|
916
|
+
"None. This validates that fixture, not other effects, audio "
|
|
917
|
+
"transitions or alignments. See resolve211-native-transitions.md. "
|
|
918
|
+
"WHAT REMAINS MISSING ON 21.1: reading a "
|
|
910
919
|
"transition back. There is still no accessor for an existing "
|
|
911
920
|
"transition's type, alignment or duration beyond its name string "
|
|
912
921
|
"and frame range, and no clone verb — alignment and duration are "
|
|
@@ -151,6 +151,7 @@ DESTRUCTIVE_ACTIONS_BY_TOOL: Dict[str, FrozenSet[str]] = {
|
|
|
151
151
|
# classifier did not recognise them, so safe mode, the dry-run refusal,
|
|
152
152
|
# the audit log and the operation log all skipped a call that rewrites a
|
|
153
153
|
# clip's speed — and, with RippleTimeline true, moves every clip after it.
|
|
154
|
+
"add_transition",
|
|
154
155
|
"set_speed",
|
|
155
156
|
"set_fades",
|
|
156
157
|
}),
|
|
@@ -274,6 +274,7 @@ class RiskClassificationHook(LifecycleHook):
|
|
|
274
274
|
# Native 21.1 setters (#208): `set_speed` changes duration and, with
|
|
275
275
|
# RippleTimeline true, moves every clip after it; `set_fades` rewrites
|
|
276
276
|
# how the clip's edges render. Existing content altered, not deleted.
|
|
277
|
+
("timeline_item", "add_transition"),
|
|
277
278
|
("timeline_item", "set_speed"),
|
|
278
279
|
("timeline_item", "set_fades"),
|
|
279
280
|
# Pool reorganisation: clips and bins move, nothing is destroyed, but
|
|
@@ -24,3 +24,32 @@ def validate_edit_options(action, options):
|
|
|
24
24
|
if not finite:
|
|
25
25
|
return key + " must be a finite number"
|
|
26
26
|
return None
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def validate_transition_options(options):
|
|
30
|
+
if not isinstance(options, dict) or not options:
|
|
31
|
+
return "options must be a non-empty dictionary"
|
|
32
|
+
allowed = {"type", "category", "position", "alignment", "duration"}
|
|
33
|
+
if set(options) - allowed:
|
|
34
|
+
return "Unknown transition options: " + ", ".join(sorted(map(str, set(options) - allowed)))
|
|
35
|
+
if not isinstance(options.get("type"), str) or not options["type"].strip():
|
|
36
|
+
return "type must be a non-empty transition name"
|
|
37
|
+
for key, choices in (("category", ("simple", "fusion", "ofx", "audio")),
|
|
38
|
+
("position", ("start", "end")),
|
|
39
|
+
("alignment", ("left", "center", "right"))):
|
|
40
|
+
if options.get(key) not in choices:
|
|
41
|
+
return key + " must be one of: " + ", ".join(choices)
|
|
42
|
+
duration = options.get("duration")
|
|
43
|
+
if duration is not None and (type(duration) is not int or duration <= 0):
|
|
44
|
+
return "duration must be a positive integer number of frames or null"
|
|
45
|
+
return None
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def transition_result(transition):
|
|
49
|
+
if transition is None or transition is False:
|
|
50
|
+
return {"success": False}
|
|
51
|
+
return {"success": True, "transition": {
|
|
52
|
+
"id": transition.GetUniqueId(), "name": transition.GetName(),
|
|
53
|
+
"start": transition.GetStart(), "end": transition.GetEnd(),
|
|
54
|
+
"duration": transition.GetDuration(),
|
|
55
|
+
}}
|
|
@@ -96,6 +96,91 @@ def _split_pid(line: str, index: int):
|
|
|
96
96
|
return -(index + 1), line
|
|
97
97
|
|
|
98
98
|
|
|
99
|
+
def _windows_wmic_rows(stdout: str) -> List[Dict[str, Optional[str]]]:
|
|
100
|
+
"""WMIC prints one command line per row, under a `CommandLine` header.
|
|
101
|
+
|
|
102
|
+
The header row and WMIC's blank padding rows are left in rather than
|
|
103
|
+
filtered: they are not Resolve command lines, so the executable match
|
|
104
|
+
drops them, and a second filter here would be a second place for that
|
|
105
|
+
decision to drift. There is no pid column to read, so pids are synthetic
|
|
106
|
+
and negative — they exist only to key the row, never to name a process.
|
|
107
|
+
"""
|
|
108
|
+
return [{"pid": -(index + 1), "comm": None, "args": line}
|
|
109
|
+
for index, line in enumerate(stdout.splitlines())]
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def _windows_cim_rows(stdout: str) -> List[Dict[str, Optional[str]]]:
|
|
113
|
+
"""`ProcessId`, `ExecutablePath` and `CommandLine`, tab-separated per row.
|
|
114
|
+
|
|
115
|
+
Four columns rather than the command line alone, because they fail
|
|
116
|
+
independently exactly as they do on POSIX. Measured on build 26200 by the
|
|
117
|
+
reporter of #210, querying as an unelevated user: for a process the caller
|
|
118
|
+
cannot fully read, CIM still returns the row with `ProcessId` and `Name`
|
|
119
|
+
populated and `CommandLine` NULL — the *column* is access-restricted, not
|
|
120
|
+
the row. Reading only the command line would turn such an instance into no
|
|
121
|
+
row at all: an empty list, which does not mean "undeterminable", it means
|
|
122
|
+
"nothing is running", and that is the answer that launches a second
|
|
123
|
+
Resolve on top of a live one.
|
|
124
|
+
|
|
125
|
+
`Name` rather than `ExecutablePath` alone is the reason this holds. That
|
|
126
|
+
measurement showed `Name` surviving the access restriction; it did not
|
|
127
|
+
show `ExecutablePath` surviving it, and for a protected process that field
|
|
128
|
+
is commonly empty too. So the executable column falls back to the bare
|
|
129
|
+
process name, which `RESOLVE_PROCESS_PATTERNS` already matches — enough to
|
|
130
|
+
prove an instance is up, while the mode stays honestly unknown, since
|
|
131
|
+
`-nogui` is only ever visible in the command line.
|
|
132
|
+
|
|
133
|
+
Split at most three times: a command line may itself contain tabs, and it
|
|
134
|
+
is the last field, so everything after the third separator belongs to it.
|
|
135
|
+
"""
|
|
136
|
+
rows: List[Dict[str, Optional[str]]] = []
|
|
137
|
+
for index, line in enumerate(stdout.splitlines()):
|
|
138
|
+
if not line.strip():
|
|
139
|
+
continue
|
|
140
|
+
fields = line.split("\t", 3)
|
|
141
|
+
fields += [""] * (4 - len(fields))
|
|
142
|
+
try:
|
|
143
|
+
pid = int(fields[0].strip())
|
|
144
|
+
except ValueError:
|
|
145
|
+
pid = -(index + 1)
|
|
146
|
+
rows.append({"pid": pid,
|
|
147
|
+
"comm": fields[2].strip() or fields[1].strip() or None,
|
|
148
|
+
"args": fields[3].strip() or None})
|
|
149
|
+
return rows
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
#: PowerShell equivalent of the WMIC query, emitting the four columns above.
|
|
153
|
+
#: The output encoding is forced because the default console codepage mangles
|
|
154
|
+
#: a non-ASCII install path before Python ever sees it.
|
|
155
|
+
_CIM_COMMAND = (
|
|
156
|
+
"[Console]::OutputEncoding=[Text.Encoding]::UTF8; "
|
|
157
|
+
"Get-CimInstance Win32_Process -Filter \"name='Resolve.exe'\" | "
|
|
158
|
+
"ForEach-Object { \"$($_.ProcessId)`t$($_.Name)`t$($_.ExecutablePath)`t$($_.CommandLine)\" }"
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
#: Readers for the Windows process table, tried in order until one answers.
|
|
162
|
+
#:
|
|
163
|
+
#: WMIC first, so a machine that still has it behaves exactly as it did before
|
|
164
|
+
#: — but **WMIC was removed in Windows 11 build 26200** and is neither on PATH
|
|
165
|
+
#: nor at its old System32\wbem location, so on current Windows it raises
|
|
166
|
+
#: FileNotFoundError and every tool refused with "Resolve is not running"
|
|
167
|
+
#: while Resolve sat in front of the user (#210). Keeping the old reader first
|
|
168
|
+
#: costs nothing precisely because absence fails instantly rather than burning
|
|
169
|
+
#: the timeout. Windows PowerShell 5.1 ships with Windows; `pwsh` is the
|
|
170
|
+
#: cross-platform 7.x binary, tried last for a machine that has only that one.
|
|
171
|
+
#:
|
|
172
|
+
#: `None` is returned only when NO reader ran. A reader that ran and found
|
|
173
|
+
#: nothing returns an empty list, which is a different answer.
|
|
174
|
+
WINDOWS_PROCESS_READERS = (
|
|
175
|
+
(["wmic", "process", "where", "name='Resolve.exe'", "get", "CommandLine"],
|
|
176
|
+
_windows_wmic_rows),
|
|
177
|
+
(["powershell", "-NoProfile", "-NonInteractive", "-Command", _CIM_COMMAND],
|
|
178
|
+
_windows_cim_rows),
|
|
179
|
+
(["pwsh", "-NoProfile", "-NonInteractive", "-Command", _CIM_COMMAND],
|
|
180
|
+
_windows_cim_rows),
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
|
|
99
184
|
def _process_table() -> Optional[List[Dict[str, Optional[str]]]]:
|
|
100
185
|
"""One row per process: `{pid, comm, args}`, or None when undeterminable.
|
|
101
186
|
|
|
@@ -113,27 +198,28 @@ def _process_table() -> Optional[List[Dict[str, Optional[str]]]]:
|
|
|
113
198
|
"""
|
|
114
199
|
if platform.system().lower() == "windows":
|
|
115
200
|
# `tasklist` prints no command line, so the flag is invisible there.
|
|
116
|
-
#
|
|
201
|
+
# The readers below do print it, which is what makes headless
|
|
202
|
+
# detection possible on Windows at all.
|
|
117
203
|
#
|
|
118
204
|
# Decoded explicitly: `text=True` alone decodes with the locale
|
|
119
205
|
# codepage, which raises UnicodeDecodeError on a byte cp1252 has no
|
|
120
206
|
# mapping for — and this read is the input to the second-instance
|
|
121
207
|
# guard, so it must fail to "cannot tell", never to an exception.
|
|
122
208
|
# ASCII is byte-identical under both codecs, so the matching this
|
|
123
|
-
# feeds is unchanged; what
|
|
124
|
-
# on a non-English Windows is not something we can verify here.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
209
|
+
# feeds is unchanged; what these readers emit for a non-ASCII install
|
|
210
|
+
# path on a non-English Windows is not something we can verify here.
|
|
211
|
+
for reader, parse in WINDOWS_PROCESS_READERS:
|
|
212
|
+
try:
|
|
213
|
+
out = subprocess.run(
|
|
214
|
+
reader, capture_output=True, text=True, encoding="utf-8",
|
|
215
|
+
errors="replace", timeout=10, check=False,
|
|
216
|
+
)
|
|
217
|
+
except Exception:
|
|
218
|
+
continue # this reader is unusable here; try the next one
|
|
219
|
+
if out.returncode != 0 and not (out.stdout or "").strip():
|
|
220
|
+
continue
|
|
221
|
+
return parse(out.stdout or "")
|
|
222
|
+
return None
|
|
137
223
|
|
|
138
224
|
comm_lines = _run_ps("pid=,comm=")
|
|
139
225
|
args_lines = _run_ps("pid=,args=")
|
|
@@ -225,6 +225,7 @@ _EVIDENCE_GATES: List[Dict[str, Any]] = [
|
|
|
225
225
|
# disagree, which is what keeps the two from drifting apart again.
|
|
226
226
|
|
|
227
227
|
CODE_FLOORS: Dict[str, str] = {
|
|
228
|
+
"TimelineItem.AddTransition": "21.1",
|
|
228
229
|
"TimelineItem.SetSpeed": "21.1",
|
|
229
230
|
"TimelineItem.SetFades": "21.1",
|
|
230
231
|
# Documented in the shipped 21.1 scripting CHANGELOG; read-only contributor
|