@lalalic/markcut 3.2.21 → 3.2.23
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/package.json +1 -1
- package/skills/markcut/SKILL.md +2 -1
- package/src/mcp/bridge.mjs +64 -3
- package/src/mcp/preview.mjs +9 -5
- package/src/mcp/remotion-app.bundle.js +282 -282
- package/src/mcp/remotion-app.tsx +23 -4
- package/src/player/components/SceneThumbnails.tsx +5 -2
- package/tests/mcp-preview-bridge.test.ts +57 -4
- package/tests/mcp-preview.test.ts +1 -1
package/package.json
CHANGED
package/skills/markcut/SKILL.md
CHANGED
|
@@ -82,7 +82,7 @@ npx @lalalic/markcut spots --waypoints "lat,lng;lat,lng" # discover POIs along a
|
|
|
82
82
|
|
|
83
83
|
For native previews, Maps, playback, audio/subtitles or hosted ChatGPT MCP iframe issues, load [Preview Troubleshooting](references/preview-troubleshooting.md). Treat native playback, MCP compilation and hosted iframe rendering as separate verification gates.
|
|
84
84
|
|
|
85
|
-
## MCP Video Preview and Human Review (Player
|
|
85
|
+
## MCP Video Preview and Human Review (Player v25)
|
|
86
86
|
|
|
87
87
|
Use the model-visible `markcut.preview({path})` tool when a human needs to **watch and review a Markcut video** in ChatGPT. It is a video player, **not** a generic Markdown renderer and not the same as the local `npx @lalalic/markcut preview <file>` command.
|
|
88
88
|
|
|
@@ -91,6 +91,7 @@ Use the model-visible `markcut.preview({path})` tool when a human needs to **wat
|
|
|
91
91
|
- Player controls include Play/Pause, Seek, volume/audio, fullscreen and a **horizontal clickable scene list** sourced from compiled scene metadata. The title bar displays **Markcut · video title**, a **Browser TTS** switch, and the player version at right.
|
|
92
92
|
- **Browser TTS** is an optional preview playback mode (default on when subtitle VTT exists). It speaks existing caption/script text in the browser; it does **not** use STT. Toggle off for generated audio and the original subtitle renderer. This switch does not currently skip compilation-time TTS or affect final renders. Playback timing and seeking are approximate for browser speech.
|
|
93
93
|
- Google Maps `map` streams (route/cinematic) can be prerendered by Remotion into MP4 during MCP compilation. The published compiled JSON then references video streams, not live map tiles or a browser-exposed API key. If the render key is unavailable or prerendering fails, the original live Google Maps stream is preserved as a fallback. Native Map support remains available.
|
|
94
|
+
- **Batch review:** choose scenes in the horizontal list and draft comments for each; scenes with drafts are highlighted. Returning to a scene restores its draft. **Add timed comment** stores a separate note at the current playback position. **Submit all feedback** sends one `changes_requested` message with a structured `comments[]` list of text and scene/time context, plus a backwards-compatible `feedback` summary. Drafts stay inside the current preview revision; approval requires resolving any unsent comments.
|
|
94
95
|
- **Send feedback** (formerly Request changes) requires text and sends `ui/message` with `decision: "changes_requested"`, the source path, revision/content hash, and `playbackContext` (current `sceneId`, `sceneName`, `timeSeconds`) when available. The calling agent must interpret the feedback, edit the supplied video Markdown, and invoke `markcut.preview` again for the next turn. The player does not edit files.
|
|
95
96
|
- **Approve** sends `decision: "approved"` via `ui/message` for the specific revision. Do not approve a different/newer revision on the basis of an old review.
|
|
96
97
|
- Earlier previews are read-only once superseded; the submitted revision is checked against the latest published hash.
|
package/src/mcp/bridge.mjs
CHANGED
|
@@ -2,6 +2,61 @@ export function buildPreviewBridgeScript() {
|
|
|
2
2
|
return `
|
|
3
3
|
const feedback=document.getElementById('feedback'),status=document.getElementById('status'),pathLabel=document.getElementById('path-label');
|
|
4
4
|
let nextId=0,identity=null,busy=false,expectedPath=null,activePath=null,activeRelay=null,submittedRevision=null;
|
|
5
|
+
// Draft comments stay inside this preview revision until one final submission.
|
|
6
|
+
const drafts=new Map(),spots=[];
|
|
7
|
+
let currentScene={sceneId:null,sceneName:null,timeSeconds:0},editingSpot=null,nextSpotId=0;
|
|
8
|
+
const sceneKey=c=>String(c?.sceneName||c?.sceneId||'General');
|
|
9
|
+
function storeInput(){
|
|
10
|
+
if(editingSpot!==null){const found=spots.find(x=>x.id===editingSpot);if(found)found.text=feedback.value;}
|
|
11
|
+
else drafts.set(sceneKey(currentScene),{text:feedback.value,context:{...currentScene}});
|
|
12
|
+
}
|
|
13
|
+
function allComments(){
|
|
14
|
+
storeInput();
|
|
15
|
+
return [
|
|
16
|
+
...Array.from(drafts.values()).filter(x=>x.text.trim()).map(x=>({text:x.text.trim(),playbackContext:x.context})),
|
|
17
|
+
...spots.filter(x=>x.text.trim()).map(x=>({text:x.text.trim(),playbackContext:x.context}))
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
function redrawComments(){
|
|
21
|
+
const comments=allComments();
|
|
22
|
+
const names=[...new Set(comments.map(x=>sceneKey(x.playbackContext)))];
|
|
23
|
+
window.dispatchEvent(new CustomEvent('markcut:comments-change',{detail:{sceneNames:names}}));
|
|
24
|
+
const count=document.getElementById('comment-count');
|
|
25
|
+
if(count)count.textContent=comments.length+' comment'+(comments.length===1?'':'s');
|
|
26
|
+
const target=document.getElementById('comment-target');
|
|
27
|
+
if(target)target.textContent=sceneKey(currentScene)+(editingSpot===null?' · scene comment':' · timed comment');
|
|
28
|
+
const list=document.getElementById('comment-list');
|
|
29
|
+
if(!list)return;
|
|
30
|
+
list.replaceChildren();
|
|
31
|
+
for(const note of spots){
|
|
32
|
+
if(!note.text.trim())continue;
|
|
33
|
+
const row=document.createElement('div'),edit=document.createElement('button'),remove=document.createElement('button');
|
|
34
|
+
edit.type='button';edit.textContent=sceneKey(note.context)+' · '+(note.context.timeSeconds??0)+'s · '+note.text.slice(0,80);
|
|
35
|
+
edit.onclick=()=>{storeInput();currentScene={...note.context};editingSpot=note.id;feedback.value=note.text;window.dispatchEvent(new CustomEvent('markcut:comment-select',{detail:note.context}));redrawComments();};
|
|
36
|
+
remove.type='button';remove.textContent='Remove';
|
|
37
|
+
remove.onclick=()=>{const at=spots.findIndex(x=>x.id===note.id);if(at>=0)spots.splice(at,1);if(editingSpot===note.id){editingSpot=null;feedback.value=drafts.get(sceneKey(currentScene))?.text||'';}redrawComments();};
|
|
38
|
+
row.append(edit,remove);list.append(row);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function clearComments(){
|
|
42
|
+
drafts.clear();spots.length=0;editingSpot=null;currentScene={sceneId:null,sceneName:null,timeSeconds:0};feedback.value='';redrawComments();
|
|
43
|
+
}
|
|
44
|
+
feedback.addEventListener('input',redrawComments);
|
|
45
|
+
window.addEventListener('markcut:scene-change',event=>{
|
|
46
|
+
const next=event.detail||{};
|
|
47
|
+
if(sceneKey(next)===sceneKey(currentScene))return;
|
|
48
|
+
storeInput();editingSpot=null;currentScene={...next};feedback.value=drafts.get(sceneKey(next))?.text||'';redrawComments();
|
|
49
|
+
});
|
|
50
|
+
document.getElementById('save-spot').onclick=()=>{
|
|
51
|
+
storeInput();const value=feedback.value.trim();
|
|
52
|
+
if(!value){status.textContent='Write a comment before adding a timed note.';return;}
|
|
53
|
+
if(editingSpot!==null){
|
|
54
|
+
editingSpot=null;feedback.value=drafts.get(sceneKey(currentScene))?.text||'';redrawComments();return;
|
|
55
|
+
}
|
|
56
|
+
drafts.delete(sceneKey(currentScene));
|
|
57
|
+
spots.push({id:++nextSpotId,text:value,context:{...(window.__markcutPlaybackContext||currentScene)}});
|
|
58
|
+
feedback.value='';redrawComments();
|
|
59
|
+
};
|
|
5
60
|
const pending=new Map();
|
|
6
61
|
const resultsByPath=new Map();
|
|
7
62
|
let fallbackGeneration=0;
|
|
@@ -97,6 +152,7 @@ function reviewReadonly(readonly,message){
|
|
|
97
152
|
}
|
|
98
153
|
async function renderRevision(data){
|
|
99
154
|
const generation=++renderGeneration;
|
|
155
|
+
if(identity?.revisionId&&identity.revisionId!==data.revisionId)clearComments();
|
|
100
156
|
if(data.path){pathLabel.textContent=data.path;showVideoName(data.path,data.title||data.videoTitle);}
|
|
101
157
|
if(!data.compiled&&!data.compiledUrl){status.textContent='Compiled scenes unavailable';return;}
|
|
102
158
|
identity={previewId:data.id,revisionId:data.revisionId,contentHash:data.contentHash};
|
|
@@ -145,8 +201,9 @@ async function initialize(){
|
|
|
145
201
|
}
|
|
146
202
|
async function submit(decision){
|
|
147
203
|
if(busy)return;
|
|
148
|
-
const
|
|
149
|
-
if(decision==='changes_requested'&&!
|
|
204
|
+
const comments=allComments();
|
|
205
|
+
if(decision==='changes_requested'&&!comments.length){status.textContent='Feedback is required.';return;}
|
|
206
|
+
if(decision==='approved'&&comments.length){status.textContent='Submit or remove draft comments before approval.';return;}
|
|
150
207
|
if(!identity){status.textContent='Preview identity unavailable.';return;}
|
|
151
208
|
if(window.__markcutRevision?.compiledUrl){
|
|
152
209
|
try{if(!await currentRevisionMatches(activePath,identity.contentHash)){reviewReadonly(true,'Historical Preview · Read-only');return;}}
|
|
@@ -155,7 +212,11 @@ async function submit(decision){
|
|
|
155
212
|
const result={...identity,decision};
|
|
156
213
|
if(activePath)result.path=activePath;
|
|
157
214
|
if(activeRelay)result.relay=activeRelay;
|
|
158
|
-
if(decision==='changes_requested'){
|
|
215
|
+
if(decision==='changes_requested'){
|
|
216
|
+
result.comments=comments;
|
|
217
|
+
result.feedback=comments.length===1?comments[0].text:comments.map((item,index)=>String(index+1)+'. ['+sceneKey(item.playbackContext)+' @ '+(item.playbackContext.timeSeconds??0)+'s] '+item.text).join('\\n');
|
|
218
|
+
if(window.__markcutPlaybackContext)result.playbackContext=window.__markcutPlaybackContext;
|
|
219
|
+
}
|
|
159
220
|
busy=true;status.textContent='Submitting…';
|
|
160
221
|
const submittedId=result.revisionId;
|
|
161
222
|
try{await request('ui/message',{role:'user',content:[{type:'text',text:JSON.stringify(result)}]});if(identity?.revisionId===submittedId){submittedRevision=submittedId;status.textContent=decision==='approved'?'Approved.':'Feedback sent. Waiting for the updated preview.';}}
|
package/src/mcp/preview.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { buildPreviewBridgeScript } from "./bridge.mjs";
|
|
|
8
8
|
import { externalizePreviewMedia, publicOrigin, resolveMountedFile, resolvePreviewPath, publishPlayerBundle, publishCompiledCache, prunePublishedCache, EXPORT_ROOT } from "./remote-assets.mjs";
|
|
9
9
|
|
|
10
10
|
export const TOOL_NAME = "markcut.preview";
|
|
11
|
-
export const RESOURCE_URI = "ui://markcut/video-preview-
|
|
11
|
+
export const RESOURCE_URI = "ui://markcut/video-preview-v25.html";
|
|
12
12
|
// Legacy entrypoints remain registered, but serve the current implementation.
|
|
13
13
|
export const LEGACY_RESOURCE_URIS = [
|
|
14
14
|
"ui://markcut/video-preview-v3.html",
|
|
@@ -32,6 +32,7 @@ export const LEGACY_RESOURCE_URIS = [
|
|
|
32
32
|
"ui://markcut/video-preview-v21.html",
|
|
33
33
|
"ui://markcut/video-preview-v22.html",
|
|
34
34
|
"ui://markcut/video-preview-v23.html",
|
|
35
|
+
"ui://markcut/video-preview-v24.html",
|
|
35
36
|
];
|
|
36
37
|
export const RESOURCE_MIME_TYPE = "text/html;profile=mcp-app";
|
|
37
38
|
// Google Maps JS loads libraries, tiles and Routes RPCs from these HTTPS origins.
|
|
@@ -278,10 +279,13 @@ export function buildPreviewHtml() {
|
|
|
278
279
|
// from terminating the embedding script tag or leaking source into the DOM.
|
|
279
280
|
return `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
280
281
|
<title>Markcut</title>
|
|
281
|
-
<style>body{font:14px system-ui;margin:0;background:#fff;color:#17202a}main{padding:12px;max-width:960px;margin:auto}h1{font-size:17px}.path{font-size:12px;overflow-wrap:anywhere}.transport{display:flex;align-items:center;gap:10px;padding:12px 0}.transport input{flex:1;min-width:50px}button{cursor:pointer;padding:8px;border-radius:6px;border:1px solid #a8a8a8}#approve{background:#198038;color:white}#changes{background:#c72b29;color:white}textarea{width:100%;box-sizing:border-box;min-height:66px}.review-actions{display:flex;justify-content:space-between;align-items:center;width:100%;gap:16px}.review-actions button{min-width:150px}#remotion-canvas{background:#090b12}#status{padding:8px 0}#status:empty{display:none}#scene-thumbnails{display:flex;gap:7px;overflow-x:auto;padding:12px 2px;scrollbar-width:thin} .scene-pill{flex-shrink:0;padding:7px 11px;border:1px solid #d4dbe4;border-radius:9px;cursor:pointer;background:#f5f7fa;color:#475569;font-size:12px;white-space:nowrap} .scene-pill.active{background:#e7f0ff;color:#125ea2;border-color:#408bd7}</style></head>
|
|
282
|
-
<body><main><header style="display:flex;justify-content:space-between;align-items:center"><h1>Markcut · <span id="video-md-version">video</span></h1><div style="display:flex;align-items:center;gap:14px;margin-left:auto"><span id="header-tts"></span><span id="player-version" style="font-size:12px;color:#667">
|
|
283
|
-
<
|
|
284
|
-
<
|
|
282
|
+
<style>body{font:14px system-ui;margin:0;background:#fff;color:#17202a}main{padding:12px;max-width:960px;margin:auto}h1{font-size:17px}.path{font-size:12px;overflow-wrap:anywhere}.transport{display:flex;align-items:center;gap:10px;padding:12px 0}.transport input{flex:1;min-width:50px}button{cursor:pointer;padding:8px;border-radius:6px;border:1px solid #a8a8a8}#approve{background:#198038;color:white}#changes{background:#c72b29;color:white}textarea{width:100%;box-sizing:border-box;min-height:66px}.review-actions{display:flex;justify-content:space-between;align-items:center;width:100%;gap:16px}.review-actions button{min-width:150px}#remotion-canvas{background:#090b12}#status{padding:8px 0}#status:empty{display:none}#scene-thumbnails{display:flex;gap:7px;overflow-x:auto;padding:12px 2px;scrollbar-width:thin} .scene-pill{flex-shrink:0;padding:7px 11px;border:1px solid #d4dbe4;border-radius:9px;cursor:pointer;background:#f5f7fa;color:#475569;font-size:12px;white-space:nowrap} .scene-pill.active{background:#e7f0ff;color:#125ea2;border-color:#408bd7} .scene-pill.commented{border-color:#cc8b12;background:#fff4d6;color:#764900;font-weight:650} .scene-pill.commented::after{content:' •';color:#ad5b00} #comment-list{display:grid;gap:4px;margin:8px 0} #comment-list>div{display:flex;gap:8px} #comment-list button:first-child{flex:1;text-align:left;overflow:hidden;text-overflow:ellipsis} #comment-target,#comment-count{font-size:12px;color:#526071;margin:8px 0}</style></head>
|
|
283
|
+
<body><main><header style="display:flex;justify-content:space-between;align-items:center"><h1>Markcut · <span id="video-md-version">video</span></h1><div style="display:flex;align-items:center;gap:14px;margin-left:auto"><span id="header-tts"></span><span id="player-version" style="font-size:12px;color:#667">v25</span></div></header><div class="path" id="path-label" hidden></div><div id="interactive-ui" hidden><div id="remotion-root"></div>
|
|
284
|
+
<div id="comment-target" aria-live="polite">Current scene · general</div>
|
|
285
|
+
<textarea id="feedback" aria-label="Feedback" placeholder="Comment on this scene; navigate freely before submitting…"></textarea>
|
|
286
|
+
<div class="review-actions"><button id="save-spot" type="button">Add timed comment</button><span id="comment-count" aria-live="polite">0 comments</span></div>
|
|
287
|
+
<div id="comment-list" aria-label="Saved review comments"></div><div id="status" role="status">Starting preview…</div>
|
|
288
|
+
<div class="review-actions"><button id="changes">Submit all feedback</button><button id="approve">Approve</button></div></div></main>
|
|
285
289
|
<script src="${playerScriptUrl}"></script>
|
|
286
290
|
<script>${buildPreviewBridgeScript().replaceAll("__MARKCUT_ORIGIN__",JSON.stringify(publicOrigin()))}</script></body></html>`;
|
|
287
291
|
}
|