
    +j                      *    d Z ddlZddlZdedefdZdS )z2Enrich executed-node output entries with asset id.    N	output_uireturnc           
      j   ddl m} |j        s| S ddl}ddlm}m} i }|                                 D ]\  }}t          |t                    s|||<   !g }|D ]S}	t          |	t                    rd|	vsd|	vr|                    |	           6	 |                    |	d                   }
|
|                    |	           jt          j                            |
          }t          j                            t          j                            ||	                    d          pd|	d                             }	 t          j                            ||g          |k    rt'          d	          nN# t&          $ rA t)          j        d
|	                    d                     |                    |	           Y bw xY wt          j                            |          s|                    |	            |||	d         |	d         g          }t          |	          }	|j        j        |	d<   nh# |$ r+ t)          j        d|	                    d                     Y n9t2          $ r- t)          j        d|	                    d          d           Y nw xY w|                    |	           U|||<   |S )a^  Register file-type output entries as assets and inject their ``id``.

    Runs at output-processing time, once per produced output, when
    --enable-assets is set. Returns a new dict; entries without a resolvable
    on-disk file path are left unchanged. Errors are caught per-entry so a
    failure never blocks execution or the other entries.
    r   )argsN)register_file_in_placeDependencyMissingErrorfilenametype	subfolder zescapes basez0Asset enrichment skipped (path escapes base): %s)abs_pathnametagsidz3Asset enrichment skipped (blake3 not available): %sz/Failed to enrich output entry with asset id: %sT)exc_info)comfy.cli_argsr   enable_assetsfolder_pathsapp.assets.services.ingestr   r   items
isinstancelistdictappendget_directory_by_typeospathabspathjoinget
commonpath
ValueErrorloggingwarningisfilerefr   	Exception)r   r   r   r   r   enrichedkeyentriesnew_entriesentrybasebase_absr   results                 @/home/wildlama/comfy/ComfyUI/comfy_execution/asset_enrichment.pyenrich_output_with_assetsr1      s"    $##### YYYYYYYYH!)) +$ +$W'4(( 	#HSM %	& %	&EeT** j.E.EW\I\I\""5))) y#99%-HH<&&u---7??4007??27<<%))KBXBXB^\^`efp`q+r+rssw))8X*>??8KK(888 L!   O$VX]XaXablXmXmnnn&&u---H w~~h// &&u---
 0/%z*-   U$jmd) n n n UW\W`W`akWlWlmmmmm y y y QSXS\S\]gShShswxxxxxxyu%%%%#OsJ   2H-A8H-:4E/.H-/AF:6H-9F::7H-39H---J3JJ)__doc__r#   r   r   r1        r0   <module>r5      sI    8 8  				< <$ < < < < < <r4   