@@ -826,6 +826,11 @@ describe('maker build local-change guard', () => {
826826 description : 'Create a text-to-video generation task' ,
827827 inputSchema : { type : 'object' , properties : { prompt : { type : 'string' } } } ,
828828 } ,
829+ {
830+ name : 'query_video_task' ,
831+ description : 'Query a text-to-video generation task' ,
832+ inputSchema : { type : 'object' , properties : { task_id : { type : 'string' } } } ,
833+ } ,
829834 {
830835 name : 'text_to_music' ,
831836 description : 'Generate music from text' ,
@@ -846,13 +851,15 @@ describe('maker build local-change guard', () => {
846851 'batch_generate_images' ,
847852 'edit_image' ,
848853 'create_video_task' ,
854+ 'query_video_task' ,
849855 'text_to_music' ,
850856 ] ) ;
851857 expect ( MAKER_REMOTE_PROXY_EXPOSED_TOOL_NAMES ) . toEqual ( [
852858 'generate_image' ,
853859 'batch_generate_images' ,
854860 'edit_image' ,
855861 'create_video_task' ,
862+ 'query_video_task' ,
856863 'text_to_music' ,
857864 ] ) ;
858865 expect ( result . tools . find ( ( item ) => item . name === 'generate_image' ) ?. description ) . toContain (
@@ -867,6 +874,9 @@ describe('maker build local-change guard', () => {
867874 expect ( result . tools . find ( ( item ) => item . name === 'create_video_task' ) ?. description ) . toContain (
868875 'Large local/data URL media can be slow or fail'
869876 ) ;
877+ expect ( result . tools . find ( ( item ) => item . name === 'query_video_task' ) ?. description ) . toContain (
878+ 'Use this Maker MCP proxy tool to refresh video task status'
879+ ) ;
870880 } ) ;
871881
872882 test ( 'falls back to local Maker tools when remote proxy tool listing is unavailable' , async ( ) => {
@@ -895,7 +905,7 @@ describe('maker build local-change guard', () => {
895905 expect ( output ) . toContain ( '- status: unavailable' ) ;
896906 expect ( output ) . toContain ( '- available_tools: (none)' ) ;
897907 expect ( output ) . toContain (
898- '- missing_tools: generate_image, batch_generate_images, edit_image, create_video_task, text_to_music'
908+ '- missing_tools: generate_image, batch_generate_images, edit_image, create_video_task, query_video_task, text_to_music'
899909 ) ;
900910 expect ( output ) . toContain ( '- build_available: no' ) ;
901911 expect ( output ) . toContain ( '- failure_message: connect ECONNREFUSED remote maker proxy' ) ;
@@ -1086,6 +1096,96 @@ describe('maker build local-change guard', () => {
10861096 ) ;
10871097 } ) ;
10881098
1099+ test ( 'downloads queried video proxy results into Maker asset directories' , async ( ) => {
1100+ const video = await materializeRemoteProxyToolAssets ( {
1101+ toolName : 'query_video_task' ,
1102+ targetDir : tempDir ,
1103+ now : new Date ( '2026-06-02T08:09:16Z' ) ,
1104+ fetchImpl : fakeAssetFetch ( 'queried-video-bytes' ) ,
1105+ result : proxyTextResult ( {
1106+ task_id : 'cgt-20260602155659-query' ,
1107+ status : 'succeeded' ,
1108+ cdn_url : 'https://example.test/query-video.mp4' ,
1109+ } ) ,
1110+ } ) ;
1111+
1112+ const videoText = video . content [ 0 ] ?. type === 'text' ? video . content [ 0 ] . text : '' ;
1113+ expect ( JSON . parse ( videoText ) . localPath ) . toBe (
1114+ 'assets/video/cgt-20260602155659-query_20260602080916.mp4'
1115+ ) ;
1116+ expect (
1117+ fs . readFileSync (
1118+ path . join ( tempDir , 'assets/video/cgt-20260602155659-query_20260602080916.mp4' ) ,
1119+ 'utf8'
1120+ )
1121+ ) . toBe ( 'queried-video-bytes' ) ;
1122+ const registry = JSON . parse (
1123+ fs . readFileSync ( path . join ( tempDir , '.maker/assets/generated-assets.json' ) , 'utf8' )
1124+ ) ;
1125+ expect ( registry [ 'assets/video/cgt-20260602155659-query_20260602080916.mp4' ] . tool ) . toBe (
1126+ 'query_video_task'
1127+ ) ;
1128+ expect ( registry [ 'assets/video/cgt-20260602155659-query_20260602080916.mp4' ] . taskId ) . toBe (
1129+ 'cgt-20260602155659-query'
1130+ ) ;
1131+ expect ( registry [ 'assets/video/cgt-20260602155659-query_20260602080916.mp4' ] . cdnUrl ) . toBe (
1132+ 'https://example.test/query-video.mp4'
1133+ ) ;
1134+ } ) ;
1135+
1136+ test ( 'reuses materialized video when querying the same task result again' , async ( ) => {
1137+ const firstFetch = jest . fn ( fakeAssetFetch ( 'video-bytes' ) ) ;
1138+ const secondFetch = jest . fn ( fakeAssetFetch ( 'duplicate-video-bytes' ) ) ;
1139+
1140+ const created = await materializeRemoteProxyToolAssets ( {
1141+ toolName : 'create_video_task' ,
1142+ targetDir : tempDir ,
1143+ now : new Date ( '2026-06-02T08:09:20Z' ) ,
1144+ fetchImpl : firstFetch as typeof fetch ,
1145+ result : proxyTextResult ( {
1146+ task_id : 'cgt-20260602155659-reuse' ,
1147+ status : 'succeeded' ,
1148+ cdn_url : 'https://example.test/reuse-video.mp4' ,
1149+ } ) ,
1150+ } ) ;
1151+ const queried = await materializeRemoteProxyToolAssets ( {
1152+ toolName : 'query_video_task' ,
1153+ targetDir : tempDir ,
1154+ now : new Date ( '2026-06-02T08:10:20Z' ) ,
1155+ fetchImpl : secondFetch as typeof fetch ,
1156+ result : proxyTextResult ( {
1157+ task_id : 'cgt-20260602155659-reuse' ,
1158+ status : 'succeeded' ,
1159+ cdn_url : 'https://example.test/reuse-video.mp4' ,
1160+ } ) ,
1161+ } ) ;
1162+
1163+ const createdText = created . content [ 0 ] ?. type === 'text' ? created . content [ 0 ] . text : '' ;
1164+ const queriedText = queried . content [ 0 ] ?. type === 'text' ? queried . content [ 0 ] . text : '' ;
1165+ const createdPayload = JSON . parse ( createdText ) ;
1166+ const queriedPayload = JSON . parse ( queriedText ) ;
1167+ expect ( queriedPayload . localPath ) . toBe ( createdPayload . localPath ) ;
1168+ expect ( firstFetch ) . toHaveBeenCalledTimes ( 1 ) ;
1169+ expect ( secondFetch ) . not . toHaveBeenCalled ( ) ;
1170+ expect (
1171+ fs . readFileSync (
1172+ path . join ( tempDir , 'assets/video/cgt-20260602155659-reuse_20260602080920.mp4' ) ,
1173+ 'utf8'
1174+ )
1175+ ) . toBe ( 'video-bytes' ) ;
1176+
1177+ const registry = JSON . parse (
1178+ fs . readFileSync ( path . join ( tempDir , '.maker/assets/generated-assets.json' ) , 'utf8' )
1179+ ) ;
1180+ const matchingVideos = Object . values ( registry ) . filter (
1181+ ( record ) =>
1182+ typeof record === 'object' &&
1183+ record !== null &&
1184+ ( record as { taskId ?: string } ) . taskId === 'cgt-20260602155659-reuse'
1185+ ) ;
1186+ expect ( matchingVideos ) . toHaveLength ( 1 ) ;
1187+ } ) ;
1188+
10891189 test ( 'downloads edit image proxy result into Maker image assets' , async ( ) => {
10901190 const result = await materializeRemoteProxyToolAssets ( {
10911191 toolName : 'edit_image' ,
0 commit comments