@lalalic/markcut 3.2.57 → 3.2.59
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/docs/developer-reference.md +18 -3
- package/package.json +1 -1
- package/src/mcp/bridge.mjs +15 -16
- package/src/mcp/compile-operation.mjs +2 -2
- package/src/mcp/compile-worker.mjs +3 -3
- package/src/mcp/mobile-review-cli.mjs +2 -5
- package/src/mcp/preview-mobile.css +44 -0
- package/src/mcp/preview.mjs +5 -3
- package/src/mcp/remotion-app.bundle.js +82 -82
- package/src/mcp/remotion-app.tsx +10 -3
- package/src/mcp/review-delivery.mjs +37 -51
- package/src/mcp/server.mjs +4 -6
- package/tests/mcp-preview-bridge.test.ts +11 -8
- package/tests/mcp-preview-delivery.test.ts +30 -29
- package/tests/mcp-preview.test.ts +15 -4
- package/tests/mobile-preview-cli.test.ts +3 -2
package/src/mcp/remotion-app.tsx
CHANGED
|
@@ -15,6 +15,13 @@ function App(){
|
|
|
15
15
|
const ref=React.useRef<PlayerRef|null>(null);
|
|
16
16
|
const [currentTime,setCurrentTime]=React.useState(0);
|
|
17
17
|
const [browserTts,setBrowserTts]=React.useState(true);
|
|
18
|
+
const [compact,setCompact]=React.useState(()=>window.matchMedia('(max-width: 640px), (max-height: 520px)').matches);
|
|
19
|
+
React.useEffect(()=>{
|
|
20
|
+
const query=window.matchMedia('(max-width: 640px), (max-height: 520px)');
|
|
21
|
+
const update=()=>setCompact(query.matches);
|
|
22
|
+
query.addEventListener('change',update);
|
|
23
|
+
return ()=>query.removeEventListener('change',update);
|
|
24
|
+
},[]);
|
|
18
25
|
const [commentedScenes,setCommentedScenes]=React.useState<string[]>([]);
|
|
19
26
|
const [spotMarkers,setSpotMarkers]=React.useState<Array<{id:number;scope:'overall'|'scene'|'spot';text:string;context:{timeSeconds:number;sceneName?:string};selected:boolean;placeholder?:boolean}>>([{id:0,scope:'overall',text:'',context:{timeSeconds:0},selected:true,placeholder:true}]);
|
|
20
27
|
const [seekBar,setSeekBar]=React.useState<HTMLElement|null>(null);
|
|
@@ -89,13 +96,13 @@ function App(){
|
|
|
89
96
|
if(!data)return <div>Missing compiled scene tree</div>;
|
|
90
97
|
const videoName=String(revision.title||revision.videoTitle||revision.path?.split('/').pop()?.replace(/\.md$/i,'').replace(/[-_]+/g,' ')||'Video');
|
|
91
98
|
return <div id="remotion-preview" data-revision={revision.revisionId}>
|
|
92
|
-
{document.getElementById("header-tts")&&createPortal(
|
|
99
|
+
{Boolean(data?.subtitle?.src)&&document.getElementById("header-tts")&&createPortal(
|
|
93
100
|
<label style={{display:"flex",gap:5,alignItems:"center",fontSize:12,whiteSpace:"nowrap",cursor:"pointer"}} title="Use browser narration with captions from the script">
|
|
94
101
|
<input type="checkbox" checked={useBrowserTts} disabled={!data?.subtitle?.src} onChange={e=>setBrowserTts(e.target.checked)}/>
|
|
95
102
|
Browser TTS
|
|
96
103
|
</label>,document.getElementById("header-tts")!)}
|
|
97
|
-
<div id="remotion-canvas" style={{position:'relative',width:'100%',aspectRatio:`${data.width||1080}/${data.height||1920}`,maxHeight:'65vh',margin:'auto'}}>
|
|
98
|
-
<SharedPlayer key={revision.revisionId} root={playbackRoot} playerRef={ref} numberOfSharedAudioTags={0} style={{width:'100%',height:'100%'}} />
|
|
104
|
+
<div id="remotion-canvas" style={{position:'relative',width:'100%',aspectRatio:`${data.width||1080}/${data.height||1920}`,maxHeight:'65vh',margin:'auto', '--markcut-player-ratio':String((data.width||1080)/(data.height||1920))} as React.CSSProperties}>
|
|
105
|
+
<SharedPlayer key={revision.revisionId} root={playbackRoot} playerRef={ref} numberOfSharedAudioTags={0} showPlaybackRateControl={!compact} style={{width:'100%',height:'100%'}} />
|
|
99
106
|
{useBrowserTts&&caption&&<div id="browser-tts-caption" aria-live="off" style={{position:'absolute',bottom:50,left:12,right:12,zIndex:5,pointerEvents:'none',textAlign:'center'}}>
|
|
100
107
|
<span style={{display:'inline-block',maxWidth:'90%',padding:'5px 10px',borderRadius:5,background:'rgba(0,0,0,.72)',color:'#fff',fontSize:'clamp(12px,1.6vw,18px)',lineHeight:1.4,textShadow:'0 1px 2px #000',overflowWrap:'anywhere'}}>{caption}</span>
|
|
101
108
|
</div>}
|
|
@@ -1,65 +1,51 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Generic event transport. The caller owns the event type, source and business data.
|
|
2
2
|
const ID = /^[A-Za-z0-9_-]{1,128}$/;
|
|
3
|
-
const
|
|
4
|
-
const RECORD = value => value && typeof value ===
|
|
5
|
-
const
|
|
6
|
-
const
|
|
3
|
+
const KEY = /^[A-Za-z_][A-Za-z0-9_-]{0,63}$/;
|
|
4
|
+
const RECORD = value => value && typeof value === 'object' && !Array.isArray(value);
|
|
5
|
+
const FORBIDDEN = new Set(['__proto__','constructor','prototype']);
|
|
6
|
+
const RESULT_FIELDS = ['previewId','requestId','decision','feedback','comments','idempotencyKey'];
|
|
7
7
|
function copyData(value) {
|
|
8
|
-
if (!RECORD(value)) throw new Error(
|
|
9
|
-
// No executable values or reserved overrides can be shipped in a template.
|
|
8
|
+
if (!RECORD(value)) throw new Error('eventTemplate.data must be an object');
|
|
10
9
|
const encoded=JSON.stringify(value);
|
|
11
|
-
if (!encoded || encoded.length
|
|
10
|
+
if (!encoded || encoded.length>12000) throw new Error('Invalid eventTemplate.data');
|
|
12
11
|
const clean=JSON.parse(encoded);
|
|
13
|
-
const walk=
|
|
14
|
-
if
|
|
15
|
-
for
|
|
16
|
-
if
|
|
12
|
+
const walk=node=>{
|
|
13
|
+
if(!node || typeof node!=='object')return;
|
|
14
|
+
for(const [key,val] of Object.entries(node)){
|
|
15
|
+
if(FORBIDDEN.has(key))throw new Error('Unsafe eventTemplate data');
|
|
17
16
|
walk(val);
|
|
18
17
|
}
|
|
19
18
|
};
|
|
20
|
-
walk(clean);
|
|
21
|
-
return clean;
|
|
19
|
+
walk(clean);return clean;
|
|
22
20
|
}
|
|
23
|
-
export function normalizeReviewConfig(value)
|
|
24
|
-
if
|
|
25
|
-
if
|
|
26
|
-
if
|
|
27
|
-
if
|
|
28
|
-
return {delivery:
|
|
21
|
+
export function normalizeReviewConfig(value){
|
|
22
|
+
if(value===undefined)return {delivery:'text'};
|
|
23
|
+
if(!RECORD(value)||!['text','event'].includes(value.delivery??'text'))throw Error('Unsupported review delivery');
|
|
24
|
+
if(value.delivery!=='event'){
|
|
25
|
+
if(value.eventTemplate!==undefined)throw Error('eventTemplate requires event delivery');
|
|
26
|
+
return {delivery:'text'};
|
|
29
27
|
}
|
|
30
28
|
const template=value.eventTemplate;
|
|
31
|
-
if
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
if(!RECORD(template) || typeof template.type!=='string' || !/^[A-Za-z0-9_.:-]{1,128}$/.test(template.type) ||
|
|
30
|
+
typeof template.source!=='string' || !template.source || template.source.length>512 || /[\r\n\x00-\x1f]/.test(template.source) ||
|
|
31
|
+
!RECORD(template.data) || Object.keys(template).some(k=>!['type','source','data','responseKey'].includes(k)))
|
|
32
|
+
throw Error('Invalid event template envelope');
|
|
33
|
+
const responseKey=template.responseKey??'review';
|
|
34
|
+
if(typeof responseKey!=='string'||!KEY.test(responseKey)||FORBIDDEN.has(responseKey))throw Error('Invalid responseKey');
|
|
35
35
|
const data=copyData(template.data);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
interactive.taskId!==match[2] || interactive.executionId!==match[3] ||
|
|
40
|
-
REVIEW_FIELDS.some(field=>Object.hasOwn(interactive,field)))
|
|
41
|
-
throw new Error("Invalid task.interactive_decision event template");
|
|
42
|
-
if (value.commitSha !== undefined) throw new Error('Git SHA is not a Review field');
|
|
43
|
-
return {delivery:"event",eventTemplate:{
|
|
44
|
-
type:template.type,source:template.source,data,
|
|
45
|
-
}};
|
|
36
|
+
if(data[responseKey]!==undefined && (!RECORD(data[responseKey])||RESULT_FIELDS.some(k=>Object.hasOwn(data[responseKey],k))))
|
|
37
|
+
throw Error('Event response payload must be caller-owned metadata only');
|
|
38
|
+
return {delivery:'event',eventTemplate:{type:template.type,source:template.source,data,responseKey}};
|
|
46
39
|
}
|
|
47
|
-
export function eventForReview(config,review)
|
|
40
|
+
export function eventForReview(config,review){
|
|
48
41
|
const {eventTemplate:template}=normalizeReviewConfig(config);
|
|
49
|
-
if
|
|
50
|
-
if
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return {type:INTERACTIVE_TYPE,source:template.source,data:{
|
|
59
|
-
...template.data,
|
|
60
|
-
interactive:{...details,
|
|
61
|
-
previewId:review.previewId,requestId:review.requestId,
|
|
62
|
-
decision:review.decision,feedback,comments:structuredClone(review.comments),
|
|
63
|
-
idempotencyKey:review.idempotencyKey},
|
|
64
|
-
}};
|
|
42
|
+
if(!template)throw Error('Event mode required');
|
|
43
|
+
if(!RECORD(review)||!ID.test(review.requestId||'')||!ID.test(review.idempotencyKey||'')||
|
|
44
|
+
!['approved','changes_requested'].includes(review.decision)||!Array.isArray(review.comments))throw Error('Invalid review result');
|
|
45
|
+
const feedback=typeof review.feedback==='string'?review.feedback:
|
|
46
|
+
review.comments.map(c=>c.text).filter(x=>typeof x==='string').join('\n');
|
|
47
|
+
const key=template.responseKey;
|
|
48
|
+
return {type:template.type,source:template.source,data:{...template.data,
|
|
49
|
+
[key]:{...(template.data[key]||{}),previewId:review.previewId,requestId:review.requestId,
|
|
50
|
+
decision:review.decision,feedback,comments:structuredClone(review.comments),idempotencyKey:review.idempotencyKey}}};
|
|
65
51
|
}
|
package/src/mcp/server.mjs
CHANGED
|
@@ -47,12 +47,11 @@ registerAppTool(
|
|
|
47
47
|
server,
|
|
48
48
|
TOOL_NAME,
|
|
49
49
|
{
|
|
50
|
-
description: "Compile and publish an immutable Markcut preview revision for this ChatGPT conversation. Review delivery defaults to ui/message, or submits an authorized caller-bound event when explicitly configured. Event-mode decisions
|
|
50
|
+
description: "Compile and publish an immutable Markcut preview revision for this ChatGPT conversation. Review delivery defaults to ui/message, or submits an authorized caller-bound event when explicitly configured. Event-mode decisions use the caller-provided event envelope; Markcut does not interpret the event type or payload.",
|
|
51
51
|
inputSchema: z.object({
|
|
52
52
|
path: z.string().describe("Absolute .md path or NeoY HTTPS mounted file URL; Neo Wrapper also accepts single local image/audio/video files"),
|
|
53
53
|
readonly: z.boolean().optional().describe("View-only preview: no review controls, Relay binding, Git checkpoint, or mobile review notification."),
|
|
54
|
-
review: z.object({delivery:z.enum(["text","event"]).optional(),eventTemplate:z.object({type:z.string(),source:z.string(),data:z.record(z.string(),z.unknown())}).optional(),
|
|
55
|
-
relay:z.object({jobId:z.string(),taskId:z.union([z.string(),z.number()]),executionId:z.string().optional()}).optional().describe("Optional managed review correlation; no Relay needed for standalone review."),
|
|
54
|
+
review: z.object({delivery:z.enum(["text","event"]).optional(),eventTemplate:z.object({type:z.string(),source:z.string(),data:z.record(z.string(),z.unknown()),responseKey:z.string().optional()}).optional(),
|
|
56
55
|
}).optional(),
|
|
57
56
|
}),
|
|
58
57
|
_meta: {
|
|
@@ -60,13 +59,12 @@ registerAppTool(
|
|
|
60
59
|
},
|
|
61
60
|
},
|
|
62
61
|
async ({ path, review, readonly }) => {
|
|
63
|
-
const relay=review?.relay;
|
|
64
62
|
try {
|
|
65
63
|
if (readonly && review !== undefined)
|
|
66
64
|
throw new Error("Read-only preview cannot request Relay or review delivery");
|
|
67
65
|
const config={...normalizeReviewConfig(review),...(readonly ? {readonly:true} : {})};
|
|
68
|
-
const operation=startCompileOperation(path,
|
|
69
|
-
const payload=
|
|
66
|
+
const operation=startCompileOperation(path,config);
|
|
67
|
+
const payload=operation;
|
|
70
68
|
return {
|
|
71
69
|
content: [{ type: "text", text: `Compilation started: ${operation.path}` }],
|
|
72
70
|
structuredContent: payload,
|
|
@@ -164,13 +164,13 @@ describe('MCP Remotion bridge',()=>{
|
|
|
164
164
|
second.nodes.approve.onclick?.();
|
|
165
165
|
expect(second.messages.filter(m=>m.method==='tools/call')).toHaveLength(0);
|
|
166
166
|
});
|
|
167
|
-
it('
|
|
167
|
+
it('does not interpret or expose caller-owned Relay context in a text review',async()=>{
|
|
168
168
|
const h=harness();
|
|
169
169
|
const relay={jobId:'job-7',taskId:19,executionId:'exec-1'};
|
|
170
170
|
h.result({id:'r',revisionId:'r',contentHash:'hash',path:'/video.md',relay,compiled:{children:[]}});
|
|
171
171
|
h.nodes.feedback.value='shorter title';h.nodes['save-spot'].onclick?.();h.nodes.changes.onclick?.();
|
|
172
172
|
await nextTick();
|
|
173
|
-
expect(JSON.parse(h.messages.find(m=>m.method==='ui/message').params.content[0].text).relay).
|
|
173
|
+
expect(JSON.parse(h.messages.find(m=>m.method==='ui/message').params.content[0].text).relay).toBeUndefined();
|
|
174
174
|
});
|
|
175
175
|
it('handles request changes followed by a new revision and approval in the same app',async()=>{
|
|
176
176
|
const h=harness();h.respond(1);await nextTick();
|
|
@@ -392,7 +392,7 @@ describe('async compilation UI transition',()=>{
|
|
|
392
392
|
|
|
393
393
|
describe('Review event delivery',()=>{
|
|
394
394
|
const template={type:'task.interactive_decision',
|
|
395
|
-
source:'job/551/task/producer/execution/e1',data:{interactive:{jobId:'551',taskId:'producer',executionId:'e1'},purpose:'video'}};
|
|
395
|
+
source:'job/551/task/producer/execution/e1',responseKey:'interactive',data:{interactive:{jobId:'551',taskId:'producer',executionId:'e1'},purpose:'video'}};
|
|
396
396
|
const media={id:'video1',requestId:'d9b2006a-0618-45aa-a3d8-31363fa629ca',revisionId:'rv1',
|
|
397
397
|
contentHash:'a'.repeat(64),path:'/tmp/video.md',compiled:{children:[]},review:{delivery:'event',eventTemplate:template}};
|
|
398
398
|
it('does not publish until explicit Submit, preserves fixed envelope and scoped comments',async()=>{
|
|
@@ -411,13 +411,16 @@ describe('Review event delivery',()=>{
|
|
|
411
411
|
expect(h.messages.filter(m=>m.method==='ui/message')).toHaveLength(0);
|
|
412
412
|
expect(h.nodes.status.textContent).toContain('submitted');
|
|
413
413
|
});
|
|
414
|
-
it('
|
|
415
|
-
const
|
|
414
|
+
it('publishes arbitrary caller event types without interpreting semantics',async()=>{
|
|
415
|
+
const arbitrary={...template,type:'markcut.review.submitted',source:'custom/feedback/events'};
|
|
416
416
|
const h=harness(undefined,undefined,m=>m.method==='tools/call'?{published:true}:undefined);
|
|
417
|
-
h.result({...media,review:{delivery:'event',eventTemplate:
|
|
417
|
+
h.result({...media,review:{delivery:'event',eventTemplate:arbitrary}});
|
|
418
418
|
h.nodes.approve.onclick?.();await nextTick();
|
|
419
|
-
expect(h.nodes.status.textContent).toContain('
|
|
420
|
-
|
|
419
|
+
expect(h.nodes.status.textContent).toContain('submitted');
|
|
420
|
+
const calls=h.messages.filter(m=>m.method==='tools/call');
|
|
421
|
+
expect(calls).toHaveLength(1);
|
|
422
|
+
expect(calls[0].params.arguments.args.type).toBe('markcut.review.submitted');
|
|
423
|
+
expect(calls[0].params.arguments.args.source).toBe('custom/feedback/events');
|
|
421
424
|
});
|
|
422
425
|
it('fails visibly without host Events access and reuses the idempotency key on retry',async()=>{
|
|
423
426
|
const h=harness(undefined,undefined,m=>m.method==='tools/call'?{rpcError:{message:'Host denies cross-server tool'}}:undefined);
|
|
@@ -1,42 +1,43 @@
|
|
|
1
1
|
import {describe,it,expect} from 'vitest';
|
|
2
2
|
import {normalizeReviewConfig,eventForReview} from '../src/mcp/review-delivery.mjs';
|
|
3
3
|
|
|
4
|
-
const template={type:'
|
|
5
|
-
data:{
|
|
6
|
-
const review={requestId:'r1',previewId:'p1',
|
|
7
|
-
|
|
4
|
+
const template={type:'other.product.feedback',source:'app/custom-destination',responseKey:'response',
|
|
5
|
+
data:{response:{opaque:'from caller'},meta:{source:'ok'}}};
|
|
6
|
+
const review={requestId:'r1',previewId:'p1',decision:'changes_requested',
|
|
7
|
+
comments:[{sceneId:'intro',timeSeconds:3.2,text:'Shorter intro'}],idempotencyKey:'key1'};
|
|
8
8
|
|
|
9
|
-
describe('
|
|
10
|
-
it('defaults to text
|
|
9
|
+
describe('Generic Preview event transport',()=>{
|
|
10
|
+
it('defaults to text; event delivery requires a caller envelope',()=>{
|
|
11
11
|
expect(normalizeReviewConfig(undefined)).toEqual({delivery:'text'});
|
|
12
12
|
expect(normalizeReviewConfig({delivery:'text'})).toEqual({delivery:'text'});
|
|
13
13
|
expect(()=>normalizeReviewConfig({delivery:'callback'})).toThrow();
|
|
14
14
|
expect(()=>normalizeReviewConfig({delivery:'event'})).toThrow();
|
|
15
15
|
});
|
|
16
|
-
it('
|
|
17
|
-
expect(()=>normalizeReviewConfig({delivery:'event',eventTemplate:{...template,type:'markcut.review.submitted'}})).toThrow();
|
|
18
|
-
expect(()=>normalizeReviewConfig({delivery:'event',eventTemplate:{...template,type:'task.completed'}})).toThrow();
|
|
19
|
-
expect(()=>normalizeReviewConfig({delivery:'event',eventTemplate:{...template,source:'job/a/task/b/execution/e/forged'}})).toThrow();
|
|
20
|
-
expect(()=>normalizeReviewConfig({delivery:'event',eventTemplate:{...template,
|
|
21
|
-
data:{interactive:{...template.data.interactive,decision:'approved'}}}})).toThrow();
|
|
22
|
-
expect(()=>normalizeReviewConfig({delivery:'event',eventTemplate:{...template,
|
|
23
|
-
data:{interactive:{...template.data.interactive,taskId:'forged'}}}})).toThrow();
|
|
24
|
-
expect(()=>normalizeReviewConfig({delivery:'event',eventTemplate:{...template,
|
|
25
|
-
data:{interactive:{...template.data.interactive,revision:'bad'}}}})).toThrow();
|
|
26
|
-
});
|
|
27
|
-
it('freezes caller-owned identity and fills only data.interactive fields on human submit',()=>{
|
|
16
|
+
it('accepts arbitrary caller event type, source and response key without reading business identity',()=>{
|
|
28
17
|
const config=normalizeReviewConfig({delivery:'event',eventTemplate:template});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
decision:'changes_requested',feedback:'Shorter intro',comments:review.comments,
|
|
34
|
-
idempotencyKey:'key1'}}});
|
|
35
|
-
expect(template.data.interactive).not.toHaveProperty('decision');
|
|
18
|
+
const ev=eventForReview(config,review);
|
|
19
|
+
expect(ev).toMatchObject({type:'other.product.feedback',source:'app/custom-destination',
|
|
20
|
+
data:{meta:{source:'ok'},response:{opaque:'from caller',decision:'changes_requested',
|
|
21
|
+
feedback:'Shorter intro',comments:review.comments,requestId:'r1',idempotencyKey:'key1'}}});
|
|
36
22
|
});
|
|
37
|
-
it('
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
23
|
+
it('freezes caller metadata and does not let decisions rewrite it',()=>{
|
|
24
|
+
const input={...template,data:{response:{opaque:'from caller'},meta:{source:'ok'}}};
|
|
25
|
+
const config=normalizeReviewConfig({delivery:'event',eventTemplate:input});
|
|
26
|
+
input.data.meta.source='changed after binding';
|
|
27
|
+
const ev=eventForReview(config,review);
|
|
28
|
+
expect(ev.data.meta.source).toBe('ok');
|
|
29
|
+
expect(ev.data.response.opaque).toBe('from caller');
|
|
30
|
+
});
|
|
31
|
+
it('rejects invalid transport structure and unsafe property overrides',()=>{
|
|
32
|
+
expect(()=>normalizeReviewConfig({delivery:'event',eventTemplate:{...template,source:'a\nb'}})).toThrow();
|
|
33
|
+
expect(()=>normalizeReviewConfig({delivery:'event',eventTemplate:{...template,responseKey:'__proto__'}})).toThrow();
|
|
34
|
+
expect(()=>normalizeReviewConfig({delivery:'event',eventTemplate:{...template,data:{response:{decision:'prefilled'}}}})).toThrow();
|
|
35
|
+
expect(()=>normalizeReviewConfig({delivery:'event',eventTemplate:{...template,data:JSON.parse('{"__proto__":{}}')}})).toThrow();
|
|
36
|
+
expect(()=>eventForReview({delivery:'event',eventTemplate:template},{...review,decision:'invalid'})).toThrow();
|
|
37
|
+
});
|
|
38
|
+
it('default response key is review for any event',()=>{
|
|
39
|
+
const t={type:'work.done',source:'workspace/123',data:{context:{id:123}}};
|
|
40
|
+
expect(eventForReview({delivery:'event',eventTemplate:t},review)).toMatchObject({
|
|
41
|
+
type:t.type,source:t.source,data:{context:{id:123},review:{decision:'changes_requested'}}});
|
|
41
42
|
});
|
|
42
43
|
});
|
|
@@ -28,12 +28,23 @@ describe('Markcut Remotion MCP App',()=>{
|
|
|
28
28
|
expect(html).toContain('https://neoy.example.test/files/_neoy/markcut/player/');
|
|
29
29
|
expect(html).not.toContain('id="remotion-bundle"');
|
|
30
30
|
// The generic event contract requires client-side identity and reserved-field validation.
|
|
31
|
-
expect(html.length).toBeLessThan(
|
|
31
|
+
expect(html.length).toBeLessThan(30000);
|
|
32
32
|
expect(html).not.toContain('<video id="video-player"');
|
|
33
33
|
expect(html).not.toContain('data:video/mp4');
|
|
34
34
|
expect(html).not.toContain('127.0.0.1');
|
|
35
35
|
expect(html).not.toContain('src="/player.js"');
|
|
36
36
|
});
|
|
37
|
+
it('fits the phone player by BOTH width and height, with scenes above canvas and actions in normal flow',()=>{
|
|
38
|
+
const html=buildPreviewHtml();
|
|
39
|
+
expect(html).toContain('@media (max-width: 640px), (max-height: 520px)');
|
|
40
|
+
expect(html).toContain('var(--markcut-player-ratio, 0.5625)');
|
|
41
|
+
expect(html).toContain('#scene-thumbnails { order: -1;');
|
|
42
|
+
expect(html).toContain("grid-template-areas: 'changes approve' 'status status'");
|
|
43
|
+
expect(html).not.toMatch(/#remotion-canvas\s*\{[^}]*position\s*:\s*absolute/);
|
|
44
|
+
const app=readFileSync(new URL('../src/mcp/remotion-app.tsx',import.meta.url),'utf8');
|
|
45
|
+
expect(app).toContain('showPlaybackRateControl={!compact}');
|
|
46
|
+
expect(app).toContain('Boolean(data?.subtitle?.src)&&document.getElementById');
|
|
47
|
+
});
|
|
37
48
|
it('omits the developer BGM decode-status row while preserving Web Audio playback',()=>{
|
|
38
49
|
const renderer=readFileSync(new URL('../src/mcp/remotion-app.tsx',import.meta.url),'utf8');
|
|
39
50
|
const audio=readFileSync(new URL('../src/mcp/web-audio-preview.ts',import.meta.url),'utf8');
|
|
@@ -41,9 +52,9 @@ describe('Markcut Remotion MCP App',()=>{
|
|
|
41
52
|
expect(audio).toContain('ctx.decodeAudioData(bytes)');
|
|
42
53
|
expect(audio).toContain("p.addEventListener('play',play)");
|
|
43
54
|
});
|
|
44
|
-
it('publishes
|
|
45
|
-
expect(RESOURCE_URI).toBe('ui://markcut/video-preview-
|
|
46
|
-
expect(LEGACY_RESOURCE_URIS).toContain('ui://markcut/video-preview-
|
|
55
|
+
it('publishes v47 while retaining v46 as a compatible alias',()=>{
|
|
56
|
+
expect(RESOURCE_URI).toBe('ui://markcut/video-preview-v47.html');
|
|
57
|
+
expect(LEGACY_RESOURCE_URIS).toContain('ui://markcut/video-preview-v46.html');
|
|
47
58
|
});
|
|
48
59
|
it('registers latest resource at startup and aliases previous URIs',()=>{
|
|
49
60
|
for(const uri of [RESOURCE_URI,...LEGACY_RESOURCE_URIS]){
|
|
@@ -22,11 +22,12 @@ describe('Neo-owned REST notification from standalone CLI',()=>{
|
|
|
22
22
|
expect(request).toMatchObject({id,contentHash:hash,revisionId:'revision-123',
|
|
23
23
|
previewId:'preview-123',title:'preview',delivery:'text',groupId:'/tmp/preview.md'});
|
|
24
24
|
});
|
|
25
|
-
it('
|
|
25
|
+
it('passes an opaque event template without interpreting the caller identity',()=>{
|
|
26
26
|
const template={type:'task.interactive_decision',source:'job/12/task/prod/execution/ex1',
|
|
27
27
|
data:{interactive:{jobId:'12',taskId:'prod',executionId:'ex1'}}};
|
|
28
28
|
const request=buildReviewRequest(eventOptions,{delivery:'event',eventTemplate:template},state,id);
|
|
29
|
-
expect(request).toMatchObject({id,mediaHash:hash,eventTemplate:template,
|
|
29
|
+
expect(request).toMatchObject({id,mediaHash:hash,eventTemplate:template,groupId:'/tmp/preview.md'});
|
|
30
|
+
expect(request).not.toHaveProperty('jobId');
|
|
30
31
|
expect(request).not.toHaveProperty('revisionId');expect(request).not.toHaveProperty('contentHash');
|
|
31
32
|
});
|
|
32
33
|
it('POSTs to local Neo Core REST and requires persisted matching ACK',async()=>{
|