@lalalic/markcut 3.2.59 → 3.2.61
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/README.md +20 -4
- package/bin/markcut +10 -0
- package/docs/developer-reference.md +41 -1
- package/package.json +8 -2
- package/recipes/markcut/map-cinematic-follow.json +17 -0
- package/recipes/markcut/map-location-reveal.json +17 -0
- package/recipes/markcut/map-route-journey.json +18 -0
- package/recipes/markcut/map-streetview-explore.json +17 -0
- package/skills/markcut/SKILL.md +5 -1
- package/skills/markcut/docs/markdown-descriptive.md +68 -1
- package/skills/markcut/docs/recipes.md +45 -0
- package/skills/markcut/references/mobile-event-preview-cli.md +9 -5
- package/src/descriptive/compiler.ts +38 -2
- package/src/descriptive/markdown.ts +30 -0
- package/src/descriptive/model3d.test.ts +38 -0
- package/src/editor-decision/cli.mjs +21 -0
- package/src/editor-decision/editor-decision.schema.json +41 -0
- package/src/editor-decision/index.mjs +115 -0
- package/src/editor-decision/index.test.mjs +63 -0
- package/src/mcp/bridge.mjs +46 -9
- package/src/mcp/compile-worker.mjs +2 -2
- package/src/mcp/mobile-review-cli.mjs +40 -33
- package/src/mcp/preview-mobile.css +23 -10
- package/src/mcp/preview.mjs +95 -56
- package/src/mcp/remote-assets.mjs +85 -7
- package/src/mcp/remotion-app.bundle.js +5013 -1117
- package/src/mcp/remotion-app.tsx +117 -10
- package/src/mcp/server.mjs +4 -2
- package/src/player/browser.tsx +1 -3
- package/src/player/bundle/player.js +73054 -17357
- package/src/player/components/HeaderBar.tsx +3 -1
- package/src/player/components/VariantBar.tsx +20 -21
- package/src/player/pipeline.mjs +133 -77
- package/src/player/server.mjs +43 -23
- package/src/recipes/catalog.mjs +115 -0
- package/src/recipes/cli.mjs +87 -0
- package/src/render/cli.mjs +38 -1
- package/src/schema/index.ts +21 -0
- package/src/types/Folder.tsx +2 -0
- package/src/types/Model3D.tsx +91 -0
- package/src/vision/cli.mjs +63 -50
- package/tests/mcp-editor-decisions-mobile.test.ts +35 -0
- package/tests/mcp-preview-bridge.test.ts +44 -3
- package/tests/mcp-preview-proxy-version.test.mjs +80 -0
- package/tests/mcp-preview.test.ts +43 -10
- package/tests/mcp-remote-assets.test.ts +17 -0
- package/tests/mcp-static-preview.test.ts +1 -1
- package/tests/mcp-video-selector.test.ts +55 -0
- package/tests/mobile-preview-cli.test.ts +10 -15
- package/tests/recipes-catalog.test.ts +141 -0
- package/tests/vision-generic-vtt-hooks.test.ts +7 -7
- package/tests/vision-normalized-metadata.test.ts +23 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {describe,it,expect} from 'vitest';
|
|
2
|
-
import {parseEventPreviewOptions,
|
|
2
|
+
import {parseEventPreviewOptions,neoReviewWrapper,buildReviewRequest,submitNeoReview} from '../src/mcp/mobile-review-cli.mjs';
|
|
3
3
|
|
|
4
4
|
describe('Standalone Markcut CLI preview (notification belongs to Neo)',()=>{
|
|
5
5
|
it('accepts externally supplied event templates without a phone or APNs URL',()=>{
|
|
@@ -11,7 +11,7 @@ describe('Standalone Markcut CLI preview (notification belongs to Neo)',()=>{
|
|
|
11
11
|
});
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
describe('Neo-owned
|
|
14
|
+
describe('Neo-owned wrapper delivery from standalone CLI',()=>{
|
|
15
15
|
const id='82ba2e6c-6432-4ecd-83ee-cb78ba87c668';
|
|
16
16
|
const hash='f'.repeat(64);
|
|
17
17
|
const options={file:'/tmp/preview.md'};
|
|
@@ -30,22 +30,17 @@ describe('Neo-owned REST notification from standalone CLI',()=>{
|
|
|
30
30
|
expect(request).not.toHaveProperty('jobId');
|
|
31
31
|
expect(request).not.toHaveProperty('revisionId');expect(request).not.toHaveProperty('contentHash');
|
|
32
32
|
});
|
|
33
|
-
it('
|
|
33
|
+
it('delegates the complete immutable request to the Neo-owned wrapper',async()=>{
|
|
34
34
|
const request=buildReviewRequest(options,{delivery:'text'},state,id);
|
|
35
35
|
const seen:any[]=[];
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
};
|
|
39
|
-
const receipt=await submitNeoReview(request,{url:'http://127.0.0.1:6767/mobile/review/notify',fetchImpl} as any);
|
|
36
|
+
const receipt=await submitNeoReview(request,{deliver:async (value:any)=>{
|
|
37
|
+
seen.push(value);return {stored:true,requestId:id,accepted:false};
|
|
38
|
+
}} as any);
|
|
40
39
|
expect(receipt.stored).toBe(true);
|
|
41
|
-
expect(seen
|
|
42
|
-
expect(
|
|
43
|
-
expect(seen[0].init.headers['Content-Type']).toBe('application/json');
|
|
44
|
-
await expect(submitNeoReview(request,{url:'http://127.0.0.1:6767/mobile/review/notify',fetchImpl:async()=>({ok:true,json:async()=>({stored:false,requestId:id})})} as any)).rejects.toThrow('acknowledge');
|
|
45
|
-
await expect(submitNeoReview(request,{url:'http://127.0.0.1:6767/mobile/review/notify',fetchImpl:async()=>({ok:false,status:403})} as any)).rejects.toThrow('403');
|
|
40
|
+
expect(seen).toEqual([request]);
|
|
41
|
+
await expect(submitNeoReview(request,{deliver:async()=>({stored:false,requestId:id})} as any)).rejects.toThrow('acknowledge');
|
|
46
42
|
});
|
|
47
|
-
it('
|
|
48
|
-
expect(()=>
|
|
49
|
-
await expect(submitNeoReview({id} as any,{url:'http://127.0.0.1:6767/mcp'})).rejects.toThrow('nonlocal');
|
|
43
|
+
it('requires a real Neo wrapper, never a direct review notification URL',()=>{
|
|
44
|
+
expect(()=>neoReviewWrapper('/does/not/exist')).toThrow('unavailable');
|
|
50
45
|
});
|
|
51
46
|
});
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import {describe,it,expect} from 'vitest';
|
|
2
|
+
import {loadRecipeCatalog,findShotcraftSkillRoot,filterRecipes,getRecipe,readRecipeDetail} from '../src/recipes/catalog.mjs';
|
|
3
|
+
import {parseMarkdownDescriptive} from '../src/descriptive/markdown';
|
|
4
|
+
import {compileDescriptiveRoot} from '../src/descriptive/compiler';
|
|
5
|
+
import {mkdtemp,mkdir,writeFile,rm,symlink} from 'node:fs/promises';
|
|
6
|
+
import {tmpdir} from 'node:os';
|
|
7
|
+
import {join,resolve} from 'node:path';
|
|
8
|
+
import {fileURLToPath} from 'node:url';
|
|
9
|
+
import {spawnSync} from 'node:child_process';
|
|
10
|
+
|
|
11
|
+
const native=()=>loadRecipeCatalog({shotcraftRoot:null});
|
|
12
|
+
const cli=fileURLToPath(new URL('../bin/markcut',import.meta.url));
|
|
13
|
+
|
|
14
|
+
describe('Markcut-owned recipe catalog',()=>{
|
|
15
|
+
it('has four independently addressable native Google map recipes',()=>{
|
|
16
|
+
const recipes=native().recipes;
|
|
17
|
+
expect(recipes.map(r=>r.id)).toEqual([
|
|
18
|
+
'markcut:map-cinematic-follow','markcut:map-location-reveal',
|
|
19
|
+
'markcut:map-route-journey','markcut:map-streetview-explore'
|
|
20
|
+
]);
|
|
21
|
+
expect(recipes.map(r=>r.view).sort()).toEqual(['cinematic','overview','route','streetview']);
|
|
22
|
+
expect(recipes.every(r=>r.executable&&r.source==='markcut'&&r.implementation==='native-markcut')).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
it('compiles every native recipe snippet into the requested map view',()=>{
|
|
25
|
+
for(const recipe of native().recipes){
|
|
26
|
+
const doc=`# video\nwidth:540 height:960 fps:24\n\n${recipe.snippet}`;
|
|
27
|
+
const root=compileDescriptiveRoot(parseMarkdownDescriptive(doc));
|
|
28
|
+
const node=root.children[0]?.children?.[0] as any;
|
|
29
|
+
expect(node?.type,recipe.id).toBe('map');
|
|
30
|
+
expect(node?.view,recipe.id).toBe(recipe.view);
|
|
31
|
+
expect(node?.durationInSeconds,recipe.id).toBe(recipe.durationSeconds);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
it('supports future non-map Markcut recipes without requiring a map view',async()=>{
|
|
35
|
+
const dir=await mkdtemp(join(tmpdir(),'markcut-other-recipe-'));
|
|
36
|
+
try{
|
|
37
|
+
const card={name:'chapter-title-reveal',title:'Chapter title',category:'typography',description:'A title',parameters:[],durationSeconds:2,snippet:'## Title\nlayout:parallel\n- component jsx:<div>Title</div> duration:2'};
|
|
38
|
+
await writeFile(join(dir,'chapter-title-reveal.json'),JSON.stringify(card));
|
|
39
|
+
const catalog=loadRecipeCatalog({markcutDir:dir,shotcraftRoot:null});
|
|
40
|
+
expect(catalog.recipes[0]).toMatchObject({id:'markcut:chapter-title-reveal',category:'typography',executable:true});
|
|
41
|
+
}finally{await rm(dir,{recursive:true,force:true});}
|
|
42
|
+
});
|
|
43
|
+
it('keeps source namespace even if external Shotcraft card shares a bare name',async()=>{
|
|
44
|
+
const dir=await mkdtemp(join(tmpdir(),'shotcraft-card-collision-'));
|
|
45
|
+
try{
|
|
46
|
+
await mkdir(join(dir,'gallery/api'),{recursive:true});
|
|
47
|
+
await writeFile(join(dir,'gallery/api/library.json'),JSON.stringify({cards:[{name:'map-route-journey',summary:'Other implementation',source:'references/shots/map-route-journey.md',styles:[]}]}));
|
|
48
|
+
const catalog=loadRecipeCatalog({shotcraftRoot:dir});
|
|
49
|
+
expect(catalog.recipes.filter(x=>x.name==='map-route-journey')).toHaveLength(2);
|
|
50
|
+
expect(getRecipe(catalog,'markcut:map-route-journey')?.source).toBe('markcut');
|
|
51
|
+
expect(getRecipe(catalog,'shotcraft:map-route-journey')?.source).toBe('shotcraft');
|
|
52
|
+
expect(()=>getRecipe(catalog,'map-route-journey')).toThrow(/Ambiguous/);
|
|
53
|
+
}finally{await rm(dir,{recursive:true,force:true});}
|
|
54
|
+
});
|
|
55
|
+
it('runs offline with external Shotcraft skill missing',()=>{
|
|
56
|
+
const catalog=loadRecipeCatalog({shotcraftRoot:null});
|
|
57
|
+
expect(catalog.sources.shotcraft).toMatchObject({count:0,status:'not-installed'});
|
|
58
|
+
expect(filterRecipes(catalog,{source:'shotcraft'})).toHaveLength(0);
|
|
59
|
+
expect(filterRecipes(catalog,{category:'map'})).toHaveLength(4);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
describe('installed Shotcraft skill integration',()=>{
|
|
64
|
+
it('discovers the Skill based on home or an explicit environment override',async()=>{
|
|
65
|
+
const home=await mkdtemp(join(tmpdir(),'shotcraft-home-'));
|
|
66
|
+
const skill=join(home,'.agents/skills/video-shotcraft');
|
|
67
|
+
try {
|
|
68
|
+
await mkdir(join(skill,'gallery/api'),{recursive:true});
|
|
69
|
+
await writeFile(join(skill,'gallery/api/library.json'),'{"cards":[]}');
|
|
70
|
+
expect(findShotcraftSkillRoot({home,env:{}})).toBe(skill);
|
|
71
|
+
expect(findShotcraftSkillRoot({home,env:{MARKCUT_SHOTCRAFT_SKILL_DIR:join(home,'missing')}})).toBeNull();
|
|
72
|
+
}finally{await rm(home,{recursive:true,force:true});}
|
|
73
|
+
});
|
|
74
|
+
it('reads external source cards and variants live, does not copy source or execute them',async()=>{
|
|
75
|
+
const dir=await mkdtemp(join(tmpdir(),'shotcraft-live-'));
|
|
76
|
+
try{
|
|
77
|
+
await mkdir(join(dir,'gallery/api'),{recursive:true});
|
|
78
|
+
await mkdir(join(dir,'references/shots/camera'),{recursive:true});
|
|
79
|
+
const card='---\nname: a-camera\n---\n\nTest live guidance';
|
|
80
|
+
await writeFile(join(dir,'references/shots/camera/a-camera.md'),card);
|
|
81
|
+
await writeFile(join(dir,'gallery/api/library.json'),JSON.stringify({cards:[
|
|
82
|
+
{name:'a-camera',summary:'Travel across the view',use:'Show motion',category:'camera',duration:'3s',source:'references/shots/camera/a-camera.md',styles:[{key:'fly',label:'Fly'}]},
|
|
83
|
+
{name:'bad-file',summary:'Unsafe',source:'../escape.md',styles:[]}
|
|
84
|
+
]}));
|
|
85
|
+
const catalog=loadRecipeCatalog({shotcraftRoot:dir});
|
|
86
|
+
const selected=filterRecipes(catalog,{source:'shotcraft',category:'camera',query:'fly'});
|
|
87
|
+
expect(selected).toHaveLength(1);
|
|
88
|
+
expect(selected[0]).toMatchObject({id:'shotcraft:a-camera',executable:false,implementation:'reference-shot-card',styles:[{key:'fly',label:'Fly'}]});
|
|
89
|
+
expect(readRecipeDetail(selected[0]).guide).toBe(card);
|
|
90
|
+
expect(getRecipe(catalog,'shotcraft:bad-file')?.sourceFile).toBeNull();
|
|
91
|
+
await writeFile(join(dir,'references/shots/camera/a-camera.md'),'Updated on disk');
|
|
92
|
+
expect(readRecipeDetail(selected[0]).guide).toBe('Updated on disk');
|
|
93
|
+
}finally{await rm(dir,{recursive:true,force:true});}
|
|
94
|
+
});
|
|
95
|
+
it('keeps Markcut native recipes available when the installed Shotcraft JSON is invalid',async()=>{
|
|
96
|
+
const dir=await mkdtemp(join(tmpdir(),'shotcraft-corrupt-'));
|
|
97
|
+
try{
|
|
98
|
+
await mkdir(join(dir,'gallery/api'),{recursive:true});
|
|
99
|
+
await writeFile(join(dir,'gallery/api/library.json'),'not-json');
|
|
100
|
+
const catalog=loadRecipeCatalog({shotcraftRoot:dir});
|
|
101
|
+
expect(catalog.sources.shotcraft.status).toBe('unavailable');
|
|
102
|
+
expect(catalog.sources.markcut.count).toBe(4);
|
|
103
|
+
expect(catalog.recipes).toHaveLength(4);
|
|
104
|
+
}finally{await rm(dir,{recursive:true,force:true});}
|
|
105
|
+
});
|
|
106
|
+
it('rejects Shotcraft reference files that are symlinks outside the installed Skill',async()=>{
|
|
107
|
+
const dir=await mkdtemp(join(tmpdir(),'shotcraft-symlink-'));
|
|
108
|
+
const outside=await mkdtemp(join(tmpdir(),'shotcraft-outside-'));
|
|
109
|
+
try{
|
|
110
|
+
await mkdir(join(dir,'gallery/api'),{recursive:true});
|
|
111
|
+
await mkdir(join(dir,'references/shots/camera'),{recursive:true});
|
|
112
|
+
await writeFile(join(outside,'sensitive.md'),'do not read');
|
|
113
|
+
await symlink(join(outside,'sensitive.md'),join(dir,'references/shots/camera/escape.md'));
|
|
114
|
+
await writeFile(join(dir,'gallery/api/library.json'),JSON.stringify({cards:[{name:'escape',source:'references/shots/camera/escape.md'}]}));
|
|
115
|
+
const catalog=loadRecipeCatalog({shotcraftRoot:dir});
|
|
116
|
+
expect(catalog.recipes.at(-1)?.sourceFile).toBeNull();
|
|
117
|
+
}finally{await rm(dir,{recursive:true,force:true});await rm(outside,{recursive:true,force:true});}
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
describe('user-facing recipes CLI',()=>{
|
|
122
|
+
it('provides machine-readable unified catalog with provenance',()=>{
|
|
123
|
+
const result=spawnSync(process.execPath,[cli,'recipes','list','--json'],{encoding:'utf8'});
|
|
124
|
+
expect(result.status,result.stderr).toBe(0);
|
|
125
|
+
const json=JSON.parse(result.stdout);
|
|
126
|
+
expect(json.count).toBe(json.recipes.length);
|
|
127
|
+
expect(json.sources.markcut.count).toBe(4);
|
|
128
|
+
expect(json.recipes.some((r:any)=>r.id==='markcut:map-route-journey')).toBe(true);
|
|
129
|
+
});
|
|
130
|
+
it('provides a real native copyable scene and a readable external reference',()=>{
|
|
131
|
+
const own=spawnSync(process.execPath,[cli,'recipes','show','markcut:map-route-journey'],{encoding:'utf8'});
|
|
132
|
+
expect(own.status).toBe(0);
|
|
133
|
+
expect(own.stdout).toContain('- map view:route');
|
|
134
|
+
expect(own.stdout).toContain('routeAnimation:');
|
|
135
|
+
});
|
|
136
|
+
it('fails clearly for invalid options rather than silently ignoring them',()=>{
|
|
137
|
+
const result=spawnSync(process.execPath,[cli,'recipes','list','--nonsense'],{encoding:'utf8'});
|
|
138
|
+
expect(result.status).toBe(2);
|
|
139
|
+
expect(result.stderr).toContain('Unknown recipes option');
|
|
140
|
+
});
|
|
141
|
+
});
|
|
@@ -42,12 +42,12 @@ it('generic --vtt/--itt plus --agent uses the existing STT→semantic segment wo
|
|
|
42
42
|
'--vtt-sample-interval','2'];
|
|
43
43
|
execFileSync(process.execPath,args,{cwd:base,timeout:200000,encoding:'utf8'});
|
|
44
44
|
const meta=JSON.parse(readFileSync(join(media,'metadata.json'),'utf8'));
|
|
45
|
-
expect(meta
|
|
46
|
-
expect(meta
|
|
47
|
-
expect(meta
|
|
48
|
-
expect(Object.keys(meta
|
|
49
|
-
expect(meta
|
|
50
|
-
expect(meta
|
|
45
|
+
expect(meta['photo.png'].perception.desc).toContain('Recognized landscape');
|
|
46
|
+
expect(meta['clip.mp4'].perception.subtitle).toBe('clip.vtt');
|
|
47
|
+
expect(meta['clip.mp4'].perception.desc).toContain('Recognized landscape');
|
|
48
|
+
expect(Object.keys(meta['clip.mp4'].perception.segments)).toEqual(['0to2000','2000to4000']);
|
|
49
|
+
expect(meta['clip.mp4'].perception.segments['0to2000'].vision).toContain('Recognized landscape');
|
|
50
|
+
expect(meta['clip.mp4'].perception.segments['2000to4000'].instructions).toEqual([
|
|
51
51
|
{utterance:'嘿 Neo,这里是一个重要镜头',intent:'emphasize later',time_seconds:2.2,confidence:'high'},
|
|
52
52
|
]);
|
|
53
53
|
});
|
|
@@ -66,7 +66,7 @@ it('invalid semantic Agent response does not silently fall back to code-selected
|
|
|
66
66
|
expect(()=>execFileSync(process.execPath,args,{cwd:base,timeout:90000,stdio:'pipe'}))
|
|
67
67
|
.toThrow();
|
|
68
68
|
const meta=JSON.parse(readFileSync(join(other,'metadata.json'),'utf8'));
|
|
69
|
-
expect(meta.
|
|
69
|
+
expect(meta['clip.mp4']?.perception?.segments).toBeUndefined();
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
it('obsolete provider switch is rejected instead of silently becoming a prompt override',()=>{
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { describe,it,expect,afterAll } from 'vitest';
|
|
2
|
+
import {execFileSync} from 'node:child_process';
|
|
3
|
+
import {mkdirSync,mkdtempSync,rmSync,readFileSync,writeFileSync,existsSync} from 'node:fs';
|
|
4
|
+
import {tmpdir} from 'node:os';
|
|
5
|
+
import {join} from 'node:path';
|
|
6
|
+
import {main} from '../src/vision/cli.mjs';
|
|
7
|
+
const folder=mkdtempSync(join(tmpdir(),'markcut-meta-single-'));
|
|
8
|
+
afterAll(()=>rmSync(folder,{recursive:true,force:true}));
|
|
9
|
+
it('filename keys, same-stem sources, normalized paths and preserved durations',async()=>{
|
|
10
|
+
execFileSync('ffmpeg',['-v','error','-y','-f','lavfi','-i','color=c=blue:s=160x90:d=2','-frames:v','1',join(folder,'same.jpg')]);
|
|
11
|
+
execFileSync('ffmpeg',['-v','error','-y','-f','lavfi','-i','testsrc2=s=160x90:r=2:d=62',
|
|
12
|
+
'-c:v','libx264','-preset','ultrafast',join(folder,'same.mp4')]);
|
|
13
|
+
writeFileSync(join(folder,'metadata.json'),JSON.stringify({'same':{perception:{desc:'Older metadata cache'}}}));
|
|
14
|
+
await main(['node','vision','vision',folder,'--normalize-only']);
|
|
15
|
+
const m=JSON.parse(readFileSync(join(folder,'metadata.json'),'utf8'));
|
|
16
|
+
expect(Object.keys(m).sort()).toEqual(['same.jpg','same.mp4']);
|
|
17
|
+
expect(m['same.jpg'].normalized).toMatch(/^\.normalized\/same.jpg_384\.jpg$/);
|
|
18
|
+
expect(m['same.mp4'].normalized).toMatch(/^\.normalized\/same.mp4_full\.mp4$/);
|
|
19
|
+
const output=join(folder,m['same.mp4'].normalized);
|
|
20
|
+
expect(existsSync(output)).toBe(true);
|
|
21
|
+
const duration=Number(execFileSync('ffprobe',['-v','error','-show_entries','format=duration','-of','default=noprint_wrappers=1:nokey=1',output],{encoding:'utf8'}).trim());
|
|
22
|
+
expect(Math.abs(duration-62)).toBeLessThan(.6);
|
|
23
|
+
});
|