def remove_unprocessed_secondary_files(unfiltered_secondary_files: dict
    ) ->list:
    """
    Interpolated strings and optional inputs in secondary files were added to CWL in version 1.1.

    The CWL libraries we call do successfully resolve the interpolated strings, but add the resolved
    fields to the list of unresolved fields so we remove them here after the fact.

    We also remove any secondary files here not containing 'toilfs:', which means that it was not
    successfully imported into the toil jobstore.  The 'required' logic seems to be handled deeper in
    cwltool.builder.Builder(), and correctly determines which files should be imported.  Therefore we
    remove the files here and if this file is SUPPOSED to exist, it will still give the appropriate file
    does not exist error, but just a bit further down the track.
    """
    intermediate_secondary_files = []
    final_secondary_files = []
    for sf in unfiltered_secondary_files['secondaryFiles']:
        sf_bn = sf.get('basename', '')
        if '$(' not in sf_bn and '${' not in sf_bn:
            intermediate_secondary_files.append(sf)
    for sf in intermediate_secondary_files:
        sf_loc = sf.get('location', '')
        if sf_loc.startswith('toilfs:'):
            final_secondary_files.append(sf)
    return final_secondary_files
