davinci-resolve-mcp 2.23.0 → 2.24.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.
@@ -0,0 +1,184 @@
1
+ # V2 Control Panel — Design
2
+
3
+ **Purpose:** Concrete design for extending `src/analysis_dashboard.py` into a V2 analysis review surface with thumbnails, shot detail, inline corrections, and chat ↔ panel state sharing.
4
+
5
+ **Companion docs:**
6
+ - `docs/design/v2-shot-schema-spec.md` — the V2 schema being reviewed
7
+ - `docs/design/v2-implementation-gameplan.md` — the broader task list (B1-B6, C1-C5)
8
+ - `docs/design/v2-db-schema.sql` — the eventual source-of-truth backing store
9
+
10
+ **Last updated:** 2026-05-19
11
+
12
+ ---
13
+
14
+ ## 1. Current state
15
+
16
+ The existing dashboard (`src/analysis_dashboard.py`, ~5000 lines):
17
+
18
+ - **Single-page HTML app** — embedded `HTML` string at the top of the file, served at `GET /`. CSS is inline (Bradford Operations design tokens defined in `:root`).
19
+ - **Stack:** native Python `http.server.ThreadingHTTPServer` + `BaseHTTPRequestHandler` (`Handler` class). No framework.
20
+ - **State:** `DashboardState` class holds project name/id/root; reads project contexts; lists projects across the analysis base root.
21
+ - **API routes** (under `/api/`):
22
+ - `GET /api/boot` — initial state + capabilities
23
+ - `GET /api/projects`, `GET /api/projects/all` — project listings
24
+ - `GET /api/resolve/media` — media inventory from Resolve
25
+ - `GET /api/jobs`, `POST /api/jobs`, `GET /api/jobs/<id>` — batch job management
26
+ - `GET /api/index/status`, `GET /api/index/query` — SQLite index queries
27
+ - `GET /api/docs` — doc viewer
28
+ - `GET /api/setup/schema`, `GET /api/setup/defaults` — setup defaults
29
+ - **Launch:** `python -m src.analysis_dashboard` with `--host`, `--port`, `--project-name`, `--project-id`, `--analysis-root`, `--open`. Also launchable via P12's `resolve_control(open_control_panel)` MCP action.
30
+
31
+ **What it does NOT have yet (V2 gaps):**
32
+ - No thumbnail rendering (does not serve `frames/sampled_NNNN.jpg`)
33
+ - No per-clip analysis review (clip_summary, editorial_classification visible)
34
+ - No per-shot detail view (V2 schema fields invisible)
35
+ - No inline correction UI (cannot edit subjective fields)
36
+ - No chat-panel state sharing (cannot react to chat saying "show shot 22")
37
+ - No "Open in Resolve" affordance per clip / shot
38
+ - No bin-grid representative thumbnails
39
+
40
+ ---
41
+
42
+ ## 2. Design principles
43
+
44
+ 1. **Stay with the existing stack.** No framework migration. Native http.server is fine for single-user local; if multi-user lands (C1 + cloud), revisit.
45
+ 2. **Chat-first UX** ([[feedback-conversational-ux]]) — the dashboard's primary value is *review with thumbnails*. Reading prose / asking questions / making cuts happens in chat. Panels are summoned by the conversation.
46
+ 3. **State-sharing via files**, not websockets. `panel_state.json` (already implemented in B6) is the substrate. Panel polls every ~2s; chat updates it via MCP actions. Lossy but simple and consistent with the rest of the architecture (heartbeat.json, corrections.json).
47
+ 4. **One additional view per release**. Don't ship a half-baked everything-view; ship one view at a time and validate.
48
+
49
+ ---
50
+
51
+ ## 3. Architecture additions
52
+
53
+ ### 3.1 New API endpoints
54
+
55
+ | Endpoint | Returns |
56
+ |---|---|
57
+ | `GET /api/clips` | List of analyzed clips with `{clip_id, clip_name, duration, analyzed_at, representative_frame_path}` for the bin grid |
58
+ | `GET /api/clips/<clip_id>` | Full V2 analysis for one clip (clip_summary, classification, shots[], cross_shot, qc) |
59
+ | `GET /api/clips/<clip_id>/shots` | Just the shots array (lighter than the full clip endpoint) |
60
+ | `GET /api/clips/<clip_id>/shots/<shot_index>` | Single shot's V2 fields + frame_indices |
61
+ | `GET /api/clips/<clip_id>/frames/<frame_index>` | Serves the actual JPEG file from `{clip_dir}/frames/sampled_NNNN.jpg` |
62
+ | `GET /api/clips/<clip_id>/corrections` | Read corrections.json for a clip |
63
+ | `POST /api/clips/<clip_id>/corrections` | Apply a correction (proxies to `media_analysis(update_shot_field)` or `update_clip_field` via direct function call) |
64
+ | `GET /api/panel_state` | Read panel_state.json |
65
+ | `POST /api/panel_state` | Update panel_state.json (merge by default) |
66
+ | `POST /api/resolve/open_clip` | Proxy to `media_pool_item(open_in_viewer)` so the UI can show "Open in Resolve" buttons |
67
+
68
+ All read endpoints read from disk (analysis.json + corrections.json sidecar) — no DB dependency. When C1 lands, swap to DB queries; UI doesn't change.
69
+
70
+ ### 3.2 New view: bin grid (B2 — first deliverable)
71
+
72
+ ```
73
+ +----------------------------------------+
74
+ | Project: 20260517_Sample |
75
+ | 47 clips · ~3h2m · last analyzed 9am |
76
+ +--+--+--+--+--+--+--+--+--+
77
+ |🎬|🎬|🎬|🎬|🎬|🎬|🎬|🎬|🎬| ← thumbnail cards
78
+ +--+--+--+--+--+--+--+--+--+
79
+ | CKY - Bam 2:32 ⭐ |
80
+ | select potential: high |
81
+ +---------------------------+
82
+ ```
83
+
84
+ Each card:
85
+ - Thumbnail = clip's middle shot's `representative_frame`
86
+ - Name, duration
87
+ - `select_potential` indicator (color or icon)
88
+ - Click → opens clip detail view (B3)
89
+
90
+ ### 3.3 New view: clip detail (B3 — second deliverable)
91
+
92
+ ```
93
+ +--------------------------------------+
94
+ | ← Back CKY - Bam and Rental Car
95
+ +--------------------------------------+
96
+ | clip_summary paragraph here... |
97
+ | Tags: cky, bam, stunt, ... |
98
+ +--------------------------------------+
99
+ | Shot strip (horizontal scroll): |
100
+ | [s1][s2][s3]...[s34] thumbnails |
101
+ +--------------------------------------+
102
+ | Cross-shot: coverage groups visualized
103
+ | Continuity chains drawn as arcs |
104
+ +--------------------------------------+
105
+ ```
106
+
107
+ Click a shot in the strip → opens shot detail (B3 cont.)
108
+
109
+ ### 3.4 New view: shot detail (B3 — third deliverable)
110
+
111
+ Two-column layout:
112
+
113
+ **Left column — V2 fields:**
114
+ - Visual: shot_size, framing, camera_height, camera_motion, lens, lighting, color_mood
115
+ - Content: primary_subject (with performance if person), action, location, audio_character
116
+ - Editorial: editorial_role, select_potential, pacing, best_moment
117
+ - Cuttability: cut_in, cut_out, match_action_in/out
118
+ - Relationships: same_setup_as, continues_from, alt_take_of (with links to other shots)
119
+ - Confidence badges per group
120
+
121
+ **Right column — frame grid:**
122
+ - All sampled frames for the shot
123
+ - Labels: shot_start / shot_progress / shot_end / flash_candidate / motion_peak
124
+ - Click frame → enlarged preview with time + delta_from_previous
125
+
126
+ **Header actions:**
127
+ - "Open in Resolve at this timecode" → triggers `media_pool_item(open_in_viewer)` with `mark_in_seconds`, `mark_out_seconds`
128
+ - "Edit" → flips fields to inline editing mode (B5)
129
+
130
+ ### 3.5 Inline correction UI (B5 — fourth deliverable)
131
+
132
+ When the user clicks "Edit" on a shot detail:
133
+ - Enum fields → dropdowns
134
+ - Strings → inline text input
135
+ - Booleans → toggles
136
+ - "Save" button per field group; "Cancel" reverts
137
+ - Saved changes call `POST /api/clips/<clip_id>/corrections` which writes to `corrections.json` via the C4 helpers
138
+ - After save, the field shows a small "human-edited by sam on May 19" tag; hover reveals changelog
139
+
140
+ ### 3.6 Chat ↔ panel state sync (B6 — DONE, wire up here)
141
+
142
+ The panel polls `GET /api/panel_state` every 2 seconds. When the chat (via MCP) writes to `panel_state.json` with `{current_clip_id, current_shot_index, current_view}`, the panel updates its view on the next poll.
143
+
144
+ Conversely, when the user clicks something in the panel, the panel writes back to `panel_state.json` via `POST /api/panel_state`. Chat reads it at the start of its next turn via `media_analysis(action="session_start_context")` (which already includes `panel_state`).
145
+
146
+ ---
147
+
148
+ ## 4. Implementation order (each step shippable on its own)
149
+
150
+ | Step | Adds | Validation |
151
+ |---|---|---|
152
+ | **Step 1** | `GET /api/clips`, `GET /api/clips/<id>/frames/<n>` endpoints + bin grid view (B2) | Open dashboard → see clips with thumbnails |
153
+ | **Step 2** | `GET /api/clips/<id>`, `GET /api/clips/<id>/shots/<n>` + clip detail view (B3 part 1) | Click a clip → see summary + shot strip |
154
+ | **Step 3** | Shot detail view (B3 part 2) | Click a shot → see all V2 fields + frame grid |
155
+ | **Step 4** | "Open in Resolve at this timecode" button wiring (B4 already done server-side) | Click → clip loads in source viewer with marks |
156
+ | **Step 5** | Inline correction UI (B5) + `POST /api/clips/<id>/corrections` | Edit a field → corrections.json updates → reload reflects change |
157
+ | **Step 6** | Chat ↔ panel state polling (B6 server-side done) — add 2s polling in HTML | Chat says "show shot 22" → panel scrolls to shot 22 |
158
+
159
+ Each step is 1-2 sessions of focused work. Steps 1-3 are mostly mechanical (read JSON, render HTML). Step 4 is small. Step 5 is the most involved (inline editing UX + provenance display). Step 6 is small.
160
+
161
+ ---
162
+
163
+ ## 5. Not in scope for V2.0
164
+
165
+ - Audio waveform rendering in shot detail
166
+ - Embedding-based similarity search visualization (depends on C3)
167
+ - Cross-clip / project-level views beyond the bin grid (depends on C5)
168
+ - Real-time multi-user collaboration (depends on C1 + cloud)
169
+ - Authoring tools (timeline drafts, EDL export from chat suggestions)
170
+
171
+ Defer to V2.1+ unless a specific use case bubbles up.
172
+
173
+ ---
174
+
175
+ ## 6. Open design questions
176
+
177
+ 1. **Thumbnail cache.** Do we serve JPEGs directly from `{clip_dir}/frames/` or pre-resize for grid views? Likely: direct serve for V2.0, resize later if performance demands.
178
+ 2. **Pagination on the bin grid.** Above what clip count do we paginate vs. infinite-scroll? Probably > 100 clips.
179
+ 3. **Cross-shot relationships rendering.** Arcs between shots in the strip? Connection lines? Group highlights? Needs a UX iteration once data is real.
180
+ 4. **Confidence visualization.** Color (red/yellow/green)? Icon? Faded text? Test with real users.
181
+
182
+ ---
183
+
184
+ *End of design. Step 1 (bin grid + thumbnail serving) is the smallest demoable slice — recommend starting there.*