ó
    ±"³jÔ  ã                  ó¦   • % S r SSKJr  SSKJrJr  SSKJr   " S S\5      r " S S\5      r	 " S	 S
\5      r
\	" 5       rS\S'    \
" 5       rS\S'   g)aš  Serialization codecs for durable execution backends.

A `DurabilityCodec` is the single seam the base uses at every serialization site. It splits the
two engine families cleanly:

- **object-passing** engines (Temporal, DBOS, Prefect) hand live Python objects to their durable
  primitive and let the primitive's own serializer persist them. They use `IDENTITY_CODEC`, which
  returns values unchanged and ignores the type.
- **JSON-journal** engines (Restate, AWS Lambda, Absurd) write JSON bytes to a journal and must
  reduce each value to a JSON-able shape first. They use `JSON_CODEC`, which round-trips through a
  cached `TypeAdapter(tp)`.

The base calls `dump(tp, value)` *inside* the durable unit (so a non-serializable payload fails in
the step, the same in production as in tests) and `load(tp, payload)` *outside* it, mirroring what
the JSON engines do by hand today (dump inside `_inner`, validate outside).
é    )Úannotations)ÚAnyÚProtocol)ÚTypeAdapterc                  ó,   • \ rS rSrSrSS jrSS jrSrg)	ÚDurabilityCodecé   a’  Reduces a value to a durably-storable payload and rebuilds it on the other side.

`tp` is a "type form" (a class, or an annotated/aliased type like `CallToolResult`), i.e.
anything `TypeAdapter` accepts, so it is typed `Any`, not `type[T]`. Engine authors select a
codec on `BaseDurabilityCapability`; see
[durable backend guide](https://pydantic.dev/docs/ai/capabilities/durable_execution/backends/).
c                ó   • g ©N© ©ÚselfÚtpÚvalues      Ú\/home/mande/repo/quber/.venv/lib/python3.13/site-packages/pydantic_ai/durable_exec/_codec.pyÚdumpÚDurabilityCodec.dump"   s   € °ó    c                ó   • g r   r   ©r   r   Úpayloads      r   ÚloadÚDurabilityCodec.load$   s   € °#r   r   N©r   r   r   r   Úreturnr   ©r   r   r   r   r   r   ©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   Ú__static_attributes__r   r   r   r   r      s   † ñô 4ç5r   r   c                  ó,   • \ rS rSrSrSS jrSS jrSrg)	Ú_IdentityCodecé'   zSPasses values through untouched; the engine's durable primitive owns serialization.c                ó   • U$ r   r   r   s      r   r   Ú_IdentityCodec.dump*   s   € Øˆr   c                ó   • U$ r   r   r   s      r   r   Ú_IdentityCodec.load-   s   € Øˆr   r   Nr   r   r   r   r   r   r%   r%   '   s   † Ù]ô÷r   r%   c                  ó@   • \ rS rSrSrS	S jrS
S jrSS jrSS jrSr	g)Ú
_JsonCodecé1   zJRound-trips values through a cached `TypeAdapter` so they journal as JSON.c                ó   • 0 U l         g r   ©Ú	_adapters)r   s    r   Ú__init__Ú_JsonCodec.__init__4   s	   € Ø68ˆ�r   c                ót   • U R                   R                  U5      nUc  [        U5      nX R                   U'   U$ r   )r0   Úgetr   )r   r   Úadapters      r   Ú_adapterÚ_JsonCodec._adapter7   s5   € Ø—.‘.×$Ñ$ RÓ(ˆØ‰?Ü! "“oˆGØ!(�N‰N˜2ÑØˆr   c                ó@   • U R                  U5      R                  USS9$ )NÚjson)Úmode)r6   Údump_pythonr   s      r   r   Ú_JsonCodec.dump>   s!   € Ø�}‰}˜RÓ ×,Ñ,¨U¸Ð,Ð@Ð@r   c                óB   • U R                  U5      R                  U5      $ r   )r6   Úvalidate_pythonr   s      r   r   Ú_JsonCodec.loadA   s   € Ø�}‰}˜RÓ ×0Ñ0°Ó9Ð9r   r/   N)r   ÚNone)r   r   r   zTypeAdapter[Any]r   r   )
r   r   r    r!   r"   r1   r6   r   r   r#   r   r   r   r,   r,   1   s   † ÙTô9ôôA÷:r   r,   ÚIDENTITY_CODECÚ
JSON_CODECN)r"   Ú
__future__r   Útypingr   r   Úpydanticr   r   r%   r,   rA   Ú__annotations__rB   r   r   r   Ú<module>rG      s`   ðòõ" #ç  å  ô6�hô 6ô�_ô ô:�ô :ñ( #1Ó"2€�Ó 2ðñ )›l€
ˆOÓ *ðr   