Get style and script file versions and use them while writing a cache manifest file

You could use add_query_arg():

$url = add_query_arg( 'ver', $GLOBALS['wp_version'], $url );

But I see one problem: How can you be sure the resource is actually used? And how do you know the author has not passed a custom version?

So you can do that only in a very controlled environment: when you know everything about the code.