davinci-resolve-mcp 2.203.0 → 2.205.0

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,106 @@
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.205.0 — a standard operation envelope on every tool result
6
+
7
+ Adapted from the design contributed in PR #181.
8
+
9
+ ### Added
10
+
11
+ - **`_operation` on every compound tool return.** Agents orchestrating
12
+ multi-turn edits had to answer the same three questions after every call —
13
+ did it happen, was it verified, what changed — in a different vocabulary per
14
+ tool (`readback.missing`, `succeeded`/`failed`, `partial`,
15
+ `status: "confirmation_required"`). Those are now normalized into one block:
16
+ `status` (`success` / `partial` / `blocked` / `failed`), `operation`,
17
+ `execution_id`, `verification`, `changes` and `warnings`.
18
+ - **A contradiction stays its own verification status.** "Resolve reported
19
+ success and the readback disagrees" is a different thing for a caller to act
20
+ on than "the call failed", and this repo's most valuable reliability signal;
21
+ it does not collapse into a failure. `readback.as_verification_dict` renders
22
+ a `verify_by_readback` result in the same shape.
23
+ - **`setup(action="set_defaults", params={"result_envelope": ...})`** — `dual`
24
+ (default), `pure`, or `legacy`, persisted to `logs/server-preferences.json`
25
+ and restored at startup. Override per call with `params={"envelope": ...}` or
26
+ per process with `RESOLVE_MCP_RESULT_ENVELOPE`.
27
+
28
+ ### Notes on the adaptation
29
+
30
+ - **The envelope is namespaced, not flattened.** Five of its key names —
31
+ `status` (22 sites), `operation` (20), `warnings` (15), `result` (8),
32
+ `changes` (2) — are already domain keys on this server, so merging the
33
+ envelope into the top level silently rewrote them: `resolve_control`
34
+ `job_status` reported `"success"` instead of `"done"` (an agent polling a
35
+ job would never see it finish), a confirm gate's `"confirmation_required"`
36
+ became `"blocked"` — renaming the very signal the envelope exists to make
37
+ unambiguous — and a transcription's `"Transcribed"` was lost. The payload is
38
+ now passed through untouched and the envelope rides under `_operation`,
39
+ following the existing `_versioning` convention. A guard test fails the
40
+ suite if any module starts returning `_operation` as a domain key.
41
+ - **An unreported delta is absent, not zero.** `changes: {}` reads as "this
42
+ operation changed nothing", which is false about an edit that simply never
43
+ declared its deltas — the silent-lie class this codebase treats as a bug.
44
+ The key is omitted instead, and `verification: "unverified"` likewise means
45
+ "no evidence reported", not "checked and clean".
46
+ - **Status inference keys only on conventions this repo actually uses.**
47
+ `blocked` reads like a gate flag but is a domain key holding the *list of
48
+ targets that could not be resolved*; a successful `bulk_match_to_hero` dry
49
+ run carries a non-empty one. Reading it as a gate reported a confirmation
50
+ that was never requested.
51
+ - **Semantic deltas are declared by the action, not guessed from key names.**
52
+ A mapping like `properties_restored_items` → `properties_updated` turns a
53
+ ripple insert's internal bookkeeping into an edit the caller never made.
54
+ `timeline.ripple_insert` declares its own; the rest report none rather than
55
+ a fabricated zero.
56
+ - Verified through the real stdio JSON-RPC tool layer, not just at module
57
+ level: 36 tools register, the envelope arrives, the payload is intact.
58
+
59
+ ## What's New in v2.204.0 — #179: the managed install can boot the advanced server
60
+
61
+ ### Fixed
62
+
63
+ - **The managed install now contains the tree the advanced bin imports.**
64
+ `setup` registered `davinci-resolve-advanced` in every generated client
65
+ config, pointing at `<managed root>/bin/davinci-resolve-advanced-mcp.mjs` —
66
+ but the bootstrapper's sync list never copied `resolve-advanced/`, which
67
+ that bin imports. The process died with `ERR_MODULE_NOT_FOUND` before the
68
+ MCP handshake, and every client reported the same uninformative "subprocess
69
+ closed stdout before responding". `resolve-advanced/` is now synced, and a
70
+ regression test drives the real sync into a temp root rather than restating
71
+ the list, so dropping it again fails the suite. Reported in #179.
72
+ - **Its Node dependencies are installed there too.** Syncing the tree alone
73
+ was only half the fix: the managed root has no `node_modules`, so
74
+ `@modelcontextprotocol/sdk`, `zod`, `jszip`, `fzstd` and `zstd-codec` still
75
+ failed to resolve. `setup` now runs `npm install --omit=dev --omit=optional`
76
+ under the managed `resolve-advanced/` before install.py writes any config.
77
+ Optional native deps (`better-sqlite3`, `sharp`, `pg`) stay optional — the
78
+ server already reports those gaps itself through `capabilities`, and a
79
+ failed native build must not take the whole setup down. Verified end to
80
+ end: a fresh managed install now completes the MCP handshake and registers
81
+ all 18 advanced tools.
82
+ - **A config is only written for a layout that can boot.** When
83
+ `resolve-advanced/` or its deps are absent, `build_advanced_entry` now emits
84
+ an `npx -y --package davinci-resolve-mcp@<version>` command instead of a
85
+ managed bin path that cannot start. `resolve-advanced/package.json` is the
86
+ single source of truth for which deps have to be present — install.py and
87
+ the bin both read it rather than restating the list.
88
+ - **An unbootable advanced server names its own fix.** The bin preflights its
89
+ server tree and dependencies and exits with what is missing and how to
90
+ repair it, instead of an `ERR_MODULE_NOT_FOUND` stack. The diagnostic goes
91
+ to stderr — stdout is the JSON-RPC channel, where it would corrupt the
92
+ handshake rather than explain it. `--version` and `--help` keep answering
93
+ from a broken install, since those are what a user reaches for when the
94
+ server will not start.
95
+
96
+ ### Added
97
+
98
+ - **`davinci-resolve-mcp sync`** — refresh the managed install and provision
99
+ the advanced server's Node deps without running the full interactive setup.
100
+ `--no-deps` syncs files only. Re-syncing preserves the provisioned
101
+ `node_modules`; a dev checkout's own `node_modules` is never copied into a
102
+ managed install, since its optional native deps are built for the
103
+ developer's platform and ABI.
104
+
5
105
  ## What's New in v2.203.0 — E151: verify_roundtrip fits a source offset from the majority
6
106
 
7
107
  ### Fixed
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-2.203.0-blue.svg)](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
5
+ [![Version](https://img.shields.io/badge/version-2.205.0-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-36%20(353%20full)-blue.svg)](#server-modes)
@@ -160,6 +160,12 @@ Add it alongside the live server (both ship in one `npm install`):
160
160
  need user-installed tools (ffmpeg for `audio`, `sharp`/`better-sqlite3` for some paths) — call the
161
161
  `capabilities` tool for live status and install hints.
162
162
 
163
+ Unlike the Python server, this one has Node dependencies. `npx davinci-resolve-mcp setup` installs them
164
+ into the managed install (`npm install --omit=dev --omit=optional` under `resolve-advanced/`) and only
165
+ then registers the bin. If that install could not run — offline, or npm unavailable — setup registers
166
+ an `npx` command for the advanced server instead, so the entry it writes always boots. To repair an
167
+ existing install without re-running setup: `npx davinci-resolve-mcp sync`.
168
+
163
169
  ### Bradford Post Assistant — managed application (closed beta)
164
170
 
165
171
  The maintainers also build **Bradford Post Assistant**, a desktop application on top of this
@@ -225,6 +231,27 @@ The open-source servers are complete and fully functional on their own.
225
231
  | Extension authoring | Fuse, DCTL, ACES DCTL, and Resolve-page Lua/Python script lifecycle helpers with safe MCP-marked install/remove |
226
232
  | Craft guidance | The bundled editorial, colour, audio, and workflow guidance served as prose over MCP — indexed, searchable, and readable by any client, not just ones with this repository on disk |
227
233
 
234
+ ### Operation envelope
235
+
236
+ Every compound tool return carries an `_operation` block beside its payload, so
237
+ an agent reads one shape instead of a different key per tool: `status`
238
+ (`success` / `partial` / `blocked` / `failed`), `verification` (with
239
+ `contradiction` kept distinct — Resolve reported success and the readback
240
+ disagreed), `changes` (the semantic delta), `warnings`, and an `execution_id`.
241
+
242
+ Two absences are meaningful and deliberate. `verification.status: "unverified"`
243
+ means *no evidence was reported*, not "checked and clean". A missing `changes`
244
+ means the action did not report a delta, not that nothing changed — an empty
245
+ `{}` there would be a confident, wrong answer about an edit that simply never
246
+ declared one.
247
+
248
+ The envelope is namespaced rather than merged into the top level because
249
+ `status`, `operation`, `warnings`, `result` and `changes` are all already domain
250
+ keys here; flattening would rewrite a background job's `status: "done"` and a
251
+ confirm gate's `status: "confirmation_required"`. `setup(action="set_defaults",
252
+ params={"result_envelope": "pure" | "legacy"})` changes the shape, per call via
253
+ `params={"envelope": ...}`, per process via `RESOLVE_MCP_RESULT_ENVELOPE`.
254
+
228
255
  ## Optional Extras
229
256
 
230
257
  The core install is deliberately small: Python, ffmpeg, and the Resolve scripting
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-2.203.0-blue.svg)](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
5
+ [![Version](https://img.shields.io/badge/version-2.205.0-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-36%20(353%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
- > 本翻译对应 v2.203.0 版 README。如与英文原版有出入,以 [英文原版](README.md) 为准。
15
+ > 本翻译对应 v2.205.0 版 README。如与英文原版有出入,以 [英文原版](README.md) 为准。
16
16
 
17
17
  一个 Model Context Protocol (MCP) 服务器,让 AI 助手通过官方脚本 API 控制 DaVinci Resolve Studio(达芬奇)。它提供完整的 API 覆盖,外加带护栏的工作流助手,涵盖剪辑、媒体池整理、渲染设置、审阅标记、调色、Fusion、Fairlight、项目生命周期任务、扩展开发,以及不碰源媒体的媒体分析。
18
18
 
@@ -105,6 +105,8 @@ DRX 调色写入**针对 Resolve Studio 做过实机校准**:调色参数默
105
105
 
106
106
  `install.py` 会把两个配置条目都打印出来。核心是纯 JS/MIT,无必需的原生模块;少数功能需要用户自装工具(`audio` 需要 ffmpeg,部分路径需要 `sharp`/`better-sqlite3`)——调用 `capabilities` 工具可查看实时状态和安装提示。
107
107
 
108
+ 和 Python 服务器不同,这个服务器有 Node 依赖。`npx davinci-resolve-mcp setup` 会先把依赖装进托管安装目录(在 `resolve-advanced/` 下执行 `npm install --omit=dev --omit=optional`),装好之后才注册这个可执行文件。如果安装跑不起来(离线,或者没有 npm),setup 会改为给 advanced 服务器写一条 `npx` 命令,这样写出去的配置条目总是能启动。要修复一个已有的安装而不重跑 setup:`npx davinci-resolve-mcp sync`。
109
+
108
110
  ### Bradford Post Assistant——托管应用(封闭测试中)
109
111
 
110
112
  维护者还在这个开源基础之上构建了 **Bradford Post Assistant**,一款桌面应用。MCP 服务器给了 agent 一双手,Post Assistant 则是围绕这双手的工作副驾——一个面向后期制作的本地 AI 助手,客户素材永不离开工作站:
@@ -150,6 +152,14 @@ DRX 调色写入**针对 Resolve Studio 做过实机校准**:调色参数默
150
152
  | 渲染与交付 | 格式/编解码矩阵探测、渲染设置校验、队列任务生命周期检查、带护栏的快速导出 |
151
153
  | 扩展开发 | Fuse、DCTL、ACES DCTL 及 Resolve 页面 Lua/Python 脚本生命周期助手,带 MCP 标记的安全安装/移除 |
152
154
 
155
+ ### 操作信封(operation envelope)
156
+
157
+ 每个复合工具的返回值都会在原有 payload 旁边带一个 `_operation` 块,这样 agent 读的是同一种结构,而不是每个工具一套 key:`status`(`success` / `partial` / `blocked` / `failed`)、`verification`(其中 `contradiction` 单独成一档——Resolve 报告成功但回读结果不一致)、`changes`(语义增量)、`warnings`,以及一个 `execution_id`。
158
+
159
+ 有两种"缺失"是刻意保留其含义的。`verification.status: "unverified"` 表示*没有报告任何证据*,不等于"已检查且没问题"。`changes` 缺失表示这个动作没有报告增量,不等于什么都没改——在那里放一个空的 `{}`,等于对一次并未声明增量的剪辑给出一个自信而错误的回答。
160
+
161
+ 信封是带命名空间的,而不是平铺到顶层,因为 `status`、`operation`、`warnings`、`result` 和 `changes` 在这里本来就都是业务 key;平铺会改写后台任务的 `status: "done"` 和确认关卡的 `status: "confirmation_required"`。用 `setup(action="set_defaults", params={"result_envelope": "pure" | "legacy"})` 改变形态,单次调用用 `params={"envelope": ...}`,进程级用 `RESOLVE_MCP_RESULT_ENVELOPE`。
162
+
153
163
  ## 可选增强
154
164
 
155
165
  核心安装刻意保持精简:Python、ffmpeg 和 Resolve 脚本 API。有些功能需要更多依赖,且**每一项都会诚实拒绝并给出自己的安装命令,而不是退化成瞎猜**——编造的节拍或虚构的电平会产出自信但错误的结果,比没有这个功能更糟。
@@ -62,7 +62,55 @@ if (major < 20 || (major === 20 && minor < 9)) {
62
62
  process.exit(1);
63
63
  }
64
64
 
65
- const serverEntry = path.resolve(__dirname, '..', 'resolve-advanced', 'server', 'index.mjs');
65
+ const advancedRoot = path.resolve(packageRoot, 'resolve-advanced');
66
+ const serverEntry = path.join(advancedRoot, 'server', 'index.mjs');
67
+
68
+ // Preflight, for the same reason as the Node floor above: a managed install
69
+ // that never received resolve-advanced/ (or its deps) otherwise dies with a
70
+ // bare ERR_MODULE_NOT_FOUND before the MCP handshake, and the client reports
71
+ // only "subprocess closed stdout before responding" — a stack trace with no
72
+ // fix in it. Issue #179. Say what is missing and how to repair it.
73
+ function missingRuntimePieces() {
74
+ if (!fs.existsSync(serverEntry)) {
75
+ return { what: `the advanced server tree (${serverEntry} is missing)` };
76
+ }
77
+ let required = [];
78
+ try {
79
+ const manifest = JSON.parse(fs.readFileSync(path.join(advancedRoot, 'package.json'), 'utf8'));
80
+ required = Object.keys(manifest.dependencies || {});
81
+ } catch {
82
+ return { what: `resolve-advanced/package.json (cannot tell which deps are required)` };
83
+ }
84
+ const modulesDir = path.join(advancedRoot, 'node_modules');
85
+ const missing = required.filter(
86
+ (dep) => !fs.existsSync(path.join(modulesDir, ...dep.split('/'))),
87
+ );
88
+ // Deps may also be hoisted above the package (an npm/npx install puts them in
89
+ // a parent node_modules), so an empty local node_modules is not conclusive —
90
+ // only report deps the resolver genuinely cannot see.
91
+ const unresolvable = missing.filter((dep) => {
92
+ try {
93
+ import.meta.resolve(dep);
94
+ return false;
95
+ } catch {
96
+ return true;
97
+ }
98
+ });
99
+ return unresolvable.length ? { what: `dependencies: ${unresolvable.join(', ')}` } : null;
100
+ }
101
+
102
+ const gap = missingRuntimePieces();
103
+ if (gap) {
104
+ process.stderr.write(
105
+ `[davinci-resolve-advanced-mcp] cannot start: ${gap.what}.\n` +
106
+ `This install is at ${packageRoot}.\n` +
107
+ `Fix: run \`npx davinci-resolve-mcp setup\` to repair the managed install ` +
108
+ `(it syncs resolve-advanced/ and installs its Node dependencies), or run the ` +
109
+ `server straight from the package with ` +
110
+ `\`npx -y --package davinci-resolve-mcp davinci-resolve-advanced-mcp\`.\n`,
111
+ );
112
+ process.exit(1);
113
+ }
66
114
 
67
115
  const { startServer } = await import(pathToFileURL(serverEntry).href);
68
116
  await startServer();
@@ -24,6 +24,11 @@ const PY_ABI_RISK_MINOR = 13;
24
24
  const SYNC_ITEMS = [
25
25
  "bin",
26
26
  "src",
27
+ // The Node 'advanced' bin resolves ../resolve-advanced/server/index.mjs
28
+ // relative to itself, and install.py registers that bin into every generated
29
+ // client config. Leaving the tree out of the sync shipped configs that
30
+ // pointed at a module the managed install could never contain (issue #179).
31
+ "resolve-advanced",
27
32
  "docs",
28
33
  "examples",
29
34
  "scripts",
@@ -52,6 +57,7 @@ Usage:
52
57
  davinci-resolve-mcp server [server.py options]
53
58
  davinci-resolve-mcp control-panel [control panel options]
54
59
  davinci-resolve-mcp batch <plan|run|status|list|resume|cancel> [options]
60
+ davinci-resolve-mcp sync [--no-deps]
55
61
  davinci-resolve-mcp --version
56
62
  davinci-resolve-mcp --help
57
63
 
@@ -61,6 +67,7 @@ Examples:
61
67
  npx davinci-resolve-mcp doctor
62
68
  npx davinci-resolve-mcp batch run /path/to/footage --depth standard
63
69
  npx davinci-resolve-mcp batch run /path/to/footage --json > progress.log
70
+ npx davinci-resolve-mcp sync # refresh the managed install only
64
71
 
65
72
  Environment:
66
73
  DAVINCI_RESOLVE_MCP_INSTALL_ROOT Override the managed install directory.
@@ -132,6 +139,28 @@ function validateManagedRoot(root) {
132
139
  }
133
140
  }
134
141
 
142
+ // Top-level children of a synced item that the sync must NOT delete. The
143
+ // advanced server's node_modules is installed *into* the managed root by
144
+ // provisionAdvancedDeps and has no counterpart in the package, so a blanket
145
+ // clear would throw it away on every subsequent command and force a reinstall.
146
+ const SYNC_PRESERVE = {
147
+ "resolve-advanced": ["node_modules"],
148
+ };
149
+
150
+ function clearDestination(destination, preserve) {
151
+ if (!preserve.length || !fs.existsSync(destination)) {
152
+ fs.rmSync(destination, { recursive: true, force: true });
153
+ return;
154
+ }
155
+ const keep = new Set(preserve);
156
+ for (const entry of fs.readdirSync(destination)) {
157
+ if (keep.has(entry)) {
158
+ continue;
159
+ }
160
+ fs.rmSync(path.join(destination, entry), { recursive: true, force: true });
161
+ }
162
+ }
163
+
135
164
  function copyItem(name, destinationRoot) {
136
165
  const source = path.join(PACKAGE_ROOT, name);
137
166
  if (!fs.existsSync(source)) {
@@ -139,7 +168,7 @@ function copyItem(name, destinationRoot) {
139
168
  }
140
169
 
141
170
  const destination = path.join(destinationRoot, name);
142
- fs.rmSync(destination, { recursive: true, force: true });
171
+ clearDestination(destination, SYNC_PRESERVE[name] || []);
143
172
  fs.cpSync(source, destination, {
144
173
  recursive: true,
145
174
  errorOnExist: false,
@@ -154,6 +183,13 @@ function shouldSyncPath(sourcePath) {
154
183
  if (basename === "__pycache__" || basename === ".DS_Store") {
155
184
  return false;
156
185
  }
186
+ // A dev checkout carries resolve-advanced/node_modules with optional native
187
+ // deps (sharp, better-sqlite3) built for the developer's platform+ABI.
188
+ // Copying those into a managed install is slow and ships binaries that may
189
+ // not load there; provisionAdvancedDeps installs them fresh instead.
190
+ if (basename === "node_modules") {
191
+ return false;
192
+ }
157
193
  if (basename.endsWith(".pyc") || basename.endsWith(".pyo")) {
158
194
  return false;
159
195
  }
@@ -179,6 +215,124 @@ function syncManagedInstall(root) {
179
215
  return root;
180
216
  }
181
217
 
218
+ // ─── Advanced (Node) server runtime ─────────────────────────────────────────
219
+ //
220
+ // The advanced bin imports ../resolve-advanced/server/index.mjs, which in turn
221
+ // imports @modelcontextprotocol/sdk, zod, jszip, fzstd, zstd-codec and the
222
+ // vendored codecs. Syncing the tree is only half the fix for issue #179: the
223
+ // managed root has no node_modules, so the imports still fail. Node resolves
224
+ // them from resolve-advanced/node_modules, which resolve-advanced/package.json
225
+ // declares — so that manifest, not a list duplicated here, is the source of
226
+ // truth for what has to be present.
227
+
228
+ function advancedRoot(root) {
229
+ return path.join(root, "resolve-advanced");
230
+ }
231
+
232
+ function advancedServerEntry(root) {
233
+ return path.join(advancedRoot(root), "server", "index.mjs");
234
+ }
235
+
236
+ function advancedRequiredDeps(root) {
237
+ const manifest = path.join(advancedRoot(root), "package.json");
238
+ try {
239
+ const parsed = JSON.parse(fs.readFileSync(manifest, "utf8"));
240
+ return Object.keys(parsed.dependencies || {});
241
+ } catch {
242
+ return [];
243
+ }
244
+ }
245
+
246
+ /** Can the advanced server actually boot from this root? Names what is missing. */
247
+ function advancedRuntimeStatus(root) {
248
+ const entry = advancedServerEntry(root);
249
+ const entryPresent = fs.existsSync(entry);
250
+ const modulesDir = path.join(advancedRoot(root), "node_modules");
251
+ const required = advancedRequiredDeps(root);
252
+ const missingDeps = required.filter(
253
+ (dep) => !fs.existsSync(path.join(modulesDir, ...dep.split("/")))
254
+ );
255
+ return {
256
+ entry,
257
+ entryPresent,
258
+ // No manifest to read means we cannot tell what is required; treat that as
259
+ // "not bootable" rather than quietly reporting a clean bill of health.
260
+ depsPresent: required.length > 0 && missingDeps.length === 0,
261
+ required,
262
+ missingDeps,
263
+ bootable: entryPresent && required.length > 0 && missingDeps.length === 0,
264
+ };
265
+ }
266
+
267
+ function npmCommand() {
268
+ return process.platform === "win32" ? "npm.cmd" : "npm";
269
+ }
270
+
271
+ /**
272
+ * Install the advanced server's Node deps into the managed root.
273
+ *
274
+ * Optional deps (better-sqlite3, sharp, pg, js-yaml) stay omitted on purpose:
275
+ * they are native or heavy, the server already reports capability-specific
276
+ * setup gaps when they are absent, and a failed native build must not take the
277
+ * whole setup down with it.
278
+ *
279
+ * stdio is inherited on stderr only — this must never write to stdout, which
280
+ * on the server path is a JSON-RPC channel.
281
+ */
282
+ function provisionAdvancedDeps(root, { force = false } = {}) {
283
+ const before = advancedRuntimeStatus(root);
284
+ if (!before.entryPresent) {
285
+ return { ...before, ran: false, reason: "advanced server tree is not present" };
286
+ }
287
+ if (before.depsPresent && !force) {
288
+ return { ...before, ran: false, reason: "already provisioned" };
289
+ }
290
+
291
+ const result = spawnSync(
292
+ npmCommand(),
293
+ ["install", "--omit=dev", "--omit=optional", "--no-audit", "--no-fund"],
294
+ { cwd: advancedRoot(root), stdio: ["ignore", "inherit", "inherit"], encoding: "utf8" }
295
+ );
296
+
297
+ const after = advancedRuntimeStatus(root);
298
+ return {
299
+ ...after,
300
+ ran: true,
301
+ ok: result.status === 0 && after.bootable,
302
+ status: result.status,
303
+ error: result.error ? result.error.message : null,
304
+ };
305
+ }
306
+
307
+ function reportAdvancedRuntime(root, { provision }) {
308
+ const outcome = provision
309
+ ? provisionAdvancedDeps(root)
310
+ : advancedRuntimeStatus(root);
311
+
312
+ if (outcome.bootable) {
313
+ console.log("Advanced server (Node): ready");
314
+ return outcome;
315
+ }
316
+ if (!outcome.entryPresent) {
317
+ console.log(
318
+ `Advanced server (Node): unavailable — ${outcome.entry} is missing. ` +
319
+ `The 'davinci-resolve-advanced' entry will be registered as an npx command instead.`
320
+ );
321
+ return outcome;
322
+ }
323
+ const missing = outcome.missingDeps.length
324
+ ? outcome.missingDeps.join(", ")
325
+ : "its dependency manifest";
326
+ console.log(
327
+ `Advanced server (Node): not bootable — missing ${missing}. ` +
328
+ (outcome.error ? `npm install failed: ${outcome.error}. ` : "") +
329
+ `Fix: run 'npm install --omit=dev --omit=optional' in ${advancedRoot(root)}, ` +
330
+ `or re-run 'npx davinci-resolve-mcp setup' with a network connection. ` +
331
+ `Until then the 'davinci-resolve-advanced' entry falls back to an npx command.`
332
+ );
333
+ return outcome;
334
+ }
335
+
182
336
  function parseExecutable(value) {
183
337
  if (!value) {
184
338
  return null;
@@ -373,6 +527,9 @@ function commandSetup(args) {
373
527
 
374
528
  console.log(`DaVinci Resolve MCP managed install: ${root}`);
375
529
  console.log(`Python: ${python.executable} (${python.major}.${python.minor}.${python.micro})`);
530
+ // Before install.py, not after: it inspects this layout to decide whether the
531
+ // 'davinci-resolve-advanced' entry can point at the managed bin.
532
+ reportAdvancedRuntime(root, { provision: true });
376
533
  run(command, commandArgs, { cwd: root });
377
534
  }
378
535
 
@@ -394,6 +551,8 @@ function commandDoctor(args) {
394
551
 
395
552
  console.log(`DaVinci Resolve MCP managed install: ${root}`);
396
553
  console.log(`Python: ${python.executable} (${python.major}.${python.minor}.${python.micro})`);
554
+ // Diagnose only — doctor already forces --dry-run and must not install.
555
+ reportAdvancedRuntime(root, { provision: false });
397
556
  run(command, commandArgs, { cwd: root });
398
557
  }
399
558
 
@@ -422,6 +581,16 @@ function commandBatch(args) {
422
581
  run(command, commandArgs, { cwd: root });
423
582
  }
424
583
 
584
+ function commandSync(args) {
585
+ const provision = !args.includes("--no-deps");
586
+ const root = syncManagedInstall(installRoot());
587
+ console.log(`DaVinci Resolve MCP managed install: ${root}`);
588
+ const outcome = reportAdvancedRuntime(root, { provision });
589
+ if (provision && !outcome.bootable) {
590
+ process.exit(1);
591
+ }
592
+ }
593
+
425
594
  function main() {
426
595
  const argv = process.argv.slice(2);
427
596
  // No args → run the MCP stdio server. Anything printed to stdout would
@@ -457,6 +626,10 @@ function main() {
457
626
  commandBatch(args);
458
627
  return;
459
628
  }
629
+ if (command === "sync") {
630
+ commandSync(args);
631
+ return;
632
+ }
460
633
 
461
634
  console.error(`Unknown command: ${command}\n`);
462
635
  console.error(usage());
package/docs/SKILL.md CHANGED
@@ -158,6 +158,59 @@ before mutating Resolve state.
158
158
 
159
159
  ---
160
160
 
161
+ ## Reading A Result: The Operation Envelope
162
+
163
+ Every compound tool return carries an `_operation` block alongside its normal
164
+ payload. It answers the three questions that otherwise need a different key per
165
+ tool — did it happen, was it verified, what changed:
166
+
167
+ ```json
168
+ {
169
+ "success": true,
170
+ "insert_frame_absolute": 86400,
171
+ "shift_frames": 48,
172
+
173
+ "_operation": {
174
+ "status": "success",
175
+ "operation": "timeline.ripple_insert",
176
+ "execution_id": "exec_d2c123817bee",
177
+ "verification": {
178
+ "status": "passed",
179
+ "checks": [{"check": "readback_verification", "passed": true, "missing_items": 0}],
180
+ "contradiction": false
181
+ },
182
+ "changes": {"items_added": 3, "items_moved": 17, "items_deleted": 0}
183
+ }
184
+ }
185
+ ```
186
+
187
+ - **`status`** — `success` | `partial` | `blocked` | `failed`. `blocked` means a
188
+ confirm gate is waiting; the payload still carries the `confirm_token` and
189
+ `preview` to act on.
190
+ - **`verification.status`** — `passed` | `failed` | `partial` | `contradiction`
191
+ | `unverified`. **`contradiction` is the one to stop on**: Resolve reported
192
+ success and the readback disagrees. **`unverified` means no evidence was
193
+ reported, not that the operation was checked and found clean** — if you need
194
+ certainty there, go and read the state back.
195
+ - **`changes`** — the semantic delta, present only when the action declared or
196
+ reported one. **Absent means "not reported", never "nothing changed"**, so do
197
+ not read a missing `changes` as a no-op.
198
+ - **`warnings`** — present only when there are any.
199
+ - **`execution_id`** — correlates one call across logs and transcripts.
200
+
201
+ The envelope is namespaced under `_operation` rather than merged into the top
202
+ level because `status`, `operation`, `warnings`, `result` and `changes` are all
203
+ already domain keys on this server (a background job's `status` is `"done"`, a
204
+ confirm gate's is `"confirmation_required"`). The payload is passed through
205
+ untouched; read domain values where you always read them.
206
+
207
+ Change the shape with `setup(action="set_defaults", params={"result_envelope": "pure" | "legacy" | "dual"})`,
208
+ per call with `params={"envelope": "pure"}`, or per process with
209
+ `RESOLVE_MCP_RESULT_ENVELOPE`. `pure` returns only the envelope with the payload
210
+ nested under `result`; `legacy` adds nothing.
211
+
212
+ ---
213
+
161
214
  ## Two Server Modes
162
215
 
163
216
  | Mode | Entry point | Tool count | Use when |
package/docs/install.md CHANGED
@@ -127,6 +127,7 @@ npx davinci-resolve-mcp setup --clients all # Configure all clients
127
127
  npx davinci-resolve-mcp doctor # Dry-run environment/config check
128
128
  npx davinci-resolve-mcp server # Launch the managed MCP server
129
129
  npx davinci-resolve-mcp control-panel # Launch the local control panel
130
+ npx davinci-resolve-mcp sync # Refresh the managed install only
130
131
 
131
132
  python install.py # Interactive mode
132
133
  python install.py --clients all # Configure all clients
package/install.py CHANGED
@@ -37,7 +37,7 @@ from src.utils.update_check import (
37
37
 
38
38
  # ─── Version ──────────────────────────────────────────────────────────────────
39
39
 
40
- VERSION = "2.203.0"
40
+ VERSION = "2.205.0"
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
@@ -1180,8 +1180,17 @@ def build_advanced_entry(server_path, python_path=None):
1180
1180
  pyaaf2). We pin AAF_PROBE_PYTHON to the project venv's interpreter — the same
1181
1181
  venv install.py installs pyaaf2 into — so AAF preview works out of the box
1182
1182
  instead of depending on whatever `python3` happens to be on PATH.
1183
+
1184
+ The bin is only registered when this install can actually boot it. Pointing
1185
+ a client config at a bin whose module tree is absent produced issue #179:
1186
+ the process died with ERR_MODULE_NOT_FOUND before the MCP handshake and
1187
+ every client reported the same uninformative "subprocess closed stdout
1188
+ before responding". When the layout is incomplete we emit the npx form
1189
+ instead, which resolves the module and its deps from the npm cache.
1183
1190
  """
1184
1191
  project_dir = Path(server_path).resolve().parents[1] # .../src/server.py -> repo root
1192
+ if not advanced_is_bootable(project_dir):
1193
+ return build_advanced_npx_entry(python_path)
1185
1194
  advanced_bin = project_dir / "bin" / "davinci-resolve-advanced-mcp.mjs"
1186
1195
  entry = {"command": resolve_node_command(), "args": [str(advanced_bin)]}
1187
1196
  if python_path:
@@ -1189,6 +1198,66 @@ def build_advanced_entry(server_path, python_path=None):
1189
1198
  return entry
1190
1199
 
1191
1200
 
1201
+ def advanced_required_deps(project_dir):
1202
+ """Runtime deps the advanced server needs, read from its own manifest.
1203
+
1204
+ resolve-advanced/package.json is the single source of truth — the same file
1205
+ `npm install` in that directory acts on, and the same list the advanced bin
1206
+ preflights against. Nothing here restates it.
1207
+ """
1208
+ manifest = Path(project_dir) / "resolve-advanced" / "package.json"
1209
+ try:
1210
+ with open(manifest, "r", encoding="utf-8") as fh:
1211
+ return list(json.load(fh).get("dependencies", {}).keys())
1212
+ except Exception:
1213
+ return []
1214
+
1215
+
1216
+ def advanced_is_bootable(project_dir):
1217
+ """True when resolve-advanced/ and its Node deps are both present here."""
1218
+ project_dir = Path(project_dir)
1219
+ if not (project_dir / "resolve-advanced" / "server" / "index.mjs").is_file():
1220
+ return False
1221
+ required = advanced_required_deps(project_dir)
1222
+ if not required:
1223
+ return False
1224
+ # Deps live either in resolve-advanced/node_modules (what `npx
1225
+ # davinci-resolve-mcp setup` provisions in a managed install) or hoisted to
1226
+ # the package root (what a plain `npm install` of this package produces).
1227
+ for dep in required:
1228
+ local = project_dir / "resolve-advanced" / "node_modules" / dep
1229
+ hoisted = project_dir / "node_modules" / dep
1230
+ if not local.is_dir() and not hoisted.is_dir():
1231
+ return False
1232
+ return True
1233
+
1234
+
1235
+ def build_advanced_npx_entry(python_path=None):
1236
+ """Fallback advanced entry that runs from the npm package, not this tree.
1237
+
1238
+ Slower to start (npx resolves the package first) but it always boots, which
1239
+ a managed-install bin path does not guarantee.
1240
+ """
1241
+ entry = {
1242
+ "command": "npx",
1243
+ "args": ["-y", "--package", f"davinci-resolve-mcp@{package_version()}",
1244
+ "davinci-resolve-advanced-mcp"],
1245
+ }
1246
+ if python_path:
1247
+ entry["env"] = {"AAF_PROBE_PYTHON": str(python_path)}
1248
+ return entry
1249
+
1250
+
1251
+ def package_version(default="latest"):
1252
+ """Version from package.json, for pinning the npx fallback."""
1253
+ manifest = Path(__file__).resolve().parent / "package.json"
1254
+ try:
1255
+ with open(manifest, "r", encoding="utf-8") as fh:
1256
+ return json.load(fh).get("version") or default
1257
+ except Exception:
1258
+ return default
1259
+
1260
+
1192
1261
  # Node floor for the advanced server (package.json engines). Below it the
1193
1262
  # pure-JS tools limp along while native-dep paths (better-sqlite3) die with a
1194
1263
  # cryptic NODE_MODULE_VERSION mismatch — measured live when a client config's