+
    jHàj/ƒ ã                  óÎ  € R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIHt ^ RIHtHtHt ]P"                  ! R4      t]! RR04      t]! R04      tRŸtRR/tR R ltR R ltR R R lltR R ltR^R^R^R^/tRR/R R lltR R ltR R  ltR! R" lt R# R$ lt!R¡R%R&/R' R( lllt"RR)R	R)R
R)/t#R* R+ lt$R,RR-R&/R. R/ llt%R¢R0 R1 llt&R2RR3R/R4 R5 llt'R6 R7 lt(R8 R9 lt)R: R; lt*R< R= lt+R> R? lt,R£R@R&/RA RB lllt-RC RD lt.RE RF lt/RG RH lt0RI t1RJ RK lt2RL RM lt3RN RO lt4RP RQ lt5R RR RS llt6RTR&/RU RV llt7RW RX lt8RY RZ lt9R[R&/R\ R] llt:R^ R_ lt;]! R`04      t<Rat=Rbt>Rc Rd lt?Re Rf lt@Rg Rh ltAR[R&/Ri Rj lltBR[R&/Rk Rl lltCRm Rn ltD]! 0 R¤m4      tE]! 0 R¥m4      tFR Ro Rp lltGR Rq Rr lltHR¦Rs Rt lltIRu Rv ltJRw Rx ltKRy Rz ltL] ! R{ R|4      4       tMR} R~ ltNR R€ ltOR� R‚ ltPRƒ R„ ltQR… R† ltR^<tSR‡ Rˆ ltTR‰ RŠ ltUR‹ RŒ ltVR� RŽ ltWR� R� ltXR‘ R’ ltYR“ R” ltZR• R– lt[R— R˜ lt\R¡R[R&/R™ Rš lllt]^ R›I^H_t` ^ RœI^Hatb ^ R�I^Hctd ^ RžI^Hetf R# )§aÖ  Cron delivery: target resolution (origin/home/explicit/bot-chat), transcript mirroring and
session seeding, live-adapter / relay / standalone send lanes, and ``_deliver_result``.

Split out of ``cron.scheduler``. Import names from this module directly (``cron.scheduler`` only
imports the few it calls itself). Origin-resident helpers and sibling split modules are reached
late-bound (``_sched`` / module refs at the bottom) so monkeypatching the defining module works.
)ÚannotationsN)Ú	dataclass)ÚAnyÚListÚOptionalzcron.schedulerÚwebhookÚwecom_callbackÚ
api_serverÚmatrixÚtelegramÚslackÚQQBOT_HOME_CHANNELÚQQ_HOME_CHANNELc               ó    € V ^8„  d   QhRRRR/# )é   Úlogical_platform_nameÚstrÚreturn© )Úformats   "Ú</home/ubuntu/.hermes/hermes-agent/cron/scheduler_delivery.pyÚ__annotate__r   2   s   € ÷ ñ ¸sð Àsñ ó    c                ó  € \         P                  ! \        4      ;_uu_ 4        \        V RR4      ;'       g    / pTP	                  \        T;'       g    R4      P                  4       4      p\        V\        4      '       d   VP	                  R4      MRpVf   VP	                  R4      pVe8   \        V4      P                  4       P                  4       R8X  d    RRR4       R# RRR4       R#   + '       g   i     R# ; i)uÿ  Return ``"in_channel"`` or ``"thread"`` (default) for a platform config.

Native: flat ``platforms.<p>.extra.cron_continuable_surface``. Relay-fronted:
``platforms.relay.extra.<logical>.cron_continuable_surface`` (same sub-block as the relay's
Slack knobs); the sub-block wins and is scoped to its logical platform. Unlike
_relay_slack_extra, a sub-block that omits the knob falls back to the flat key (deliberate â€”
the flat key must keep working), so a flat value applies to EVERY platform the relay fronts.
ÚextraNÚ Úcron_continuable_surfaceÚ
in_channelÚthread)
Ú
contextlibÚsuppressÚ	ExceptionÚgetattrÚgetr   ÚlowerÚ
isinstanceÚdictÚstrip)Úpconfigr   r   ÚsubÚraws   &&   r   Ú_resolve_cron_surface_moder+   2   sÃ   € ô 
×	Ò	œY×	'Õ	'Ü˜ ¨$Ó/×5Ð5°2ˆØ�i‰iœÐ1×7Ð7°RÓ8×>Ñ>Ó@ÓAˆÜ5?ÀÄT×5JÒ5Jˆc�g‰gÐ0Ô1ÐPTˆØŠ;Ø—)‘)Ð6Ó7ˆCØŠ?œs 3›xŸ~™~Ó/×5Ñ5Ó7¸<ÔGØ÷ 
(×	'Ñ	'ñ ÷ 
(Ö	'ñ ús   £0C0ÁBC0Ã0D	c               ó    € V ^8„  d   QhRRRR/# ©r   Újobr&   r   úOptional[dict]r   )r   s   "r   r   r   F   s   € ÷ ñ ˜ð  .ñ r   c                ó
  € V P                  R4      p\        V\        4      '       d\   VP                  R4      '       dE   VP                  R4      '       d.   \        VR,          4      P	                  4       \
        9   d   R# V# R# )uê  Extract origin info from a job. Non-dict origins (provenance strings, hand-edited
jobs.json) are treated as missing â€” otherwise every fire crashed on ``origin.get``.

Without this guard, a job tagged with e.g. ``"combined-digest-replaces-x-and-y"`` crashed every fire
attempt with ``'str' object has no attribute 'get'`` â€” ``mark_job_run`` recorded the failure, but the
next tick re-loaded the same poisoned origin and crashed identically until the field was patched
manually (#18722).
ÚoriginÚplatformÚchat_idN)r#   r%   r&   r   r$   Ú_NON_PUSH_ORIGIN_PLATFORMS)r.   r1   s   & r   Ú_resolve_originr5   F   sd   € ð �W‰W�XÓ€FÜ�&œ$×Ò F§J¡J¨z×$:Ò$:¸v¿z¹zÈ)×?TÒ?Tô ˆv�jÕ!Ó"×(Ñ(Ó*Ô.HÔHÙØˆÙr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r.   r&   Úcfgr/   r   Úboolr   )r   s   "r   r   r   Z   s!   € ÷ ñ  tð °.ð ÈDñ r   c                ó*  € V P                  R4      p\        V\        4      '       d   V#  Vf    \        P                  ! 4       ;'       g    / p\        VP                  R/ 4      ;'       g    / P                  RR4      4      #   \
         d     R# i ; i)u¶  Whether a cron delivery is also mirrored into the target chat's session transcript.

Default OFF. Precedence: per-job ``attach_to_session`` (bool) â†’ global
``cron.mirror_delivery`` â†’ False. CARVE-OUT: the ``in_channel`` surface seeds its session
independently of this knob (the seed IS that feature) â€” this governs only the thread-surface
mirror. ``mirror_to_session`` runs at a turn boundary, so it is alternation- and cache-safe.
Úattach_to_sessionÚcronÚmirror_deliveryF)r#   r%   r8   Ú_schedÚload_configr!   )r.   r7   Úper_jobs   && r   Ú_cron_mirror_delivery_enabledr@   Z   sƒ   € ð �g‰gÐ)Ó*€GÜ�'œ4× Ò ØˆðØŠ;Ü×$Ò$Ó&×,Ð,¨"ˆCÜ�S—W‘W˜V RÓ(×.Ð.¨B×3Ñ3Ð4EÀuÓMÓNÐNøÜô Úðús   «B Á B Á,B ÂBÂBc          
     ó,   € V ^8„  d   QhRRRRRRRRRR	/# )
r   r1   r&   Úplatform_namer   r3   Ú	thread_idúOptional[str]r   r8   r   )r   s   "r   r   r   m   s8   € ÷ Oñ O 4ð O¸ð OÀcð OØ&3ðOØ8<ñOr   c                ón  € V '       do   \        V P                  RR4      4      P                  4       \        V4      P                  4       8w  g*   \        V P                  RR4      4      \        V4      8w  d   R# V P                  R4      pVRJ ;'       g"    \        V4      \        T;'       g    R4      8H  # )uè   True when a delivery target is the job's own origin conversation. A pinned origin
thread_id must match â€” a target without it is a different lane. Mirror eligibility for
non-origin targets is decided by ``_target_mirror_eligible``.r2   r   r3   FrC   N)r   r#   r$   )r1   rB   r3   rC   Úorigin_threads   &&&& r   Ú_target_matches_originrG   m   s‹   € ÷ Üˆv�z‰z˜* bÓ)Ó*×0Ñ0Ó2´c¸-Ó6H×6NÑ6NÓ6PÔPÜˆv�z‰z˜) RÓ(Ó)¬S°«\Ô9áØ—J‘J˜{Ó+€MØ˜DÐ ×NÐN¤C¨Ó$6¼#¸i¿o¸oÈ2Ó:NÑ$NÐNr   r1   Úorigin_fallbackÚhomeÚexplicitÚorigin_matchc          
     ó,   € V ^8„  d   QhRRRRRRRRRR/# )	r   r.   r&   ÚtargetÚglobal_mirrorr8   rK   zOptional[bool]r   r   )r   s   "r   r   r   �   s4   € ÷ ñ Ø	ðØðØ/3ðØCQðØ]añr   c               ó�  € VfR   \        V 4      ;'       g    / p\        WAP                  RR4      VP                  RR4      VP                  R4      4      pV'       d   R# VP                  R4      pVR
9   d5   V P                  R4      p\        V\        4      '       d   V# \	        V4      # VR8X  d   V P                  R4      RJ # R	# )u‚  Whether a resolved delivery target may receive the transcript mirror. Origin targets:
always. ``origin_fallback`` (deliver=origin with no captured origin â†’ home channel, standing
in for the primary conversation) and ``home`` (user-written bare-platform token, e.g.
``deliver: slack`` â€” deliberately addresses that platform's home channel): same flags as a
true origin. ``explicit`` ``platform:chat_id``: ONLY with per-job ``attach_to_session: true``
â€” the global flag must never write transcripts into arbitrary explicitly-addressed chats.
Untagged broadcast expansions (``all``) are never eligible. ``origin_match`` may be
precomputed.r2   r   r3   rC   TÚ_resolved_fromr:   rJ   F)rH   rI   )r5   rG   r#   r%   r8   )r.   rM   rN   rK   r1   Úresolved_fromr?   s   &&$$   r   Ú_target_mirror_eligiblerR   �   s¹   € ð ÒÜ  Ó%×+Ð+¨ˆÜ-Ø—J‘J˜z¨2Ó.°·
±
¸9ÀbÓ0IÈ6Ï:É:ÐVaÓKbódˆçÙØ—J‘JÐ/Ó0€MØÐ3Ô3ð —'‘'Ð-Ó.ˆÜ$ W¬d×3Ò3ˆwÐL¼¸mÓ9LÐLØ˜
Ô"Ø�w‰wÐ*Ó+¨tÐ3Ð3Ùr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úis_dmr8   Úuser_idrD   r   r   )r   s   "r   r   r   œ   s!   € ÷ "ñ " dð "°]ð "Àtñ "r   c                ó,   € \        T ;'       g    T4      # )u  Whether the flat in_channel seed may run. Group keys are user-isolated
(``â€¦:group:<chat_id>:<user_id>``): seeding without a real user_id creates an orphan session no
reply resolves to â€” worse than no seed. DM keys omit user_id, so DMs are always seedable.)r8   ©rT   rU   s   $$r   Ú_inchannel_seed_allowedrX   œ   s   € ô �× Ð ˜Ó!Ð!r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Útextr   Úwhatr   r   )r   s   "r   r   r   £   s!   € ÷ /ñ /˜sð /¨#ð /°#ñ /r   c                ó–   € V '       g   V #  ^ RI Hp V! V RR7      #   \         d"   p\        P	                  RY4        Rp?R# Rp?ii ; i)um  Fail-closed secret redaction for anything a cron job emits outward.

Every outward lane â€” chat message, session mirror, bot-chat turn â€” must apply the same policy,
so the policy lives in one place. ``force=True`` because this is a safety boundary, not
logging: the ``security.redact_secrets`` preference governs how much is scrubbed from the
user's own logs and must not be able to turn scrubbing off on the way out to a chat (same
reasoning as ``tools/delegation_live_log.py``). Empty input is returned as-is; any failure
inside the redactor replaces the payload entirely rather than letting an unscanned value out.
)Úredact_sensitive_textT)Úforcez)Failed to redact secrets from cron %s: %sNz[REDACTED - redaction failed])Úagent.redactr]   r!   ÚloggerÚwarning)rZ   r[   r]   Úes   &&  r   Ú_redact_cron_payloadrc   £   sC   € ÷ Øˆð/Ý6Ù$ T°Ô6Ð6øÜô /Ü�‰ÐBÀDÔLÝ.ûð/ús   Œ œA§AÁAc               ó    € V ^8„  d   QhRRRR/# ©r   r.   r&   r   r   r   )r   s   "r   r   r   ·   s   € ÷ Vñ V˜Dð V Sñ Vr   c                ól   € \        V P                  R4      ;'       g    V P                  RR4      R4      # )uÿ   Job name/id as it appears in outward-facing text. The mirror sinks and the thread title
splice the job *name* around the redacted payload, and the name is user-controlled config â€” a
name embedding a credential would re-leak it next to the scrubbed body.ÚnameÚidr;   újob name©rc   r#   )r.   s   &r   Ú_cron_display_namerk   ·   s,   € ô   §¡¨£× HÐ H°3·7±7¸4ÀÓ3HÈ*ÓUÐUr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r.   r&   rZ   r   r   r   )r   s   "r   r   r   ¾   s&   € ÷ Añ A˜dð A¨#ð A°#ñ Ar   c                ó$   € R \        V 4       RV 2# )z[Cron delivery: z]
)rk   )r.   rZ   s   &&r   Ú_cron_mirror_messagern   ¾   s   € ØÔ0°Ó5Ð6°c¸$¸Ð@Ð@r   ÚenabledFc               ó8   € V ^8„  d   QhRRRRRRRRRRR	RR
RRR/# )r   r.   r&   rB   r   r3   Úmirror_textrC   rD   rU   ro   r8   r   ÚNoner   )r   s   "r   r   r   Â   sN   € ÷ '
ñ '
Ø	ð'
Ø!ð'
Ø,/ð'
Ø>Að'
ØN[ð'
àð'
à/3ð'
ð 
ñ'
r   c          
     óâ  € V'       g   R# T;'       g    RP                  4       pV'       g   R#  ^ RIHp V! V\        V4      \	        W4      RWERR7      p	V	'       d*   \
        P                  RV P                  RR	4      W4       R# \
        P                  R
V P                  RR	4      W4       R#   \         d4   p
\
        P                  RT P                  RR	4      TY*4        Rp
?
R# Rp
?
ii ; i)uŒ  Best-effort mirror of a cron delivery into the origin chat's session. No-op unless
``enabled`` (caller resolves it, scoped to the origin target). Rides the same
``mirror_to_session`` path as ``send_message``, passing ``user_id`` so user-isolated group
chats resolve to the scheduling member. All failures swallowed â€” a successful delivery must
never be reported failed because the mirror broke.Nr   ©Úmirror_to_sessionr;   Úuser)Úsource_labelrC   rU   Úrolez9Job '%s': mirrored delivery into %s:%s session transcriptrh   Ú?uX   Job '%s': delivery mirror skipped for %s:%s (no matching gateway session â€” cold start)z.Job '%s': delivery mirror failed for %s:%s: %s)
r'   Úgateway.mirrorru   r   rn   r`   Úinfor#   Údebugr!   )r.   rB   r3   rq   rC   rU   ro   rZ   ru   Úokrb   s   &&&&&&$    r   Ú_maybe_mirror_cron_deliveryr~   Â   sÓ   € ÷ ÙØ×Ð˜2×$Ñ$Ó&€DßÙð
Ý4ñ Øœ3˜w›<Ô)=¸cÓ)HØ¨9ÈFôTˆ÷ Ü�K‰KØKØ—‘˜˜cÓ" Mö<ô �L‰Lð?à—‘˜˜cÓ" Mö<øô ô 
Ü�‰Ø<¸c¿g¹gÀdÈCÓ>PÐR_Ø÷	
ò 	
ûð
ús   °AB0 Â'B0 Â0C.Â;(C)Ã)C.Úgroupc               ó$   € V ^8„  d   QhRRRRRR/# )r   r.   r&   r3   r   r   rD   r   )r   s   "r   r   r   ó   s!   € ÷ ñ  tð ¸sð È]ñ r   c           
     óš  € \        VRR4      p\        V4      '       d   Vf   R# R\        V 4       2p ^ RIHp V! \        V4      V4      pV! Ws4      pVf   R# VP                  ^R7      p	V	'       d   \        V	4      # R#   \         d?   p
\        P                  RT P                  RR4      \        TR	R4      T
4        Rp
?
R# Rp
?
ii ; i)
z·Open a thread for a continuable cron job via ``adapter.create_handoff_thread``. Returns the
thread_id, or ``None`` (no thread primitive / failed) = caller falls back to the DM mirror.Úcreate_handoff_threadNu   Hermes â€” ©Úsafe_schedule_threadsafe©ÚtimeoutuV   Job '%s': create_handoff_thread failed on %s â€” falling back to DM-session mirror: %srh   ry   rg   )r"   Úcallablerk   Úagent.async_utilsr„   r   Úresultr!   r`   r|   r#   )r.   Úadapterr3   ÚloopÚcreate_threadÚthread_namer„   ÚcoroÚfutureÚnew_thread_idrb   s   &&&&       r   Ú_open_continuable_cron_threadr‘   ó   sÆ   € ô ˜GÐ%<¸dÓC€MÜ�M×"Ò" d¢lÙØÔ 2°3Ó 7Ð8Ð9€KðÝ>ÙœS ›\¨;Ó7ˆÙ)¨$Ó5ˆØŠ>ÙØŸ™¨b˜Ó1ˆß%2Œs�=Ó!Ð<¸Ð<øÜô Ü�‰ð$à�G‰G�D˜#Ó¤¨°¸Ó =¸qô	Bõ ûðús)   ´$B ÁB Á4
B Á?B ÂC
Â3CÃC
Ú	user_nameÚdiscord_keys_on_threadc               óH   € V ^8„  d   QhRRRRRRRRRRR	RR
RRRRRRRRRRR/# )r   r.   r&   rB   r   r3   rZ   rC   rD   Ú	chat_typerU   r’   Ú	chat_nameÚscope_idr“   r8   r   r   )r   s   "r   r   r   
  sv   € ÷ 'ñ 'Ø	ð'Ø'*ð'Ø58ð'Ø@Cð'ØS`ð'àð'à*ð'à7Dð'ð ð'ð )6ð'ð PTð'ð 
ñ	'r   c               óÔ  € ^ RI Hp ^ RIHp ^ RIHp Rp\        VRR4      pVe‹    V! VP                  4       4      pVep   V'       d   VVP                  8X  d   \        V4      M
\        V4      pT! TTT	TYxTV
'       d   \        V
4      MRR7      pVP                  V4      p\        VRR4      pV! V\        V4      \        W4      RWWR	VR
7      #   \        \        3 d    Rp L©i ; i)a  Create the session row (so the mirror has a target) and mirror the brief as a USER turn.
The seeded key must equal the reply's ``build_session_key``: chat_type, user_id, thread_id and
scope_id (Slack team id) are all part of it, so callers pass exactly what the reply carries.©ÚPlatform)ÚSessionSourcert   NÚ_session_store)r2   r3   r–   r•   rU   r’   rC   r—   Ú
session_idr;   rv   )rw   rC   rU   rx   r�   )Úgateway.configrš   Úgateway.sessionr›   rz   ru   r"   r$   Ú
ValueErrorÚKeyErrorÚDISCORDr   Úget_or_create_sessionrn   )r.   rŠ   rB   r3   rZ   rC   r•   rU   r’   r–   r—   r“   rš   r›   ru   Úseeded_session_idÚsession_storeÚplatform_enumÚseed_chat_idÚdest_sourceÚ_entrys   &&&&&$$$$$$$         r   Ú_seed_cron_sessionrª   
  sù   € õ (Ý-Ý0Ø'+ÐÜ˜GÐ%5°tÓ<€MØÒ ð	!Ù$ ]×%8Ñ%8Ó%:Ó;ˆMð Ò$÷
 *¨m¸x×?OÑ?OÔ.Oô �I”ä˜“\ð ñ
 (Ø&°È	Ø#ØÀ	ß*2œ˜Xœ¸ô	>ˆKð #×8Ñ8¸ÓEˆFÜ '¨°¸dÓ CÐÙØ”s˜7“|Ô%9¸#Ó%DØ yÈØ$ôð øô' œHÐ%ô 	!Ø ŠMð	!ús   §C ÃC'Ã&C'c               ó<   € V ^8„  d   QhRRRRRRRRRRRR	R
RRR	RR/	# )r   r.   r&   rB   r   r3   rC   rq   r–   rD   rT   r8   r—   r   rr   r   )r   s   "r   r   r   4  sa   € ÷ !Fñ !FØ	ð!FØ'*ð!FØ58ð!FØEHð!FØWZð!Fàð!Fà,0ð!FàDQð!Fð 
ñ!Fr   c	                ó  € T;'       g    RP                  4       p	V	'       g   R#  \        YY#T	\        V4      V'       d   RM#\        P	                  VP                  4       R4      RRWhRR7      p
V
'       d+   \        P                  R	V P	                  R
R4      WBV4       R# \        P                  RV P	                  R
R4      W#V4       R#   \         d4   p\        P                  RT P	                  R
R4      Y#YK4        Rp?R# Rp?ii ; i)uÛ  Seed the freshly-opened cron thread's session with the brief (never raises), else the
user's in-thread reply resolves to a transcript without it. Threads are participant-shared
(no real user_id); a DM thread must seed ``chat_type="dm"`` â€” DM-thread replies route through
the DM arm (``â€¦:dm:<chat>:<thread>``), so a "thread"-typed seed is a row no DM reply hits.
Non-DM threads seed the slot the platform's adapter puts on an in-thread reply
(``_THREAD_REPLY_CHAT_TYPE``).r   NÚdmr   zsystem:cronÚCronT)rC   r•   rU   r’   r–   r—   r“   zDJob '%s': opened continuable thread %s on %s:%s and seeded the briefrh   ry   ud   Job '%s': thread seed did NOT land on %s:%s thread=%s â€” an in-thread reply will not see this briefz=Job '%s': seeding cron thread session failed for %s:%s:%s: %s)
r'   rª   r   Ú_THREAD_REPLY_CHAT_TYPEr#   r$   r`   r{   ra   r!   )r.   rŠ   rB   r3   rC   rq   r–   rT   r—   rZ   r}   rb   s   &&&&&&&&&   r   Ú_seed_cron_thread_sessionr°   4  sð   € ð ×Ð˜2×$Ñ$Ó&€DßÙðFÜØ˜-°$Ü˜)“nß#‘dÔ)@×)DÑ)DÀ]×EXÑEXÓEZÐ\dÓ)eØ!¨V¸yØ#'ô)ˆ÷ Ü�K‰KØVØ—‘˜˜cÓ" I¸göGô �N‰Nð:à—‘˜˜cÓ" M¸IöGøô ô Fä�‰ØKØ�G‰G�D˜#Ó ¸	÷	Fò 	FûðFús   ¦A9C Â!(C ÃD	Ã(DÄD	r–   r—   c               ó<   € V ^8„  d   QhRRRRRRRRRRR	R
RR
RR
RR/	# )r   r.   r&   rB   r   r3   rq   rT   r8   rU   rD   r–   r—   r   r   )r   s   "r   r   r   X  sV   € ÷ ñ Ø	ðØ'*ðØ58ðØGJðØVZðàðà'4ðàGTðð 
ñr   c               ó¤  € T;'       g    RP                  4       p	V	'       g   R#  V'       d   RMRp
\        YY#T	RY¦'       d   \        V4      MRWxR7
      pV'       d)   \        P	                  RV P                  RR	4      W#V
4       \        V4      #   \         d4   p\        P                  R
T P                  RR	4      Y#T4        Rp?R# Rp?ii ; i)uÌ  Seed the FLAT (thread_id=None) session for an ``in_channel`` delivery; True on success.
``mirror_to_session`` only APPENDS to an existing session and the flat row is only created by
an inbound human message, so create the row first or the brief is silently dropped. Group keys
are user-isolated (``â€¦:group:<chat_id>:<user_id>``): the seed MUST carry the origin's real
user_id, not ``system:cron``; DM keys omit user_id. chat_type mirrors the inbound handler.r   Fr­   r   N)rC   r•   rU   r–   r—   z@Job '%s': seeded flat in_channel session on %s:%s (chat_type=%s)rh   ry   z9Job '%s': seeding in_channel session failed for %s:%s: %s)	r'   rª   r   r`   r{   r#   r8   r!   ra   )r.   rŠ   rB   r3   rq   rT   rU   r–   r—   rZ   r•   r}   rb   s   &&&&&$$$$    r   Ú_seed_cron_channel_sessionr³   X  sº   € ð ×Ð˜2×$Ñ$Ó&€DßÙðß!‘D wˆ	ÜØ˜-°$ØØ¾¬¨W¬ÀdØô	
ˆ÷ Ü�K‰KØRØ—‘˜˜cÓ" M¸IôGô �B‹xˆøÜô ä�‰ØGØ�G‰G�D˜#Ó ¸ô	;õ ûðús   ¦B ®A"B ÂCÂ(C
Ã
Cc               ó    € V ^8„  d   QhRRRR/# re   r   )r   s   "r   r   r   y  s   € ÷ 4ñ 4 Tð 4¨cñ 4r   c                ó   € V P                  R4      p\        V\        4      '       g   R# . pR	 F|  pVP                  V4      pVf   K  \        V4      P	                  RR4      P	                  RR4      P                  4       pV'       g   K]  VP                  RV RVR,          : 24       K~  	  V'       d   RRP                  V4      ,           # R# )
z¯Secret-free provenance suffix (origin platform/chat/source-IP fields) for security warnings
about a bad stored ``context_from`` reference, where no live request object exists.r1   r   ÚÚ Ú
Úorigin_Ú=:NéÈ   N)r2   r3   rC   Ú	source_ipÚremoteÚforwarded_for)r#   r%   r&   r   Úreplacer'   ÚappendÚjoin)r.   r1   ÚfieldsÚkeyÚvaluerZ   s   &     r   Ú_cron_job_origin_log_suffixrÅ   y  s²   € ð �W‰W�XÓ€FÜ�fœd×#Ò#ÙØ€FÛ[ˆØ—
‘
˜3“ˆØŠ=ÙÜ�5‹z×!Ñ! $¨Ó,×4Ñ4°T¸3Ó?×EÑEÓGˆß‰4Ø�M‰M˜G C 5¨¨$¨t­*©Ð8Ö9ñ \÷ &,ˆ3�—‘˜&Ó!Õ!Ð3°Ð3r   c               ó    € V ^8„  d   QhRRRR/# ©r   rB   r   r   r   )r   s   "r   r   r   Š  s   € ÷ 	ñ 	¨ð 	°ñ 	r   c                óH  € \         P                  ! \        4      ;_uu_ 4        ^ RIHp V! 4        ^ RIHp VP                  V P                  4       4      pV'       d)   VP                  '       d   VP                  uuRRR4       # RRR4       R#   + '       g   i     R# ; i)zXCron home-channel env var registered by a plugin ``PlatformEntry.cron_deliver_env_var``.©Údiscover_plugins©Úplatform_registryNr   )
r   r    r!   Úhermes_cli.pluginsrÊ   Úgateway.platform_registryrÌ   r#   r$   Úcron_deliver_env_var)rB   rÊ   rÌ   Úentrys   &   r   Ú_plugin_cron_env_varrÑ   Š  sm   € ä	×	Ò	œY×	'Õ	'Ý7ÙÔÝ?Ø!×%Ñ% m×&9Ñ&9Ó&;Ó<ˆß�U×/×/Ð/Ø×-Ñ-÷ 
(×	'Ò	'ñ ÷ 
(Ö	'ñ ús   £ABÁ0BÂB!	c               ó    € V ^8„  d   QhRRRR/# ©r   rB   r   r   r8   r   )r   s   "r   r   r   –  s   € ÷ Qñ Q¨sð Q°tñ Qr   c                ól   € V P                  4       pV\        9   ;'       g    \        \        V4      4      # )zRValid cron delivery platform: built-in, or plugin with a ``cron_deliver_env_var``.)r$   Ú_KNOWN_DELIVERY_PLATFORMSr8   rÑ   )rB   rg   s   & r   Ú_is_known_delivery_platformrÖ   –  s/   € à×ÑÓ €DØÔ,Ñ,×PÐP´Ô5IÈ$Ó5OÓ0PÐPr   c               ó    € V ^8„  d   QhRRRR/# rÇ   r   )r   s   "r   r   r   œ  s   € ÷ 7ñ 7¨ð 7°ñ 7r   c                ó4   € \        V P                  4       4      # )zYEnv var name for a platform's cron home channel (``PlatformEntry.cron_deliver_env_var``).)rÑ   r$   )rB   s   &r   Ú_resolve_home_env_varrÙ   œ  s   € ä × 3Ñ 3Ó 5Ó6Ð6r   c               ó   € V ^8„  d   QhRR/# )r   rB   r   r   )r   s   "r   r   r   ¡  s   € ÷ 
ñ 
¨Cñ 
r   c                ó¼   €  ^ RI HpHp V! 4       P                  V! V P	                  4       4      4      #   \
         d    \        P                  RT RR7        R# i ; i)u  Persisted ``HomeChannel`` from gateway config â€” the canonical store ``/sethome`` writes.
The ``<PLATFORM>_HOME_CHANNEL`` env var is only a best-effort mirror; relay-fronted platforms
may exist solely in config.yaml, so reading only the env mirror would drop their delivery.)Úload_gateway_configrš   z1config home_channel lookup failed for platform %rT©Úexc_infoN)rž   rÜ   rš   Úget_home_channelr$   r!   r`   r|   )rB   rÜ   rš   s   &  r   Ú_get_config_home_channelrà   ¡  sX   € ðß@Ù"Ó$×5Ñ5±h¸}×?RÑ?RÓ?TÓ6UÓVÐVøÜô Ü�‰Ø?ÀÐY]ð 	ô 	_âðús   ‚14 ´#AÁAr'   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   Úenv_varr   Úsuffixr'   r8   r   r   )r   s   "r   r   r   ®  s)   € ÷ ñ ˜cð ¨3ð ¸tð ÐPSñ r   c               óÔ   aa€  ^ RI Ho R VV3R llpV! W,           4      p\        P	                  V 4      pV'       g   V'       d   V! WQ,           4      pV#   \         d    Ro L\i ; i)ac  Value of ``<env_var><suffix>``, falling back to the legacy name (same suffix) when unset.
Reads via ``get_secret``, not ``os.getenv``: in a multiplex gateway the tick runs with the
job-owning profile's secret scope (run_one_job sets it), so this resolves the OWNING profile's
value, not the host environ. ``os.getenv`` only if the scope module is missing.)Ú
get_secretNc               ó    € V ^8„  d   QhRRRR/# )r   rg   r   r   r   )r   s   "r   r   Ú&_home_env_lookup.<locals>.__annotate__¸  s   € ÷ 1ñ 1�3ð 1˜3ñ 1r   c                ó”   <€ Se   S! V R4      ;'       g    RM\         P                  ! V R4      pS'       d   VP                  4       # T# )Nr   )ÚosÚgetenvr'   )rg   rÄ   rå   r'   s   & €€r   ÚreadÚ_home_env_lookup.<locals>.read¸  s?   ø€ Ø0:Ò0F‘˜D "Ó%×+Ð+¨øÌBÏIÊIÐVZÐ\^ÓL_ˆß %ˆu�{‰{‹}Ð0¨5Ð0r   )Úagent.secret_scoperå   r!   Ú_LEGACY_HOME_TARGET_ENV_VARSr#   )râ   rã   r'   rë   rÄ   Úlegacyrå   s   &&d   @r   Ú_home_env_lookuprð   ®  s`   ù€ ð
Ý1÷1ñ 1ñ �Õ!Ó"€EÜ)×-Ñ-¨gÓ6€Fß—VÙ�V•_Ó%ˆØ€Løô ô ØŠ
ðús   „A ÁA'Á&A'c               ó    € V ^8„  d   QhRRRR/# rÇ   r   )r   s   "r   r   r   Ã  s   € ÷ 8ñ 8¨Cð 8°Cñ 8r   c                óB   € \        V 4      pV'       d   \        V4      # R# )u9  Home chat id from the env mirror only (no config).

Reads through ``get_secret`` (not raw ``os.getenv``) so a profile-scoped secret scope wins in a
multiplex gateway. ``DISCORD_HOME_CHANNEL`` lives in each profile's ``.env``; in a multiplex process the
winning cron tick runs with the job-owning profile's scope installed (run_one_job sets it), so reading
via ``get_secret`` resolves the OWNING profile's chat id rather than the host process's ``os.environ``
(#83182, chat-id leg â€” the token leg was fixed earlier; chat id / thread id resolve through the same
leak).
r   )rÙ   rð   )rB   râ   s   & r   Ú_env_home_target_chat_idró   Ã  s!   € ô $ MÓ2€Gß(/Ô˜GÓ$Ð7°RÐ7r   c               ó    € V ^8„  d   QhRRRR/# rÇ   r   )r   s   "r   r   r   Ñ  s   € ÷ Jñ J¨Cð J°Cñ Jr   c                óœ   € \        V 4      pV'       d   V# \        V 4      pVe(   VP                  '       d   \        VP                  4      # R# )ut   Home target chat id: env var (first, so operator overrides win) â†’ legacy env var â†’
config.yaml ``home_channel``.r   )ró   rà   r3   r   )rB   rÄ   rI   s   &  r   Ú_get_home_target_chat_idrö   Ñ  sA   € ô % ]Ó3€EßØˆÜ# MÓ2€DØ $Ò 0°T·\·\°\Œ3ˆt�|‰|ÓÐIÀrÐIr   c               ó    € V ^8„  d   QhRRRR/# )r   rB   r   r   rD   r   )r   s   "r   r   r   Û  s   € ÷ ñ ¨cð °mñ r   c                óF  € V P                  4       R8X  d   \        RRR7      pV'       d   V# \        V 4      pV'       d   \        VRRR7      MRpV'       d   V# \        V 4      '       g7   \	        V 4      pVe(   VP
                  '       d   \        VP
                  4      # R# )uH  Optional thread/topic id for a platform home target. Telegram: ``TELEGRAM_CRON_THREAD_ID``
overrides ``TELEGRAM_HOME_CHANNEL_THREAD_ID`` â€” in topic mode a root-DM delivery lands in the
system-only lobby where the user cannot reply.

When topic mode is enabled, deliveries that land in the root DM (thread_id unset) end up in the
system-only lobby where the user cannot reply â€” the gateway returns the lobby reminder and drops
``reply_to_message_id`` (#24409). Pointing cron at a dedicated topic via this env var lets replies work
as expected without changing the lobby invariant.
r   ÚTELEGRAM_CRON_THREAD_IDT)r'   Ú
_THREAD_IDr   N)r$   rð   rÙ   ró   rà   rC   r   )rB   Úcron_threadrâ   rÄ   rI   s   &    r   Ú_get_home_target_thread_idrü   Û  sˆ   € ð ×ÑÓ 
Ô*Ü&Ð'@ÈÔMˆßØÐÜ# MÓ2€GßCJÔ˜W l¸$Õ?ÐPR€EßØˆô $ M×2Ò2Ü'¨Ó6ˆØÒ §§ Ü�t—~‘~Ó&Ð&Ùr   c               #  ó’  a"  € \         P                  ! \        4      ;_uu_ 4        ^ RIHp  V ! 4        ^ RIHp VP                  4        Uu. uF"  q"P                  '       g   K  VP                  NK$  	  upoV3R l\         4        Rj  x€L
  R S 4        Rj  x€L
  RRR4       R# u upi  L$ L  + '       g   i     R# ; i5i)zZIterate plugin platform names that expose a home channel, ``_HOME_TARGET_PRIORITY`` first.rÉ   rË   c              3  ó8   <"  € T F  qS9   g   K  Vx € K  	  R # 5i©Nr   )Ú.0ÚnÚnameds   & €r   Ú	<genexpr>Ú._iter_home_target_platforms.<locals>.<genexpr>ý  s   øé € ÐCÑ4˜!¸U¹
—A’AÓ4ùs   ƒ�
Nc              3  ó>   "  € T F  q\         9  g   K  Vx € K  	  R # 5irÿ   )Ú_HOME_TARGET_PRIORITY)r   r  s   & r   r  r  þ  s   é € ÐG™u˜!Ô1FÑ(F—A’A›uùs   ‚“
)r   r    r!   rÍ   rÊ   rÎ   rÌ   Úplugin_entriesrÏ   rg   r  )rÊ   rÌ   rb   r  s      @r   Ú_iter_home_target_platformsr  ö  sŠ   øé € ä	×	Ò	œY×	'Õ	'Ý7ÙÔÝ?Ø!2×!AÑ!AÔ!CÓ^Ñ!C˜A×G]ÕG]”�—”Ñ!CÑ^ˆÜCÕ4ÓC×CÐCÙG™uÓG×GÐG÷ 
(Ñ	'ùò _ÙCÙG÷ 
(×	'Ð	'üsR   ƒ#C¦&B3ÁB*Á$B*Á4B3Â
B/ÂB3ÂB1ÂB3Â 
CÂ*B3Â1B3Â3C	Â>	Cc               ó    € V ^8„  d   QhRRRR/# )r   Ú	connectedÚsetr   r   )r   s   "r   r   r     s   € ÷ ñ °ð ¸ñ r   c                ó¤   € RV 9  d   \        4       #  ^ RIHp V! 4       #   \         d%    \        P                  RRR7       \        4       u # i ; i)a  Logical platforms deliverable through a connected relay. ``get_connected_platforms()`` only
sees native platforms; fronted ones come from the same ``GATEWAY_RELAY_PLATFORMS`` stamp
fire-time routing uses (validation symmetric with routing). No relay -> empty set.Úrelay©Úrelay_fronted_platformsz$relay fronted-platform lookup failedTrÝ   )r  Úgateway.relayr  r!   r`   r|   )r
  r  s   & r   Ú!_relay_fronted_delivery_platformsr    sK   € ð �iÔÜ‹uˆðÝ9Ù&Ó(Ð(øÜô Ü�‰Ð;ÀdˆÔKÜ‹uŠðús   “   ,AÁAc               ó   € V ^8„  d   QhRR/# )r   r   ú
list[dict]r   )r   s   "r   r   r     s   € ÷ "ñ "˜zñ "r   c                 óØ  € . p  ^ RI Hp V! 4       P                  4        Uu0 uF  q"P                  kK  	  ppV\	        V4      ,          p\        4        Fx  pWC9  g   \        V4      '       g   K  T P                  RTRVP                  RR4      P                  4       R	\        \        V4      4      R
\!        V4      ;'       g    R/4       Kz  	   ^ RIHp V! 4        F)  pV P                  R\&         RV 2RRV R2R	RR
R/4       K+  	  V # u upi   \
         d%    \        P                  RRR7       \        4       p Löi ; i  \
         d    \        P                  RRR7        T # i ; i)a?  Platforms a cron job can auto-deliver to (single source of truth for UIs): valid delivery
platform AND gateway-configured; ``home_target_set`` flags whether the home channel exists.
``{"id", "name", "home_target_set", "home_env_var"}`` dicts in canonical order; callers
prepend the implicit ``local`` option themselves.©rÜ   z1cron_delivery_targets: gateway config unavailableTrÝ   rh   rg   Ú_r·   Úhome_target_setÚhome_env_varN)Úlist_profile_namesÚ:z
Bot Chat (Ú)z2cron_delivery_targets: profile listing unavailable)rž   rÜ   Úget_connected_platformsrÄ   r  r!   r`   r|   r  r  rÖ   rÀ   r¿   Útitler8   rö   rÙ   Úhermes_cli.profilesr  ÚBOT_CHAT_PLATFORM)ÚtargetsrÜ   Úpr
  rg   r  Úprofile_names          r   Úcron_delivery_targetsr#    sk  € ð
 €GðÝ6Ù&9Ó&;×&SÑ&SÔ&UÓVÑ&U —W”WÑ&Uˆ	ÐVØÔ6°yÓAÕAˆ	ô
 ,Ö-ˆØÔ Ô(CÀD×(IÒ(IÙØ�‰Ø�$Ø�D—L‘L  cÓ*×0Ñ0Ó2ØœtÔ$<¸TÓ$BÓCØÔ1°$Ó7×?Ð?¸4ð	Aö 	Bñ .ð	ZÝ:Ù.Ö0ˆLØ�N‰NØÔ*Ð+¨1¨\¨NÐ;Ø˜* \ N°!Ð4Ø! 4Ø ð	&ö 'ñ 1ð €Nùò5 Wøäô Ü�‰ÐHÐSWˆÔXÜ“EŠ	ðûô, ô ZÜ�‰ÐIÐTXˆÕYØ€NðZús3   „D ¡DµD Ã:E ÄD Ä,E Ä?E Å"E)Å(E)c               ó    € V ^8„  d   QhRRRR/# )r   r1   r&   r   r8   r   )r   s   "r   r   r   4  s   € ÷ Lñ L Dð L¨Tñ Lr   c                ó*  € \        V P                  R4      ;'       g    R4      P                  4       R8w  g   V P                  R4      '       g   R# \        R4      p\	        V4      ;'       d'    \        V P                  R4      4      \        V4      8H  # )ao  True when a Slack origin's thread is a stale creation-turn artifact. Thread-per-message
Slack stamps each top-level message id as the session thread (a KEY, not a location); old jobs
carry it as ``origin.thread_id``. Heuristic: if the origin chat IS the Slack home chat, the
pinned thread is that artifact and delivery goes top-level (or to the home target's thread).r2   r   r   rC   Fr3   )r   r#   r$   rö   r8   )r1   Ú	home_chats   & r   Ú_origin_thread_is_staler'  4  so   € ô
 ˆ6�:‰:�jÓ!×'Ð' RÓ(×.Ñ.Ó0°GÔ;À6Ç:Á:Èk×CZÒCZÙÜ(¨Ó1€IÜ�	‹?×KÐKœs 6§:¡:¨iÓ#8Ó9¼SÀ»^ÑKÐKr   c               ó   € V ^8„  d   QhRR/# )r   r1   r&   r   )r   s   "r   r   r   ?  s   € ÷ #ñ # Dñ #r   c                óp   € \        V 4      '       d   \        R4      ;'       g    R# V P                  R4      # )zAThe thread a deliver=origin job should use, stale stamps dropped.r   NrC   )r'  rü   r#   )r1   s   &r   Ú_origin_delivery_threadr*  ?  s/   € ä˜v×&Ò&Ü)¨'Ó2×:Ð:°dÐ:Ø�:‰:�kÓ"Ð"r   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   rB   r   r3   rQ   rD   r   r&   r   )r   s   "r   r   r   F  s)   € ÷ ñ  ð ¨cð À-ð Ð[_ñ r   c                ó@   € RV RVR\        V 4      /pV'       d   W#R&   V# )zTTarget dict for a platform's configured home channel (+ optional mirror provenance).r2   r3   rC   rP   )rü   )rB   r3   rQ   rM   s   &&& r   Ú_home_targetr-  F  s4   € ð 	�MØ�7ØÔ/°Ó>ð@€F÷ Ø#0ÐÑ Ø€Mr   Úfrom_broadcastc               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   r.   r&   Údeliver_valuer   r.  r8   r   r/   r   )r   s   "r   r   r   Q  s8   € ÷ PVñ PVØ	ðPVØ!ðPVØ6:ðPVàñPVr   c               ó,  € \        V 4      pVR8X  d   R# \        V4      pVe   \        W4      # VR8X  dž   V'       d+   RVR,          R\        VR,          4      R\	        V4      RR/# \        4        F[  p\        V4      pV'       g   K  \        P                  RV P                  R	V P                  R
R4      4      V4       \        WVR4      u # 	  R# RV9   Ed   TP                  R^4      w  rWVP                  4       p^ RIHp	Hp
 V	! 4        V
! W‡RR7      w  rkpV'       d   \        P!                  RW4       R# Vf¨   VR8X  d¡   V'       d™   \        VP                  R4      ;'       g    R4      P                  4       V8X  db   \        VP                  R4      4      \        V4      8X  d:   VP                  R4      '       d#   \#        V4      '       g   VP                  R4      pRVRVRVRR/# TpV'       d   RMRpV'       d]   VP                  R4      V8X  dG   \        V4      pV'       d   \        WVV4      # RVR\        VR,          4      RVP                  R4      /# \%        V4      '       g   R# \        V4      pV'       d   \        WVV4      # R# )a~  Resolve one concrete auto-delivery target for a cron job.

``from_broadcast`` marks a bare-platform token that was produced by expanding a broadcast
token (``all``) rather than written by the user; broadcast expansions carry no mirror
provenance (fan-out is never continuable), while a user-written bare platform token is a
deliberate home-channel address and gets the ``home`` tag.ÚlocalNr1   r2   r3   rC   rP   zJJob '%s' has deliver=origin but no origin; falling back to %s home channelrg   rh   ry   rH   r  )Úprepare_send_message_platformsÚresolve_send_targetT)Úpass_unresolved_referencesz%Invalid cron delivery target '%s': %sr   r   rJ   rI   )r5   Úparse_bot_chat_deliver_tokenÚ_resolve_bot_chat_targetr   r*  r  rö   r`   r{   r#   r-  Úsplitr$   Útools.send_message_toolr3  r4  ra   r'  rÖ   )r.   r0  r.  r1   Úbot_chat_profilerB   r3   ÚrestÚplatform_keyr3  r4  rC   Úresolution_errorÚhome_provenances   &&$           r   Ú_resolve_single_delivery_targetr?  Q  se  € ô ˜SÓ!€FØ˜ÔÙä3°MÓBÐØÒ#Ü'¨Ó>Ð>à˜Ô ßà˜F :Õ.Øœ3˜v iÕ0Ó1ØÔ4°VÓ<Ø  (ð	ð ô 9Ö:ˆMÜ.¨}Ó=ˆGß‰wÜ—‘Ø`Ø—G‘G˜F C§G¡G¨D°#Ó$6Ó7¸ôHô $ MÐ<MÓNÒNñ ;ñ à
ˆmÕØ+×1Ñ1°#°qÓ9ÑˆØ$×*Ñ*Ó,ˆß_Ù&Ô(ñ 0CØ¸4ô0AÑ,ˆÐ,çÜ�N‰NÐBÀMÔdÙàÒØ Ô'ßÜ�F—J‘J˜zÓ*×0Ð0¨bÓ1×7Ñ7Ó9¸\ÔIÜ�F—J‘J˜yÓ)Ó*¬c°'«lÔ:Ø—
‘
˜;×'Ò'Ü+¨F×3Ò3àŸ
™
 ;Ó/ˆIà˜Ø�wØ˜Ø˜jð	
ð 	
ð "€Mß,‘d°&€Oß�&—*‘*˜ZÓ(¨MÔ9Ü*¨=Ó9ˆßÜ ¸ÓHÐHð ˜Ø”s˜6 )Õ,Ó-Ø˜Ÿ™ KÓ0ð
ð 	
ô
 ' }×5Ò5ÙÜ& }Ó5€GßDKŒ<˜°Ó@ÐUÐQUÐUr   c               ó   € V ^8„  d   QhRR/# )r   r   Úintr   )r   s   "r   r   r   ¤  s   € ÷ ñ  cñ r   c                 ó¾   €  \         P                  ! 4       p \        V P                  R/ 4      P                  R^<4      4      pV^ 8”  d   V# ^<#   \         d     ^<# i ; i)u?  Wall-clock bound for one standalone-lane send (#115469).

``_send_to_platform``'s gateway-loop dispatch deliberately awaits its future with no
timeout ("the adapter and outer _run_async bound the wait") â€” but on this lane the
outer runner is a bare ``asyncio.run``, not ``model_tools._run_async``, so without a
bound here a reconnecting transport pins the run (and the restart drain behind it)
indefinitely. Mirrors the sibling lanes: live dispatch ``future.result(timeout=60)``,
thread fallback ``result(timeout=30)``. ``cron.standalone_send_timeout_seconds``;
default 60.r;   Ústandalone_send_timeout_seconds)r=   r>   rA  r#   r!   )r7   rÄ   s     r   Ú_get_standalone_send_timeoutrD  ¤  s[   € ðÜ× Ò Ó"ˆÜ�C—G‘G˜F BÓ'×+Ñ+Ð,MÈrÓRÓSˆØ œ	ˆuÐ) rÐ)øÜô Úðús   ‚AA ÁA ÁAÁAc               ó$   € V ^8„  d   QhRRRRRR/# )r   r.   r&   Úcontentr   r   r   )r   s   "r   r   r   ¶  s!   € ÷ ñ ˜$ð ¨ð °ñ r   c           	     ó‚   € \        VR4      p\        V P                  RV P                  RR4      4      R4      pRV RV 2# )aM  The inbound Bot Chat turn text for one cron output.

Outward lane: this text becomes an inbound turn in another profile's Bot Chat through the
live owner's durable admission record, so it gets the same fail-closed scrub as the chat
message and the session mirror; the admitted record carries the scrubbed copy, never the raw
output.
zbot-chat payloadrg   rh   ry   ri   z
[Cronjob "uv   " output â€” scheduled job, not the user. Review it, act on anything that needs action, and summarize for the chat.]

rj   )r.   rF  Újob_names   && r   Úbot_chat_messagerI  ¶  sN   € ô # 7Ð,>Ó?€GÜ# C§G¡G¨F°C·G±G¸DÀ#Ó4FÓ$GÈÓT€Hà
�X�Jð 'à'. ið	1ðr   Úfor_failurec          
     ó,   € V ^8„  d   QhRRRRRRRRRR	/# )
r   r.   r&   rF  r   ÚprofilerJ  r8   r   rD   r   )r   s   "r   r   r   Ç  s?   € ÷ NSñ NS˜dð NS¨Sð NS¸3ð NSØ&*ðNSØ7DñNSr   c          
     óà  € ^ RI p^ RIp^ RIp^ RIHp ^ RIHp ^ RIHp	H	p
H
p V P                  RR4      pT;'       g    Rp\        W4      p V! 4       P                  4       pV'       d	   V! V4      MTP                  4       p^ RIHp ^ R	IHp T;'       d     V! \$        V! VR
,          4      4      '       * pV P                  R4      pV'       g+   V P'                  RVP)                  4       P*                  4      pVP-                  VP/                  \1        V4      V\1        V4      \1        V4      .RR-R7      P3                  R4      4      P5                  4       pV! VV4      pRV 2pVf)   V'       d!   RRRV/V P'                  R/ 4      V&   RV R&   R# Vf-    V
! V4      pTf   RT R2# T	! TTT3RT/T'       d   RR/M/ B pVR ,          V8w  g"   VP                  RR!4      V'       d   RMR!8w  d   \7        R"4      hVR,          pV P'                  R/ 4      pRVRV/VV&   \<        P?                  R#WÍVV4       VR$8X  d   R# VR.9   d   R%M3VP                  R&4      ;'       g    VP                  R'4      ;'       g    R(pV R)V R*V R+V 2#   \6         d7    ^ RIHp T! TYTTR7       RRRT/T P'                  R/ 4      T&   T RT R2u # i ; i  \@         d   pRT R,T 2u Rp?# Rp?ii ; i)/ue  Admit job output to the target profile's authority as a real inbound Bot Chat turn.

None means the target's durable receipt is settled (or a failure notice was recorded as
``suppressed`` â€” a durable disposition, never a send â€” and flagged on the job); anything
else is an explicit unverified status string so Optional[str] callers cannot misreport
admission as delivery. ``profile`` is ``""`` for the job's own profile. There is no
second-writer fallback: a target whose authority is not ready gets the payload parked under
the same delivery id (``cron.bot_chat_legacy.defer``) and admitted by a later tick.
N)Úget_hermes_home)Úget_profile_dir)Údeliver_to_live_ownerÚfind_canonical_live_ownerÚread_delivery_resultrh   ry   ú(own)©Úwarning_notifications_enabled)Úload_user_config_effectivezconfig.yamlÚexecution_idÚ_bot_chat_run_idF)Úensure_asciiÚ
separatorszutf-8ú	bot-chat:ÚstatusÚ
suppressedÚdelivery_idÚ_bot_chat_delivery_receiptsTÚ$_notification_all_targets_suppressed)Údefer©rJ  Úqueuedz queued (receipt z2): target profile not running; admitted once it iszbot-chat delivery to profile 'z#' unverified: no canonical Bot ChatÚnotification_categoryÚ
diagnosticÚmessager‰   z2delivery id already belongs to a different payloadz*Job '%s': Bot Chat %s receipt=%s status=%sÚsettledz$completion unverified; do not resendÚerrorÚreasonznot completedr·   z
 (receipt z): z' unverified: )Ú,r  ©rc  Úclaimed)!ÚhashlibÚjsonÚuuidÚhermes_constantsrN  r  rO  Útools.bot_live_deliveryrP  rQ  rR  r#   rI  ÚresolveÚgateway.warning_notificationsrU  Úhermes_cli.config_effectiverV  ÚBOT_CHAT_POLICY_PLATFORMÚ
setdefaultÚuuid4ÚhexÚsha256Údumpsr   ÚencodeÚ	hexdigestr    Úcron.bot_chat_legacyra  r`   r{   r!   )r.   rF  rL  rJ  rm  rn  ro  rN  rO  rP  rQ  rR  Újob_idÚprofile_labelrf  Úsource_homerI   rU  rV  Úsuppress_notificationÚrun_idrÃ   ÚreceiptrM   Úownerra  r\  ÚreceiptsÚdetailÚexcs   &&&$                          r   Ú_deliver_to_bot_chatrˆ  Ç  s0  € ó ÛÛÝ0Ý3÷ñ ð �W‰W�T˜3Ó€FØ×&Ð&˜w€MÜ˜sÓ,€Gð7SÙ%Ó'×/Ñ/Ó1ˆß,3‘ Ô(¸×MÑMÓOˆÝOÝJØ +÷ !Xð !XÑ4QÜ$Ñ&@ÀÈÕAUÓ&Vó5Xô 1XÐð
 —‘˜Ó(ˆßØ—^‘^Ð$6¸¿
¹
»×8HÑ8HÓIˆFØ�n‰n˜TŸZ™ZÜ�Ó˜v¤s¨6£{´C¸³IÐ>Ø¨:ð (ó 
÷ ‰&�‹/ó÷ %™9›;ð 	ñ
 ' t¨SÓ1ˆØ˜]˜OÐ,ˆØŠ?×4ð
 ˜,¨°sðI<ˆC�N‰NÐ8¸"Ó=¸fÑEà:>ˆCÐ6Ñ7ÙØŠ?ðkÙ1°$Ó7�ð Š}Ø7¸°ÐFiÐjÐjá+¨D°%¸ñ TÈcð Tß>IÐ+¨\Ñ:ÈrñTˆGà�IÕ 'Ô)Ø—;‘;Ð6¸ÓA×VaÁlÐgoÔpÜÐQÓRÐRØ˜Õ"ˆØ—>‘>Ð"?ÀÓDˆØ$ f¨m¸SÐAˆ�ÑÜ�‰Ð@Ø¨3°ô	8à�YÔÙØ<BÐF[Ô<[Ñ8Ø—{‘{ 7Ó+×WÐW¨w¯{©{¸8Ó/D×WÐWÈð 	à�˜˜6˜( *¨S¨E°°V°HÐ=Ð=øô- ô kÝ6Ù�c˜3¨¸;ÕGØMUÐW_ÐanÐpsÐLt�—‘Ð<¸bÓAÀ&ÑIØ ˜Ð!2°3°%Ð7iÐjÒjð	kûô. ô SØ/°¨¸nÈSÈEÐRÕRûðSús�   ÁA	K Â8K ÃB"K Å3K ÆK ÆJ Æ 	K Æ*K Æ;.K Ç*AK É K É#K É<K Ê>KË
K ËKËK ËK-ËK(Ë"K-Ë(K-c               ó   € V ^8„  d   QhRR/# ©r   r   r   r   )r   s   "r   r   r     s   € ÷ 	ñ 	¨ñ 	r   c                ó<  € V e   V R8X  d   R# \        V \        \        34      '       de   V  Uu. uF=  p\        V4      P	                  4       '       g   K$  \        V4      P	                  4       NK?  	  ppV'       d   RP                  V4      # R# \        V 4      # u upi )uí   Normalize ``deliver`` to its canonical comma-separated string; ``"local"`` when falsy.
Lists/tuples (MCP clients, hand-edited jobs.json) are flattened â€” ``str(["telegram"])`` would
yield ``"['telegram']"`` and fail resolution silently.r   r2  rj  )r%   ÚlistÚtupler   r'   rÁ   )Údeliverr!  Úpartss   &  r   Ú_normalize_deliver_valuer�    st   € ð ‚˜' Rœ-ÙÜ�'œD¤%˜=×)Ò)Ù)0ÓC© A´C¸³F·L±L·N””�Q“—‘–©ˆÐCß"'ˆs�x‰x˜‹Ð4¨WÐ4Üˆw‹<Ðùò Ds   ®!BÁBÚallzbot-chatÚtuic               ó    € V ^8„  d   QhRRRR/# )r   Úpartr   r   rD   r   )r   s   "r   r   r   /  s   € ÷ 
ñ 
 sð 
¨}ñ 
r   c                óô   € T ;'       g    RP                  4       pVP                  4       pV\        8X  d   R# \        R,           pVP                  V4      '       d   V\	        V4      R P                  4       # R# )u¬   ``bot-chat[:<name>]`` â†’ ``""`` (own profile), the name, or ``None`` if not a bot-chat
token. Token is case-insensitive; the name is normalized later by the profile layer.r   r  N)r'   r$   r  Ú
startswithÚlen)r”  r*   ÚloweredÚprefixs   &   r   r6  r6  /  sg   € ð �:ˆ:�2×
Ñ
Ó
€CØ�i‰i‹k€GØÔ#Ô#ÙÜ Õ$€FØ×Ñ˜&×!Ò!Ø”3�v“;�<Ð ×&Ñ&Ó(Ð(Ùr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r.   r&   Úprofile_argr   r   r/   r   )r   s   "r   r   r   <  s!   € ÷ ñ  $ð °Sð ¸^ñ r   c                óH  € V'       g   R\         RRRR/#  ^ RIHpHp V! V4      pV! V4      '       g*   \        P                  RV P                  RR	4      V4       R# R\         RVRR/#   \         d.    \        P                  R
T P                  RR	4      TRR7        R# i ; i)u  Resolve a bot-chat token to a delivery target. ``""`` = own profile (no ``-p`` needed);
otherwise the profile must exist locally â€” cross-machine delivery is intentionally unsupported
so same-named profiles on other gateways can never be targeted by accident.r2   r3   r   rC   N)Únormalize_profile_nameÚprofile_existsuV   Job '%s': bot-chat delivery profile '%s' not found on this machine â€” skipping targetrh   ry   z1Job '%s': failed to resolve bot-chat profile '%s'TrÝ   )r  r  r�  rž  r`   ra   r#   r!   )r.   r›  r�  rž  Úcanons   &&   r   r7  r7  <  s­   € ÷ ØÔ-¨y¸"¸kÈ4ÐPÐPðßNÙ& {Ó3ˆÙ˜e×$Ò$Ü�N‰Nð.à—‘˜˜cÓ" Kô1ñ ØÔ-¨y¸%ÀÈdÐSÐSøÜô Ü�‰Ø?ÀÇÁÈÈsÓASÐU`Øð 	ô 	
ò ðús   –A) ´'A) ÁA) Á)4B!Â B!c               ó    € V ^8„  d   QhRRRR/# )r   r”  r   r   z	list[str]r   )r   s   "r   r   r   T  s   € ÷ Uñ U ð U¨ñ Ur   c                óž   € V P                  4       \        9  d   V .# \        4        Uu. uF  p\        V4      '       g   K  VNK  	  up# u upi )zyExpand ``all`` to every home-target platform with a configured chat_id; non-tokens pass
through as a single-element list.)r$   Ú_ROUTING_TOKENSr  rö   )r”  r!  s   & r   Ú_expand_routing_tokensr£  T  sA   € ð ‡z�zƒ|œ?Ô*ØˆvˆÜ2Ô4ÓTÑ4�!Ô8PÐQR×8S�AˆAÑ4ÑTÐTùÒTs   ©A
ÁA
c               ó    € V ^8„  d   QhRRRR/# )r   r.   r&   rJ  r8   r   )r   s   "r   r   r   \  s   € ÷ 'ñ '˜dð '°Dñ 'r   c               ó¢   € V'       d7   V P                  R4      pVe"   \        V4      P                  4       '       d   V# V P                  RR4      # )a  Raw deliver-lane value for a run outcome: the failure lane when ``for_failure`` and the job
overrides it, else ``deliver``. Bookkeeping (outcome classification, unresolved-origin, incident
'alerted' marking) must read the SAME lane the notice was routed through (NS-788).Úfailure_deliverrŽ  r2  )r#   r   r'   )r.   rJ  r¦  s   &$ r   Ú_delivery_lane_valuer§  \  sF   € ÷ ØŸ'™'Ð"3Ó4ˆØÒ&¬3¨Ó+?×+EÑ+E×+GÒ+GØ"Ð"Ø�7‰7�9˜gÓ&Ð&r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r.   r&   rJ  r8   r   r  r   )r   s   "r   r   r   g  s!   € ÷  ñ   4ð  ¸ð  È*ñ  r   c          
     ó  € \        \        WR7      4      pVR8X  d   . # / p. pVP                  R4       EFN  pVP                  4       pV'       g   K  VP	                  4       \
        9   p\        V4       EF	  p\        WVR7      pV'       g   K  VR,          P	                  4       \        VR,          4      VP                  R4      3p	VP                  V	4      p
V
f   WƒV	&   VP                  V4       K€  \        P                  \        VP                  R4      ;'       g    R	4      ^ 4      \        P                  \        V
P                  R4      ;'       g    R	4      ^ 4      8”  g   Kõ  VP                  R4      V
R&   EK  	  EKQ  	  V# )
u¾  Resolve auto-delivery targets from comma-separated ``deliver``; ``all`` expands to every
platform with a home channel and combines with explicit targets. Dedup by (platform, chat_id,
thread_id). ``for_failure=True`` (failure summaries, interrupted-run notices, drift/preflight
alerts) resolves from ``failure_deliver`` INSTEAD when the job carries one â€”
``failure_deliver: local`` is the structural opt-out; absent, failures follow ``deliver``.rb  r2  rj  )r.  r2   r3   rC   rP   r   )r�  r§  r8  r'   r$   r¢  r£  r?  r   r#   rÀ   Ú_MIRROR_PROVENANCE_RANK)r.   rJ  rŽ  Úseenr   r*   r.  r”  rM   rÃ   Úkepts   &$         r   Ú_resolve_delivery_targetsr­  g  sK  € ô 'Ô';¸CÔ'YÓZ€GØ�'ÔØˆ	à€DØ€GØ�}‰}˜S×!ˆØ�i‰i‹kˆßÙØŸ™›¬Ñ7ˆÜ*¨3×/ˆDÜ4°SÈ~Ô^ˆFßÙØ˜*Õ%×+Ñ+Ó-¬s°6¸)Õ3DÓ/EÀvÇzÁzÐR]ÓG^Ð_ˆCØ—8‘8˜C“=ˆDØŠ|Ø"�S‘	Ø—‘˜vÖ&ô (×+Ñ+¬C°·
±
Ð;KÓ0L×0RÐ0RÐPRÓ,SÐUVÓWÜ)×-Ñ-¬c°$·(±(Ð;KÓ2L×2RÐ2RÐPRÓ.SÐUVÓWöXð *0¯©Ð4DÓ)E�Ð%Ô&ô 0ñ "ð( €Nr   c               ó    € V ^8„  d   QhRRRR/# r-   r   )r   s   "r   r   r   Š  s   € ÷ +ñ + $ð +¨>ñ +r   c                ó>   € \        V 4      pV'       d
   V^ ,          # R# )zAResolve the concrete auto-delivery target for a cron job, if any.N)r­  )r.   r   s   & r   Ú_resolve_delivery_targetr°  Š  s   € ä'¨Ó,€Gß ˆ7�1�:Ð* dÐ*r   c          
     ó,   € V ^8„  d   QhRRRRRRRRR	R/# )
r   r3   r   Úmedia_filesrŒ  Úmetadatazdict | Noner.   r&   r   r   )r   s   "r   r   r   •  s4   € ÷ :ñ :Øð:Ø(,ð:Ø8Cð:ØPTð:à	ñ:r   c                óØ  € ^ RI HpHpHp	 ^ RIHp
 RVP                  RR4      /p. pT;'       g    .  UUu. uF  w  rÞ\        V4      V3NK  	  pppVP                  V4      pV UUu0 uF  w  ppVkK
  	  pppV F0  w  pp V	! V4      V9  pV'       g   K  VP                  RV 24       K2  	  Ve   TM\        V RR4      pV EF  w  pp \        P                  ! V4      P                  P                  4       pV! VVVR	7      '       d   R
RppM$V\         9   d   RRppMV\"        9   d   RRppMRRpp\        V V4      ! RRVRV/VV/B pV
! VV4      pVf   \%        VRV R2V4       Vu #  VP'                  \(        P*                  ! 4       R7      pT'       d8   \        TRR4      '       g"   \%        TRT R\        TRR4       2T4       EK  EK  EK  	  V# u uppi u uppi   \         d    Rp ELii ; i  \,         d    TP/                  4        h i ; i  \         dF   p\%        TRT R\        T4      ;'       g    \1        T4      P2                   2T4        Rp?EK¡  Rp?ii ; i)zÉSend MEDIA files as native attachments (routed by extension, as in
_process_message_background). Returns per-file error strings so a dropped attachment surfaces
in run status, not just the gateway log.)ÚBasePlatformAdapterÚshould_send_media_as_audioÚvalidate_media_delivery_pathrƒ   rh   ry   Tz)attachment dropped by media path policy: Nr2   )Úis_voiceÚ
send_voiceÚ
audio_pathÚ
send_videoÚ
video_pathÚsend_image_fileÚ
image_pathÚsend_documentÚ	file_pathr3   r³  zcannot send media z: gateway loop unavailabler…   Úsuccesszmedia send failed for z: rh  Úunknownzfailed to send media r   )Úgateway.platforms.baserµ  r¶  r·  rˆ   r„   r#   r   Úfilter_media_delivery_pathsr!   rÀ   r"   r=   ÚPathrã   r$   Ú_VIDEO_EXTSÚ_IMAGE_EXTSÚ_note_target_errorr‰   Ú_scriptÚ_get_media_send_timeoutÚTimeoutErrorÚcancelÚtypeÚ__name__)rŠ   r3   r²  r³  r‹   r.   r2   rµ  r¶  r·  r„   Újob_refÚerrorsr!  ÚvÚ	requestedr  r¬  Úraw_pathÚ_vÚdroppedÚroute_platformÚ
media_pathÚ	_is_voiceÚextÚmethodÚpath_kwrŽ   r�   r‰   rb   s   &&&&&&&                        r   Ú_send_media_via_adapterrÜ  •  s§  € ÷Wñ Wå:Ø�S—W‘W˜T 3Ó'Ð(€GØ€FØ*5×*;Ð*;¸Ð*;Ô=Ñ*;¡ ”#�a“&˜!“Ñ*;€IÑ=Ø%×AÑAÀ+ÓN€Ká%Ô&™+‘$�!�Q‹A™+€DÑ&Û!‰ˆ�"ð	Ù2°8Ó<ÀDÑHˆG÷ ‰7Ø�M‰MÐEÀhÀZÐPÖQñ "ð "*Ò!5‘X¼7À7ÈJÐX\Ó;]€NÜ!,Ñˆ
�Ið 	eÜ—+’+˜jÓ)×0Ñ0×6Ñ6Ó8ˆCÙ)¨.¸#È	×RÓRØ".°˜�˜ØœÔ#Ø".°˜�˜ØœÔ#Ø"3°\˜�˜à"1°;˜�Ü˜7 FÔ+ñ MØðMØ*2ðMØ7>À
Ð6KñMˆDá-¨d°DÓ9ˆFØŠ~Ü"ØÐ1°*°Ð=WÐXÐZ`ôbà’ðàŸ™¬w×/NÒ/NÓ/P˜ÓQ�÷ œg f¨i¸×>Ò>Ü"ØØ,¨Z¨L¸¼7À6È7ÐT]Ó;^Ð:_Ð`Ø÷ò ?Švñ1 "-ðD €Mùó_ >ùó 'øô ô 	Ø‹Gð	ûô6  ô Ø—‘”Øðûô ô 	eäØÐ0°°¸B¼sÀ1»v×?YÐ?YÌÈaË×IYÑIYÐ>ZÐ[Ð]c÷eó eûð	eúsT   ¶GÁ'GÂG%ÃBHÅ.%G9ÆHÆ1HÇ%G6Ç5G6Ç9HÈHÈI)È$9I$É$I)c               ó   € V ^8„  d   QhRR/# )r   rÃ   r   r   )r   s   "r   r   r   Ò  s   € ÷ .ñ . Cñ .r   c                óh   € \        V \        4      '       d   V P                  W4      # \        WV4      # )zXRead ``key`` from a SendResult-like object or the plain dict the silence filter returns.)r%   r&   r#   r"   )Úsend_resultrÃ   Údefaults   &&&r   Ú_result_fieldrá  Ò  s+   € ä�+œt×$Ò$Ø�‰˜sÓ,Ð,Ü�; WÓ-Ð-r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r~  r   Ú
unverifiedzOptional[list]r   r8   r   )r   s   "r   r   r   Ù  s$   € ÷ $ñ $Øð$Ø0>ð$ØJNñ$r   c                óf  € V f   R# \        V \        4      '       d   RV 9   pM\        V R4      pV'       d   \        \	        V R4      4      '       g   R# \	        V R4      RJ d   R# \	        V R4      f>   \	        V R4      '       g,   \
        P                  RV4       Ve   VP                  R4       R# )u»  Return True only if ``send_result`` unambiguously confirms delivery. ``None`` or no
``success`` attr/key is NOT success (would log "delivered" while nothing was sent).
``delivered is False`` REJECTS even with truthy ``success`` (the silence-narration filter
returns ``{"success": True, "delivered": False}``). No ``message_id``/``raw_response`` is still
accepted (some adapters return a bare success) but logged at WARNING as UNVERIFIED.

A live adapter that returns ``None`` (e.g. a swallowed exception, a busy platform, or a code path that
returns early without producing a ``SendResult``) must NOT be treated as success â€” doing so causes the
scheduler to log ``"delivered to <chat> via live adapter"`` while the gateway never actually sees the
message (#47056).
* No ``message_id`` and no ``raw_response`` means we have no positive evidence of a send. Telegram
``SendResult`` objects carry ``message_id``; the dict-filter shape does not. See #77763.
FrÁ  Ú	deliveredÚ
message_idÚraw_responseu‹   Job '%s': live adapter reported success with no delivery evidence (no message_id, no raw_response) â€” treating as delivered but UNVERIFIEDT)r%   r&   Úhasattrr8   rá  r`   ra   rÀ   )rß  r~  rã  Úhas_successs   &&& r   Ú_confirm_adapter_deliveryrê  Ù  s¢   € ð ÒÙÜ�+œt×$Ò$Ø ;Ñ.‰ä˜k¨9Ó5ˆßœd¤=°¸iÓ#H×IÒIÙÜ�[ +Ó.°%Ó7Ùä�k <Ó0Ò8Ü˜k¨>×:Ò:ä�‰ðð ô		ð
 Ò!Ø×Ñ˜dÔ#Ùr   c          
     ó,   € V ^8„  d   QhRRRRRRRRRR/# )	r   Úruntime_adapterr   r3   r‹   r~  r   r   r8   r   )r   s   "r   r   r      s1   € ÷ #ñ #¨#ð #¸ð #À3ð #ÐPSð #ÐX\ñ #r   c                óô  € \        \        V 4      RR4      p\        V4      '       g   R#  ^ RIHp V! V \        V4      4      pV! Wb4      pVf   R# VP                  ^
R7      p\        T\        4      ;'       d6    \        TP                  R	4      ;'       g    R
4      P                  4       R8H  p	T	'       d   \        P                  RY14       T	#   \         d    \        P                  RY1RR7        R# i ; i)u¢  Is an ambiguous ``telegram:<positive_chat_id>:<numeric_thread_id>`` target a channel
Direct-Messages topic (``direct_messages_topic_id``) rather than a private-chat forum topic
(``message_thread_id``)? Shape cannot decide; signal is ``get_chat_info`` type == ``channel``.
Fails SAFE to False (thread routing) without a probe or on any probe error/timeout.

Callers gate this on the ambiguous shape first (``telegram:<positive_chat_id>:<numeric_thread_id>``) â€”
that shape is identical for both cases, so shape alone cannot decide (this was the #52060 regression).
Probe the live adapter's ``get_chat_info`` once and only return True when the chat is a channel.
See #22773.
Úget_chat_infoNFrƒ   r…   u\   Job '%s': get_chat_info probe failed for chat=%s â€” defaulting to message_thread_id routingTrÝ   rÍ  r   ÚchanneluG   Job '%s': chat=%s is a channel â€” routing via direct_messages_topic_id)r"   rÍ  r‡   rˆ   r„   r   r‰   r!   r`   r|   r%   r&   r#   r$   r{   )
rì  r3   r‹   r~  rî  r„   rŽ   r�   r{   Ú
is_channels
   &&&&      r   Ú_is_channel_dm_topicrñ     sè   € ô œD Ó1°?ÀDÓI€MÜ�M×"Ò"ÙðÝ>Ù˜_¬c°'«lÓ;ˆÙ)¨$Ó5ˆØŠ>Ùà�}‰} Rˆ}Ó(ˆô ˜D¤$Ó'×\Ð\¬C°·±¸Ó0@×0FÐ0FÀBÓ,G×,MÑ,MÓ,OÐS\Ñ,\€JßÜ�‰ØUØô	ð Ðøô ô Ü�‰ð6à dð 	ô 	,ò ðús   «$C ÁC Ã#C7Ã6C7c               ó    € V ^8„  d   QhRRRR/# )r   r7   r/   r   r8   r   )r   s   "r   r   r   &  s   € ÷ ñ  ~ð ¸$ñ r   c                ó  €  T ;'       g    / P                  R4      p\        V\        4      '       d   VP                  R4      MRp\        V\        4      '       * ;'       g    VP                  RR4      RJ#   \         d     R# i ; i)zªResolve ``cron.delivery.notify`` (default True). Only an explicit ``False`` disables; a
missing/malformed section keeps the default so a typo cannot silently mute briefs.r;   ÚdeliveryNÚnotifyTF)r#   r%   r&   r!   )r7   Úcron_cfgÚdelivery_cfgs   &  r   Ú_cron_delivery_notify_enabledrø  &  sv   € ðØ—I�I˜2—?‘? 6Ó*ˆÜ3=¸hÌ×3MÒ3M�x—|‘| JÔ/ÐSWˆÜ˜l¬DÓ1Ô1×bÐb°\×5EÑ5EÀhÐPTÓ5UÐ]bÐ5bÐbøÜô Úðús   ‚A7 ‹AA7 Á"A7 Á7BÂBc               ó$   € V ^8„  d   QhRRRRRR/# )r   r.   r&   Úunverified_targetsrŒ  r   rr   r   )r   s   "r   r   r   1  s&   € ÷ añ a tð aÀð aÈ$ñ ar   c                óX  € \        V4      ;'       g    RpV P                  R/ 4      P                  4        UUu/ uF  w  r4VR,          R	9   g   K  W4bK  	  upp;'       g    RpRVRV/P                  4        UUu/ uF)  w  rgV P                  V4      ;'       g    RV8w  g   K'  WgbK+  	  pppV'       g   R# T P                  V4        ^ RIHp	 V	! V R,          V4       R# u uppi u uppi   \         d2   p
\        P                  RT P                  R4      T
4        Rp
?
R# Rp
?
ii ; i)
zÐPersist ``last_delivery_unverified``: list of ``platform:chat_id[:thread_id]`` targets acked with no
evidence, or None, alongside queued Bot Chat receipts. Never raises (bookkeeping must not fail a
delivery).Nr_  r\  Úlast_delivery_unverifiedÚlast_delivery_queued)Ú
update_jobrh   z4Job '%s': could not record delivery verification: %srk  )	rŒ  r#   ÚitemsÚupdateÚ	cron.jobsrþ  r!   r`   r|   )r.   rú  Ú	new_valuerM   rƒ  rc  rÃ   rÄ   Úvaluesrþ  r‡  s   &&         r   Ú_record_delivery_verificationr  1  s2  € ô Ð'Ó(×0Ð0¨D€Ià�g‰gÐ3°RÓ8×>Ñ>Ô@ô=Ù@ñ #2 &à˜Õ"Ð&;Ñ;ô ˆfŠoÙ@ò=÷ Eð Eà@Dð ð 	# IÐ/EÀvð,ç�eƒgð,ô 2ñ ,™Z˜Sà—'‘'˜#“,×&Ð& $¨5Ñ0ô ˆcŠjñ ,€Fñ 2÷ ÙØ‡J�JˆvÔðaÝ(Ù�3�t•9˜fÖ%ùó=ùó2øô ô aÜ�‰ÐKÈSÏWÉWÐUYË]Ð\_×`Ò`ûðaús5   ¹C!ÁC!Á;C'ÂC'Â$C'Ã	C- Ã-D)Ã8&D$Ä$D)c                  ó6  € ] tR tRt$ RtR]R&   R]R&   R]R&   R]R	&   R
]R&   R]R&   R]R&   R]R&   R]R&   R]R&   R]R&   R]R&   R]R&   R]R&   R
]R&   R]R&   R]R&   R]R&   R]R&   R]R&   R
]R&   RtR]R&   RtR
]R &   ]R! R" l4       t	]R# R$ l4       t
R%tR# )&Ú_TargetDeliveryiF  zJPer-target delivery state shared by the live-adapter and standalone lanes.r&   r.   r   r2   r   rB   r3   rD   rC   Ú	transportr(   rì  Útarget_adaptersÚconfigr‹   r8   Únotify_deliveryr1   Úorigin_targetÚorigin_user_idÚis_dm_targetrq   Úmirror_this_targetÚin_channel_surfaceÚinchannel_continuableÚopened_thread_idFÚlive_adapter_readyNÚ
live_errorc               ó   € V ^8„  d   QhRR/# )r   r   r8   r   )r   s   "r   r   Ú_TargetDelivery.__annotate__c  s   € ÷ Fñ F˜$ñ Fr   c                	óZ   € V P                   R J;'       d    V P                   P                  # rÿ   )r  Úis_relay)Úselfs   &r   r  Ú_TargetDelivery.is_relayb  s#   € à�~‰~ TÐ)×EÐE¨d¯n©n×.EÑ.EÐEr   c               ó   € V ^8„  d   QhRR/# rŠ  r   )r   s   "r   r   r  g  s   € ÷ Fñ F�sñ Fr   c                	ó‚   € V P                    R V P                   2pV P                  '       d   V R V P                   2# T# )r  )rB   r3   rC   )r  Úbases   & r   ÚwhereÚ_TargetDelivery.wheref  sB   € ð ×$Ñ$Ð% Q t§|¡| nÐ5ˆØ-1¯^¯^¨^�$��q˜Ÿ™Ð(Ð)ÐEÀÐEr   r   )rÎ  Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__annotations__r  r  Úpropertyr  r  Ú__static_attributes__r   r   r   r  r  F  sº   ‡ áTà	ƒIØƒMØÓØƒLØÓØƒNØƒLØÓØÓØƒKØ
ƒIØÓØƒLØÓØ!Ó!ØÓØÓØÓØÓØÓØ#Ó#Ø$Ð˜Ó$Ø $€J�Ó$àôFó ðFð ôFó ôFr   r  c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   r.   r&   Úmsgr   rÐ  rŒ  r   rr   r   )r   s   "r   r   r   m  s(   € ÷ ñ ˜Dð  sð °Dð ¸Tñ r   c                ód   € \         P                  RV R,          V4       VP                  V4       R# )zKLog a per-target delivery failure as a WARNING and record it in ``errors``.úJob '%s': %srh   N)r`   ra   rÀ   )r.   r'  rÐ  s   &&&r   rÈ  rÈ  m  s"   € ä
‡N�N�> 3 t¥9¨cÔ2Ø
‡M�M�#Ör   c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   r.   r&   r'  r   r  r8   r   rr   r   )r   s   "r   r   r   s  s.   € ÷ Sñ S ð S¨Cð S¸4ð SÀDñ Sr   c                ó’   € V'       d!   \         P                  RV R,          V4       R# \         P                  RV R,          V4       R# )zPRelay targets have no standalone fallback, so the log line must not promise one.r)  rh   ú(Job '%s': %s, falling back to standaloneN©r`   ra   )r.   r'  r  s   &&&r   Ú_warn_live_lane_failurer.  s  s.   € çÜ�‰�~ s¨4¥y°#Ö6ä�‰ÐAÀ3ÀtÅ9ÈcÖRr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r.   r&   rB   r   rM   r   )r   s   "r   r   r   {  s)   € ÷ 6Hñ 6HØ	ð6HØ(+ð6HØ59ñ6Hr   c                óŽ  € ^ RI HpHp TpRp	\        V\        P
                  4      '       dd   VP                  W4      p
V
e   W/M/ pV
eF   ^ RIHp ^ RI	H
p VP                  P                  V4      pT! Y­e   V! VRR7      MV! RR7      V4      p	V	f
   V! WV4      p	V	e   V	P                  pV	P                  pM7^ RIHp VV! 4       9   d	   RRV R	23# VP                  P                  V4      pRpV	e+   V	P                   '       g   Vf   Vf   ^ RI	H
p V! RR7      pM"V'       d   VP"                  '       g	   RRV R
23# WžWø3R3# )zÃResolve ``(transport, pconfig, runtime_adapter, target_adapters)`` for one target, or
``(None, error)`` when it cannot be served (relay-fronted with no live transport, or not
configured/enabled).)ÚDeliveryTransportÚresolve_delivery_transportN)r¿   )ÚPlatformConfigT)ro   r  z
platform 'z’' is relay-fronted and has no live gateway transport; start the gateway (its ticker owns relay-fronted delivery and will fire the job on schedule)z' not configured/enabled)Úgateway.deliveryr1  r2  r%   Ú
_preflightÚSharedRouteAdaptersr#   Údataclassesr¿   rž   r3  Ú	platformsr	  rŠ   r  r  r  ro   )r.   r2   rB   rM   Úadaptersr	  r1  r2  r  r  Úsharedr¿   r3  Úownr(   rì  r  s   &&&&&&           r   Ú_resolve_target_transportr<  {  sa  € ÷
 OØ€OØ€IÜ�(œJ×:Ñ:×;Ò;ð —‘˜hÓ/ˆØ06Ò0B˜8Ñ,ÈˆØÒõ
 ,Ý5Ø×"Ñ"×&Ñ& xÓ0ˆCÙ)Ø²o™ ¨TÕ2É>ÐbfÔKgØóˆIð ÒÙ.¨xÀÓQˆ	ØÒØ×"Ñ"ˆØ#×+Ñ+‰õ 	:ØÑ3Ó5Ô5ØØ˜]˜Oð ,ð ðð ð ×"Ñ"×&Ñ& xÓ0ˆØˆàÒ )×"4×"4Ð"4¸ºð
 Š?Ý5Ù$¨TÔ2ˆGøß˜GŸOŸO˜OØ�z - Ð0HÐIÐIÐIØ ÐAÀ4ÐGÐGr   c               ó    € V ^8„  d   QhRRRR/# rÓ   r   )r   s   "r   r   r   ´  s   € ÷ Sñ SÀð SÈñ Sr   c                ó²   € \        V RR4      p\        V4      '       d    \        V! V4      4      # \        \        V RR4      4      #   \         d     R# i ; i)zùD6 probe: can this adapter deliver a continuable in_channel brief on ``platform_name``?
Per-platform check first (one RelayAdapter fronts N platforms; the scalar attr only carries
the PRIMARY identity's bit); native adapters use the class attribute.Ú+supports_inchannel_continuable_for_platformNFÚsupports_inchannel_continuable)r"   r‡   r8   r!   )rì  rB   Úper_platform_checks   && r   Ú_inchannel_surface_supportedrB  ´  se   € ô !ØÐFÈóNÐäÐ"×#Ò#ð	ÜÑ*¨=Ó9Ó:Ð:ô ”˜Ð)IÈ5ÓQÓRÐRøô ô 	Úð	ús    A ÁAÁAc               ó    € V ^8„  d   QhRRRR/# )r   Útr  r   z tuple[Optional[str], dict, dict]r   )r   s   "r   r   r   Â  s   € ÷ *;ñ *;˜Oð *;Ð0Pñ *;r   c                óà  € ^ RI Hp ^ RIHpHp V P
                  pV P                  pV P                  VP                  8H  ;'       dA    VRJ;'       d5    V! \        V P                  4      4      ;'       d    V! \        V4      4      pV'       dx   \        V P                  V P                  V P                  VR,          4      '       d?   RpR\        V4      RVR,          RV P                  /pR\        V4      RV P                  /p	MNVe   \        V4      MRpRVR,          RV P                  /pV'       d   WxR&   RV P                  /p	V'       d   WYR&   \        P                   ! WV	4       WxV	3# )	uj  Compute ``(route_thread_id, route_metadata, media_metadata)`` for a live send, ONCE so text
and media agree. ``telegram:<positive_chat_id>:<numeric_thread_id>`` is ambiguous (private
forum topic vs channel DM topic need OPPOSITE routing) â€” see ``_is_channel_dm_topic``.
``thread_id`` rides in ``route_metadata`` to bypass the router's private-chat anchor rule.r™   )Ú_looks_like_intÚ#looks_like_telegram_private_chat_idNrh   Údirect_messages_topic_idr~  rõ  rC   )rž   rš   r4  rF  rG  r.   rC   r2   ÚTELEGRAMr   r3   rñ  rì  r‹   r
  Ú_originÚstamp_origin_discriminators)
rD  rš   rF  rG  r.   rC   Úis_ambiguous_telegram_topicÚroute_thread_idÚroute_metadataÚmedia_metadatas
   &         r   Ú_live_route_metadatarP  Â  sV  € õ
 (ßUØ
�%‰%€CØ—‘€Ià	�
‰
�h×'Ñ'Ñ'÷ 	,ð 	,Ø˜TÐ!÷	,ð 	,á/´°A·I±I³Ó?÷	,ð 	,ñ œC 	›NÓ+ð	  ÷ #Ô';Ø	×Ñ˜1Ÿ9™9 a§f¡f¨c°$­i÷(9ò (9ð ˆà&¬¨I«¸À#ÀdÅ)Ø�a×'Ñ'ð
ˆð 5´c¸)³nÀhÐPQ×PaÑPaÐb‰ð -6Ò,Aœ#˜iœ.ÀtˆØ" C¨¥I¨x¸×9JÑ9JÐKˆßØ*9˜;Ñ'Ø" A×$5Ñ$5Ð6ˆßØ*3˜;Ñ'ô ×'Ò'¨¸>ÔJØ¨NÐ:Ð:r   c               ó8   € V ^8„  d   QhRRRRRRRRR	R
RR
RR
RR/# )r   rD  r  Útext_to_sendr   rM  rD   rN  r&   Útarget_errorsrŒ  Údelivery_errorsrú  r   ztuple[bool, bool, Any]r   )r   s   "r   r   r   ò  sX   € ÷ c-ñ c-Øðc-Ø&)ðc-Ø<Iðc-Ø[_ðc-àðc-à*.ðc-àDHðc-ð ñc-r   c               ó  a aaaaaa€ ^ RI Hp ^ RIHpHp	Hp
 S P                  pV! S P                  S P                  4      oV	! S P                  \        S P                  4      VRR7      o\        P                  ! 4       oRRRR/oVVVVVV V3R lpV! V! 4       S P                  4      pVf   VP                  R
4       R(#  VP!                  \"        R7      p\;        TR4      p\;        TR4      p. p\=        YëR,          T4      pT'       d$   T'       d   TP                  S P(                  4       T'       gÒ   Tf   RRppMo\?        T\@        4      '       d8   TP5                  R4      ;'       g    TP5                  R4      ;'       g    RpRpM"\1        TRR	4      \C        T4      PD                  ppRS P(                   R T R!T R"2pT'       d   \        T4      MR	S n        \G        Y¿S PH                  4       TP                  T4       R(# T'       dm   S PJ                  '       d[   TP5                  R#4      '       dD   TP5                  R$4      ;'       g    S PJ                  p\3        TR%T R&S P(                   R'2T4       RRT3#   \$         dÓ    S;_uu_ 4        SR,          '       * SR&   R	R	R	4       M  + '       g   i     M; iSR,          '       dT   TP'                  4        RS P(                   R2p\*        P-                  RTR,          T4       TP                  T4       R(u # \*        P-                  RTR,          S P.                  S P                  4       R)u # T
 dq   p\1        TP                   RR	4      ;'       g    / p\3        TRS P(                   RTP5                  RR4       RTP5                  RR4       RT 2T4       R*u R	p?# R	p?i\6         d+   p\        T4      S n        TP                  RT 24       h R	p?ii ; i)+z£Schedule the text send on the gateway loop; returns ``(adapter_ok, timed_out, message_id)``.
Re-raises a real send error so the caller falls through to standalone.rƒ   )ÚDeliveryRouterÚDeliveryTargetÚPartialDeliveryErrorT)r2   r3   rC   Úis_explicitÚstartedFÚ	abandonedc               “  óè   <"  € S;_uu_ 4        S R ,          '       d    RRR4       R# RS R&   RRR4       SP                  SSSSP                  R7      G Rj  x€L
 #   + '       g   i     L7; i L5i)r[  NTrZ  )r  )Ú_deliver_to_platformr  )ÚdispatchÚdispatch_lockrN  Úroute_targetÚrouterrD  rR  s   €€€€€€€r   Ú
_send_onceÚ#_live_send_text.<locals>._send_once	  se   øé € ßŠ]Ø˜×$Ô$Ø÷ ‰]ð #'ˆH�YÑ÷ ð ×0Ñ0°¸|È^Ðgh×grÑgrÐ0Ós×sÐs÷	 �]úñ tùs1   ƒA2ŽAŸ
A2©A®*A2ÁA0ÁA2ÁA-	Á(	A2Nz)live adapter event loop scheduling failedr…   zlive adapter send to z. timed out before the coroutine was dispatchedr,  rh   zžJob '%s': live adapter send to %s:%s timed out after 60s; already dispatched (in flight), assuming delivered (skipping standalone fallback to avoid duplicate)rç  z delivered Údelivered_chunksry   z of Útotal_chunksz chunks, then failed: zlive adapter send failed: ræ  zno response from adapterrr   rh  ÚfilteredrÂ  r&   z returned unconfirmed result (z, error=r  Úthread_fallbackÚrequested_thread_idzconfigured thread_id z for z+ was not found; delivered without thread_id)FFN)TTN)TFN)&rˆ   r„   r4  rV  rW  rX  r.   r	  r  r2   r   r3   Ú	threadingÚLockr‹   rÀ   r‰   Ú_LIVE_SEND_CONFIRM_TIMEOUT_SECSrË  rÌ  r  r`   ra   rB   r"   rÈ  r#   r!   r  rá  rê  r%   r&   rÍ  rÎ  r.  r  rC   )rD  rR  rM  rN  rS  rT  rú  r„   rV  rW  rX  r.   rb  r�   rß  r'  Úexr*   Úsend_raw_responseÚdelivered_message_idÚ_evidence_gapÚsend_successÚerrÚshaperh  r^  r_  r`  ra  s   ff&f$$$                  @@@@r   Ú_live_send_textrs  ò  s–  þ€ õ ;ßUÑUØ
�%‰%€CÙ˜AŸH™H a×&7Ñ&7Ó8€FÙ!Ø—‘¤S¨¯©£^¸Ð\`ôb€Lô —N’NÓ$€MØ˜5 +¨uÐ5€H÷tó tñ &¡j£l°A·F±FÓ;€FØ‚~Ø×ÑÐHÔIØ!Ð!ð!Ø—m‘mÔ,K�mÓLˆôH & k°>ÓBÐÜ(¨°lÓCÐØ€MÜ,¨[¸d½)À]ÓS€LßŸØ×!Ñ! !§'¡'Ô*çØÒØ3°V�ˆC�Ü˜¤T×*Ò*à—/‘/ 'Ó*×VÐV¨k¯o©o¸jÓ.I×VÐVÈYˆCØ‰Eä  ¨g°tÓ<¼dÀ;Ó>O×>XÑ>X�ˆCØ% a§g¡g YÐ.LÈUÈGÐS[Ð\_Ð[`Ð`aÐbˆß#&”s˜3”x¨DˆŒÜ ¨!¯*©*Ô5Ø×Ñ˜SÔ!Ø!Ð!ß˜QŸ[Ÿ[˜[Ð->×-BÑ-BÐCT×-UÒ-UØ/×3Ñ3Ð4IÓJ×YÐYÈaÏkÉkÐÜØØ#Ð$7Ð#8¸Ø�w‰wˆiÐBðDàô		ð
 �Ð,Ð,Ð,øô ô  ÷ Š]Ø(0°Õ(;Ô$;ˆH�[Ñ!÷ �]�]ˆ]úà�K× Ô Ø�M‰MŒOØ)¨!¯'©'¨Ð2`ÐaˆCÜ�N‰NÐEÀsÈ4ÅyÐRUÔVØ× Ñ  Ô%Ø%Ò%Ü�‰ð"ð ��I�q—‘¨¯	©	ô	3ð  ÒØô !ä�b—i‘i °Ó6×<Ð<¸"ˆÜØÐ(¨¯©¨	°¸S¿W¹WÐEWÐY\Ó=]Ð<^Ð^bØ�w‰w�~ sÓ+Ð,Ð,BÀ2À$ðHØIXô	Zð !Õ ûÜô ô ˜2“wˆŒØ×ÑÐ9¸"¸Ð>Ô?Øûðúsb   ÃJ ÊPÊJ1Ê(	PÊ1KÊ<PËAPÌ&5PÍPÍ"PÍ#A%OÏPÏPÏPÏ%PÐPc          
     ó,   € V ^8„  d   QhRRRRRRRRRR	/# )
r   rD  r  rO  r&   r²  rŒ  rT  r   rr   r   )r   s   "r   r   r   X  s4   € ÷ <ñ <Øð<Ø(,ð<Ø;?ð<ØRVð<Ø[_ñ<r   c           
     ó€  € \        T;'       g    / 4      pV P                  '       d    V P                  P                  VR&   V P                  P                  V P                  4      pVe^   VP                  V P                  8X  dC   VP                  '       d   VP                  VR&   VP                  '       d   VP                  VR&   \        V P                  V P                  Y$;'       g    RV P                  V P                  V P                  R7      pV F$  pVP                  V RV P                   R24       K&  	  R# )zRSend extracted media as native attachments with the same routing as the text send.Ú_relay_logical_platformNrU   r—   )r2   ú	 (target r  )r&   r  r2   rÄ   r	  rß   r3   rU   r—   rÜ  rì  r‹   r.   rÀ   r  )rD  rO  r²  rT  Úrouted_media_metadataÚlogical_homeÚ_media_errorsÚ_mes   &&&&    r   Ú_live_send_mediar|  X  s  € ô ! ×!5Ð!5°2Ó6ÐØ‡z‡z€zØ;<¿:¹:×;KÑ;KÐÐ7Ñ8Ø—x‘x×0Ñ0°·±Ó<ˆØÒ#¨×(<Ñ(<ÀÇ	Á	Ô(IØ×#×#Ð#Ø3?×3GÑ3GÐ% iÑ0Ø×$×$Ð$Ø4@×4IÑ4IÐ% jÑ1Ü+Ø	×Ñ˜1Ÿ9™9 k×3PÐ3PÈDÐRS×RXÑRXÐZ[×Z_ÑZ_Ø—‘ô€Mó
 ˆØ×Ñ #  i°·±¨y¸Ð:Ö;ó r   c               ó    € V ^8„  d   QhRRRR/# )r   rD  r  r   rr   r   )r   s   "r   r   r   m  s   € ÷ .Uñ .U Oð .UÈdñ .Ur   c                ó"  € V P                   pV P                  p\        VP                  R4      V P                  VP                  R4      R7      pRpRpV P
                  '       dE   \        W P                  V P                  V P                  V P
                  V P                  3/ VB  RpV P                  '       dã   V P                  '       dÑ   V'       gÉ   \        W P                  V P                  V P                  V P                  3RV P                  /VB pV'       g4   \        P!                  RVR,          V P                  V P                  4       V'       dB   \        W P                  V P                  V P                  \#        V4      V P                  3/ VB  M‡V P                  '       dv   V P                  '       gd   \        P!                  R	VR,          V P                  V P                  VP                  R
4      VP                  R4      VP                  R4      4       \%        Y P                  V P                  V P                  V P&                  V P                  V P(                  ;'       d    V'       * ;'       d    V'       * R7       R# )z±After a confirmed live send, seed continuation session(s) and run the generic mirror.
Thread seeding is deferred here so open-succeeds/deliver-fails never seeds an unseen brief.r–   r—   )r–   rT   r—   FTrU   uY   Job '%s': in_channel seed did NOT land on %s:%s â€” a plain reply will not see this briefrh   uö   Job '%s': in_channel delivery to %s:%s is not a continuable target (origin=%s:%s thread=%s; not the origin conversation, and not a mirror-eligible fallback/opted-in target the seed can key) â€” seed skipped; the plain mirror below may still applyr2   r3   rC   ©rC   rU   ro   N)r.   r1   r&   r#   r  r  r°   rì  rB   r3   rq   r  r  r³   r  r`   ra   r   r~   rC   r  )rD  rn  r.   r1   Úseed_kwargsÚthread_seededÚinchannel_seededs   &&     r   Ú_seed_live_delivery_sessionsrƒ  m  sþ  € ð �%‰%€CØ�X‰X€FÜØ—*‘*˜[Ó)°·±È&Ï*É*ÐU_ÓJ`ôb€Kà€MØÐØ××ÐÜ!Ø×"Ñ" A§O¡O°Q·Y±YÀ×@RÑ@RÐTU×TaÑTañ	
àò	
ð ˆð 	××Ð × 7× 7Ð 7ÇÜ5Ø×"Ñ" A§O¡O°Q·Y±YÀÇÁñ5à×$Ñ$ð5à(3ñ5Ð÷  Ü�N‰Nð<à�D•	˜1Ÿ?™?¨A¯I©Iô7÷  Ü%Ø×&Ñ&¨¯©¸¿¹ÄCÐH\ÓD]Ø—‘ñð òøð 
×	×	Ð	 a×&=×&=Ð&=Ü�‰ð>ð
 ��I�q—‘¨¯	©	Ø�J‰J�zÓ" F§J¡J¨yÓ$9¸6¿:¹:ÀkÓ;Rô	Tô  Ø�_‰_˜aŸi™i¨¯©À!Ç+Á+Ø× Ñ Ø×$Ñ$×SÐS¨]Ô):×SÐSÐCSÔ?S÷Ur   c               ó4   € V ^8„  d   QhRRRRRRRRRRR	RR
R/# )r   rD  r  Úcleaned_textr   r²  rŒ  rS  rT  rú  r   r8   r   )r   s   "r   r   r   ž  sF   € ÷ >ñ >Øð>Ø&)ð>Ø8<ð>ØPTð>àð>à/3ð>ð 
ñ>r   c          
     ó‚  a€ V P                   p\        V 4      w  rxp	Rp
 VP                  4       pRRRrípV'       g&   V'       g   \        VRV P                   2V4       RpMV'       d   \        WWxW4VR7      w  rÍpV'       d   V'       g   V'       d   \        W	W$4       M6V'       d/   V'       d'   \        V\        V4       RV P                   R2V4       V'       dO   \        P                  RVR	,          V P                  V P                  Ve   TMR
Ve   TMR
4       Rp
\        W4       V
#   \         d†   pRT P                   RT 2o\        ;QJ d    T3R lT 4       F  '       g   K   RM	  RM! T3R lT 4       4      '       g   TP                  S4       \!        TST P"                  4        Rp?T
# Rp?ii ; i)zûDeliver one target via the live gateway adapter; True once delivered. ``target_errors`` =
this lane's soft failures (surfaced only if standalone also fails); ``delivery_errors`` =
partial failures (media, thread fallback) that surface even on success.FTNz8live adapter send skipped (empty text and no media) for ©rS  rT  rú  z& media attachment(s) not delivered to z& (live adapter confirmation timed out)zEJob '%s': delivered to %s:%s via live adapter thread=%s message_id=%srh   Ú-zlive adapter delivery to ú	 failed: c              3  ó.   <"  € T F
  pSV9   x € K  	  R # 5irÿ   r   )r   rq  Úerr_msgs   & €r   r  Ú,_deliver_via_live_adapter.<locals>.<genexpr>Ù  s   øé € Ð;©] c�7˜c–>«]ùs   ƒ)r.   rP  r'   rÈ  r  rs  r|  r—  r`   r{   rB   r3   rƒ  r!   ÚanyrÀ   r.  r  )rD  r…  r²  rS  rT  rú  r.   rM  rN  rO  rå  rR  Ú
adapter_okÚ	timed_outrn  rb   r‹  s   &&&$$$          @r   Ú_deliver_via_live_adapterr�  ž  s™  ø€ ð �%‰%€CÜ6JÈ1Ó6MÑ3€O ^Ø€Ið3:ð $×)Ñ)Ó+ˆØ6:¸EÀ4Ð3ˆ
ß§KäØÐOÐPQ×PWÑPWÈyÐYØôð ‰JßÜ:IØ Ø+Ø#5ô;Ñ7ˆJÐ#7÷ Ÿi¯KÜ˜Q°ÕMßŸ;ÜØÜ�{Ó#Ð$Ð$JØ—7‘7�)ÐAðCàô	!÷ ä�K‰Kð XØ�D•	˜1Ÿ?™?¨A¯I©IØ#2Ò#>‘ÀCØ(<Ò(HÑ$ÈcôSð ˆIÜ(¨ÔAð Ðøô ô :Ø-¨a¯g©g¨Y°iÀ¸sÐCˆß‹sÔ;©]Ó;�s�sŠsÔ;©]Ó;×;Ò;Ø× Ñ  Ô)Ü  W¨a¯j©j×9Ð9ØÐûð:úsT   Ÿ$D. Á$D. Á)D. ÂD. ÂD. ÂD. Â(D. Â0-D. ÃAD. Ä.F>Ä91F9Å-F9Æ(F9Æ9F>c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   rD  r  rF  r   r²  rŒ  r   ztuple[Any, Optional[str]]r   )r   s   "r   r   r   ß  s2   € ÷ @ñ @Øð@Ø!$ð@Ø37ð@Ø<Uñ@r   c                óÎ  a aaaaa€ ^ RI Ho S P                  oRS P                   R2p\	        4       oVVVVV 3R lpR V3R llpR VV 3R llp\
        P                  ! 4       '       d	   V! V4      # SP                  4       '       g   S'       g   V! R	S P                   24      # V! 4       p \        P                  ! V4      R
3#   \         d9    RS P                   RS R2p\        P                  RSR,          T4       R
T3u # \         Ed7   p	TP                  4        \
        P                  ! T	4      '       d   T! T4      u R
p	?	#  \        P                   P#                  ^R7      p
 T
P%                  \&        P(                  ! 4       P                  \        P                  T! 4       4      P+                  ^R7      R
3T
P-                  RR7       u R
p	?	#   T
P-                  RR7       i ; i  \.         dF   p\
        P                  ! T4      '       d   T! T4      u R
p?u R
p	?	# T! T4      u R
p?u R
p	?	# R
p?ii ; iR
p	?	i\.         d   pT! T4      u R
p?# R
p?ii ; i)u£   Run the standalone sender for one target: ``(result, None)`` or ``(None, error)`` (already
logged â€” WARNING for a shutdown race, ERROR with traceback otherwise).)Ú_send_to_platformúdelivery to u)    skipped â€” interpreter is shutting downc               “  ó¸   <"  € \         P                  ! S ! SP                  SP                  SP                  SSP
                  SR 7      SR7      G Rj  x€L
 #  L5i))rC   r²  r…   N)ÚasyncioÚwait_forr2   r(   r3   rC   )r“  rF  r²  Úsend_timeoutrD  s   €€€€€r   Ú_sendÚ_standalone_send.<locals>._sendé  sN   øé € ô ×%Ò%Ñ&7Ø�J‰J˜Ÿ	™	 1§9¡9¨gÀÇÁØ#ô'%à.:ô<÷ <ð 	<ñ <ùs   ƒAAÁAÁAc               ó    € V ^8„  d   QhRRRR/# )r   r'  r   r   útuple[None, str]r   )r   s   "r   r   Ú&_standalone_send.<locals>.__annotate__ð  s   € ÷ ñ �Sð Ð-ñ r   c                óH   <€ \         P                  R SR,          V 4       RV 3# )r)  rh   Nr-  )r'  r.   s   &€r   Ú_warnedÚ!_standalone_send.<locals>._warnedð  s!   ø€ Ü�‰�~ s¨4¥y°#Ô6Ø�SˆyÐr   c               ó   € V ^8„  d   QhRR/# )r   r   rœ  r   )r   s   "r   r   r�  ô  s   € ÷ ñ Ð&ñ r   c                óp   <€ R SP                    RV  2p\        P                  RSR,          VRR7       RV3# )r”  r‰  r)  rh   TrÝ   N)r  r`   rh  )rb   r'  r.   rD  s   & €€r   Ú_failedÚ!_standalone_send.<locals>._failedô  s;   ø€ Ø˜QŸW™W˜I Y¨q¨cÐ2ˆÜ�‰�^ S¨¥Y°¸dˆÔCØ�SˆyÐr   z6standalone send skipped (empty text and no media) for Nzstandalone send to z timed out after z#s (the send may still be in flight)r)  rh   )Úmax_workersr…   F)Úwait)r9  r“  r.   r  rD  r=   Ú_interpreter_shutting_downr'   r–  ÚrunrË  r`   rh  ÚRuntimeErrorÚcloseÚ
concurrentÚfuturesÚThreadPoolExecutorÚsubmitÚcontextvarsÚcopy_contextr‰   Úshutdownr!   )rD  rF  r²  Úshutdown_msgr™  rŸ  r£  rŽ   r'  Úrun_errÚpoolrb   r“  r.   r˜  s   fff         @@@r   Ú_standalone_sendrµ  ß  s  ý€ õ :Ø
�%‰%€CØ! !§'¡' Ð*SÐT€Lä/Ó1€L÷<ñ <÷ð ÷ñ ô ×(Ò(×*Ò*Ù�|Ó$Ð$ð �=‰=�?Š?§;ÙÐOÐPQ×PWÑPWÈyÐYÓZÐZÙ‹7€DðÜ�{Š{˜4Ó  $Ð&Ð&øÜô ð % Q§W¡W IÐ->¸|¸nð M3ð 3ˆä�‰�^ S¨¥Y°Ô4Ø�SˆyÒÜõ à�
‰
ŒÜ×,Ò,¨W×5Ò5Ù˜<Ó(Õ(ð	Ü×%Ñ%×8Ñ8ÀQÐ8ÓGˆDð*ð —{‘{¤;×#;Ò#;Ó#=×#AÑ#AÄ7Ç;Á;ÑPUÓPWÓX×_Ñ_Øð `ó  Ø!%ð&ð —‘ 5�×)Ò)ø�—‘ 5�Õ)ûÜô 	Ü×0Ò0°×3Ò3Ù˜|Ó,×,Ò,Ù˜1“:×Òûð	þô ô Ù�q‹zÕûðúsª   Â.C ÃA I$Ä	I$ÄI$Ä3IÅI$Å G1Å.AGÇG1ÇI$ÇG.Ç.G1Ç1IÇ<#H<ÈIÈ IÈ$I$È*H<È1IÈ2IÈ6I$È<IÉIÉI$ÉI$ÉIÉI$ÉI$c          
     ó,   € V ^8„  d   QhRRRRRRRRRR	/# )
r   rD  r  rF  r   r²  rŒ  rT  r   rr   r   )r   s   "r   r   r   "  s1   € ÷ !ñ ! ð !¸3ð !ÈTð !Ðdhð !Ðmqñ !r   c                ó¤  €  ^ RI HpHpHpHpHp V! V P                  4      '       d   V! 4       '       g   R# RV P                   RV P                   2V P                  '       d   RV P                   2MR,           p	V! V	RV P                  P                  RR4       2V4      p
V! W©V P                  \        V P                  4      V P                  V\        \        V P                  R	R4      R
R4      R7       V! V
\        V P                  4      4       RT P$                   R2pT'       d   TR\'        T4       R2,          p\         P#                  RT P                  P                  R4      T4       TP)                  T4       R#   \         dA    \         P#                  RT P                  P                  R4      T P$                  RR7        R# i ; i)a¥  Hand a payload the live lane rejected as reconnect-only (``send_path_degraded``) and the
standalone lane then failed to send to the delivery ledger, as a failed reconnect-only row
owned by the adapter that rejected it: the post-reconnect sweep redelivers it (#125363). Only
reached after standalone failed, so nothing was sent and a replay cannot duplicate. The ledger
carries text only; dropped attachments are reported.)Úcompute_obligation_idÚis_reconnect_onlyÚledger_enabledÚmark_failedÚrecord_obligationNzcron:r  r   zjob:rh   ry   rŠ   Ú_owner_profile)Úobligation_idÚsession_keyr2   r3   rC   rF  Úadapter_profilez:Job '%s': could not queue %s for post-reconnect redeliveryTrÝ   zqueued text for z0 for redelivery once the live adapter reconnectsz (z attachment(s) not queued)r)  )Úgateway.delivery_ledgerr¸  r¹  rº  r»  r¼  r  rB   r3   rC   r.   r#   r   r"   r  r!   r`   ra   r  r—  rÀ   )rD  rF  r²  rT  r¸  r¹  rº  r»  r¼  r¿  r¾  Únotes   &&&&        r   Ú_queue_for_live_reconnectrÃ  "  s  € ð÷	fõ 	fá  §¡×.Ò.±n×6FÒ6FÙØ˜aŸo™oÐ.¨a°·	±	¨{Ð;ÐTU×T_×T_ÐT_ÀÀ1Ç;Á;À-Ñ?PÐegÕhˆÙ-¨k¸TÀ!Ç%Á%Ç)Á)ÈDÐRUÓBVÐAWÐ;XÐZaÓbˆÙØ'È1Ï?É?Ü˜Ÿ	™	“N¨a¯k©kÀ7Ü#¤G¨A¯K©K¸ÀDÓ$IÐK[Ð]aÓbõ	dñ 	�M¤3 q§|¡|Ó#4Ô5ð
 ˜aŸg™g˜YÐ&VÐW€DßØ�"”S˜Ó%Ð&Ð&@ÐAÕAˆÜ
‡N�N�> 1§5¡5§9¡9¨T£?°DÔ9Ø×Ñ˜4Ö øô ô Ü�‰ÐSØ—u‘u—y‘y “¨¯©¸$ð 	ô 	@âðús#   ‚%F ¨F ·,F Á$B/F ÆAGÇGc               ó0   € V ^8„  d   QhRRRRRRRRRRR	R
/# )r   rD  r  rF  r   r²  rŒ  rS  rT  r   rr   r   )r   s   "r   r   r   ?  s<   € ÷ "&ñ "&Øð"&Ø!$ð"&Ø37ð"&ØHLð"&Ø_cð"&à	ñ"&r   c           
     óè  € V P                   pV P                  '       d;   V'       g    VP                  RV P                   R24       VP	                  V4       R# \        WV4      w  rgVfX   V'       dP   VP                  R4      '       d9   RVR,           RV P                   R2p\        P                  RVR	,          V4       Ve1   VP                  V4       VP	                  V4       \        WW$4       R# \        V\        4      '       d   VP                  R
4      MR;'       g    .  FE  pRV RV P                   R2p	\        P                  RVR	,          V	4       VP                  V	4       KG  	  \        P                  RVR	,          V P                  V P                  4       \        WPP                  V P                  V P                   V P"                  V P$                  V P&                  R7       R# )z?Standalone fallback for a target the live lane did not deliver.zrelay delivery to z failedNrh  zdelivery error: rw  r  r)  rh   Úwarningszdelivery warning: zJob '%s': delivered to %s:%sr  )r.   r  rÀ   r  Úextendrµ  r#   r`   rh  rÃ  r%   r&   r{   rB   r3   r~   rq   rC   r  r  )
rD  rF  r²  rS  rT  r.   r‰   rq  Ú_wr'  s
   &&&&&     r   Ú_deliver_standalonerÉ  ?  sˆ  € ð �%‰%€CØ‡z‡z€zçØ× Ñ Ð#5°a·g±g°Y¸gÐ!FÔGØ×Ñ˜}Ô-ÙÜ" 1¨{Ó;�K€FØ
‚{—v &§*¡*¨W×"5Ò"5à  ¨¥Ð 1°¸1¿7¹7¸)À1ÐEˆÜ�‰�^ S¨¥Y°Ô4Ø
‚Ø×Ñ˜SÔ!Ø×Ñ˜}Ô-ô 	" !¨kÔKÙô *4°F¼D×)AÒ)Aˆv�z‰z˜*Ô%Àt×RÐRÐPRÒRˆØ" 2 $ i°·±¨y¸Ð:ˆÜ�‰�^ S¨¥Y°Ô4Ø×Ñ˜sÖ#ñ Sô ‡K�KÐ.°°Dµ	¸1¿?¹?ÈAÏIÉIÔVäØ�_‰_˜aŸi™i¨¯©À!Ç+Á+Ø× Ñ Ø×$Ñ$÷&r   c               ó4   € V ^8„  d   QhRRRRRRRRRRR	R
RR/# )r   r.   r&   rM   r
  r8   Úmirror_enabledrq   r   rT  rŒ  r   zOptional[_TargetDelivery]r   )r   s   "r   r   r   d  sX   € ÷ gRñ gRØ	ðgRØðgRØIMðgRØ_cðgRàðgRà'+ðgRð ñgRr   c          	     ó$  € ^ RI Hp	 VR,          p
VR,          pVP                  R4      p\        V 4      ;'       g    / pVP                  R4      pV'       d9   V'       g1   \        P                  RV R,          WàP                  RR4      V4       M'V'       d    \        P                  R	V R,          W«V4       \        WÚW¼4      pT;'       d    \        WWoR
7      pV'       d   VP                  R4      MRp\        VP                  R4      ;'       g    R4      P                  4       pVR8H  ;'       g*    V'       * ;'       d    \        V4      P                  R4      pT;'       g    T;'       d    \        VVR7      p V	! V
P                  4       4      p\!        T TY¡Y$4      w  ppTf   \        T TT4       R# Tw  ppppTRJ;'       d     TRJ;'       d    \#        TRR 4      ! 4       p\%        TT
4      R8H  pT'       d@   Te<   \'        TT
4      '       g*   \        P                  RT P                  RR4      T
4       RpT'       d   T'       d   T'       d   RpRpT'       d:   T'       g2   Te.   Te*   T'       g"   \)        T TY³4      ;'       g    RpT'       d   Tp\+        R-/ RT bRTbRT
bRTbRTbRTbRTbRTbRTbR TbR!TbR"TbR#TbR$TbR%TbR&TbR'TbR(TbR)TbR*TbR+TbR,Tb #   \        \        3 d    \        T RT
 R2T4        R# i ; i).z³Per-target prologue of ``_deliver_result``: origin/mirror/in_channel gates, transport
resolution, continuable-thread open. None (error noted in ``delivery_errors``) if unservable.r™   r2   r3   rC   zUJob '%s': origin has thread_id=%s but delivery target lost it (deliver=%s, target=%s)rh   rŽ  r2  z*Job '%s': delivering to %s:%s thread_id=%s)rN   rK   rU   Nr•   r   r­   ÚDrW   zunknown platform 'Ú'Ú
is_runningc                 ó   € R # )Fr   r   r   r   Ú<lambda>Ú*_prepare_target_delivery.<locals>.<lambda>Ÿ  s   € ±r   r   zOJob '%s': cron_continuable_surface=in_channel not supported on %s, using threadry   Fr.   rB   r  r(   rì  r  r	  r‹   r
  r1   r  r  r  rq   r  r  r  r  r  r   )rž   rš   r#   r5   r`   ra   r|   rG   rR   r   r$   r–  rX   r    r¡   rÈ  r<  r"   r+   rB  r‘   r  )r.   rM   r9  r‹   r	  r
  rË  rq   rT  rš   rB   r3   rC   r1   rF   r  r  r  Úorigin_chat_typer  r  r2   ÚresolvedÚresolve_errr  r(   rì  r  r  r  r  s   &&$$$$$$$                      r   Ú_prepare_target_deliveryrÖ  d  s¼  € õ (Ø˜:Õ&€MØ�YÕ€GØ—
‘
˜;Ó'€Iä˜SÓ!×'Ð' R€FØ—J‘J˜{Ó+€MßŸYÜ�‰ØcØ��I�}§g¡g¨i¸Ó&AÀ6õ	K÷ 
Ü�‰Ø8Ø��I�}¨yô	:ô
 +¨6À'ÓU€MØ'÷ Oð OÔ,CØ >ô-OÐ÷ /<�V—Z‘Z 	Ô*À€Nô ˜6Ÿ:™: kÓ2×8Ð8°bÓ9×?Ñ?ÓAÐØ# tÑ+÷ ?ð ?ØÔ×=Ð=¤ W£×!8Ñ!8¸Ó!=ð ð *÷ dð dØ×bÐbÔ6¸\ÐSaÔbð ðÙ˜M×/Ñ/Ó1Ó2ˆô
 6ØˆX�}¨hó@Ñ€HˆkàÒÜ˜3 ¨_Ô=ÙØ;CÑ8€Iˆw˜¨ð
 	˜tÐ#÷ 	9ð 	9Ø˜Ð÷	9ð 	9ä�D˜,©Ô6Ó8ð ô 4°G¸]ÓKÈ|Ñ[ÐçØÒ'Ü,¨_¸m×LÒLä�‰Ø]Ø�G‰G�D˜#Ó ô	/ð #Ðß×3×8Jð ˆ	ð
 '+Ðçß"ØÒ'ØÒßä8Ø� 'ó1÷ 9ð 9Ø48ð 	çØ(ˆIÜò RÙðRÙ"ðRÙ2?ðRÙIPðRáðRá'0ðRá:AðRáSbðRñ (ðRñ 17ðRñ >BðRñ TcðRñ ð	Rñ &3ð	Rñ DRð	Rñ
 "ðRñ
 0;ðRñ
 PbðRñ .ðRñ F[ðRñ *ðRñ ?QðRð Røôk œÐ!ô Ü˜3Ð"4°]°OÀ1Ð EÀÔWÚðús   Å?K) Ë)"LÌLc               ó$   € V ^8„  d   QhRRRRRR/# )r   r.   r&   rJ  r8   r   rD   r   )r   s   "r   r   r   Î  s!   € ÷ ñ  dð ¸ð À-ñ r   c           
     ó  € \        \        WR7      4      pVR8X  d   R# VR8X  d9   \        P                  RV P	                  RV P	                  RR4      4      4       R# R	V 2p\        P                  R
V R,          V4       V# )uË   ``_deliver_result`` outcome when no target resolved: None (not a failure) for ``local`` and
origin-less ``origin`` (CLI jobs never capture an origin â€” a spurious error every run), else
an error string.rb  r2  Nr1   uk   Job '%s': deliver=origin but no origin or home channels â€” skipping delivery (output saved in last_output)rg   rh   ry   z(no delivery target resolved for deliver=r)  )r�  r§  r`   r{   r#   ra   )r.   rJ  r0  r'  s   &&  r   Ú_unresolved_delivery_outcomerÙ  Î  s{   € ô -Ô-AÀ#Ô-_Ó`€MØ˜ÔÙØ˜Ô Ü�‰ð>à�G‰G�F˜CŸG™G D¨#Ó.Ó/ô	1ñ Ø4°]°OÐ
D€CÜ
‡N�N�> 3 t¥9¨cÔ2Ø€Jr   c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   r.   r&   rF  r   rJ  r8   r   rD   r   )r   s   "r   r   r   å  s8   € ÷ VCñ VCØ	ðVCØðVCØGKðVCàñVCr   c               ó 
  € V P                  RR4       V P                  RR4       \        WR7      pV'       g   \        V . 4       \        W4      # \        P
                  P                  RR4      pV'       dâ   VfÞ   T\        V P                  R4      ;'       g    R4      8X  dµ   \        ;QJ d    R V 4       F  '       g   K   R	M	  R
M! R V 4       4      '       d{   ^ RI	H
p \        V . 4       V! W`WR7      p^ RI	Hp	 V	! V4      p
V
'       d   V
R,          R8X  d   R	V R&   ^ RIHp V! V R,          4      ;'       g    / pVP                  R4      V R&   V# ^ RIHp R	pRp\         P"                  ! \$        4      ;_uu_ 4        \&        P(                  ! 4       pVP                  R/ 4      P                  RR	4      pRRR4       \+        V4      p. pV'       d:   V P                  RV R,          4      pRV RV P                  RR4       RV RV R2	pMTp^ RIHp ^ RIHp V! V4       VP5                  V4      w  pp\7        VR4      p\9        V4      pVP;                  V4      pV\9        V4      ,
          pV^ 8”  d   V R2.M. p \=        W4      pVP5                  V4      w  pp\7        T;'       g    RP?                  4       R4      p V! 4       p. p!^ p"T EFp  p#^ R"I"H#p$ T'       d4   T#R#,          \H        8w  d"   T$! T#R#,          T4      '       g   T"^,          p"KE  T#R#,          \H        8X  d¿   \K        YT#R$,          TR7      p%T"T P                  RR
4      ,          p"T%'       d†   R%T#R$,          ;'       g    R& 2p&T P                  R/ 4      P                  T&4      p'T''       d   T'R,          R+9  d   T!PM                  T%4       T''       d    T'R,          R'8X  d   TPM                  T%4       EK  \O        T T#Y#TTTTT!R(7	      p(T(f   EK/  . p)T(PP                  ;'       d    \S        T(TTT)T!TR)7      p*T*'       d   EKa  \U        T(TTT)T!4       EKs  	  T"\9        T4      8X  d   R	T R&   MT!PW                  T4       \        T T4       T!'       d   R*PY                  T!4      # R#   + '       g   i     ELç; i  \$         d    R
p EL-i ; i  \$         d0   pR T 2p \@        PC                  R!T R,          T 4       T u Rp?# Rp?ii ; i),aj  Deliver job output to the configured target(s). With ``adapters``/``loop`` (gateway
running) the live adapter is tried first (E2EE rooms can't use the standalone HTTP path), then
standalone fallback. ``for_failure=True`` routes failure-category notices through the job's
``failure_deliver`` override when present (NS-788). Returns None on success, else an error.r_  Nr`  rb  Ú_HERMES_CRON_EXTERNAL_WORKERr   rW  c              3  ó@   "  € T F  qR ,          \         8g  x € K  	  R# 5i)r2   N)r  )r   rM   s   & r   r  Ú"_deliver_result.<locals>.<genexpr>û  s   é € ÐRÉ'À˜:Õ&Ô*;Ö;Ë'ùs   ‚TF)Úenqueue_and_wait)Ú
get_statusr\  r]  )Úget_jobrh   rý  r  r;   Úwrap_responserg   zCronjob Response: z

(job_id: z)
-------------

zI

To stop or manage this job, send me a new message (e.g. "stop reminder z").)rµ  )Úapply_media_policy_envzdelivery contentz£ media attachment(s) dropped by media path policy (missing file, denied prefix, or strict-mode miss); see gateway.strict / media_delivery_allow_dirs in config.yamlzmirror payloadzfailed to load gateway config: r)  rT  r2   r3   r[  rS  Ú	ambiguous)r9  r‹   r	  r
  rË  rq   rT  r‡  z; rk  )-Úpopr­  r  rÙ  ré   Úenvironr#   r   r�  Úcron.delivery_queuerß  rà  r  rá  rž   rÜ   r   r    r!   r=   r>   rø  rÃ  rµ  Úgateway.media_policyrã  Úextract_mediarc   r—  rÄ  r@   r'   r`   rh  rs  rU  r  rˆ  rÀ   rÖ  r  r�  rÉ  rÇ  rÁ   )+r.   rF  r9  r‹   rJ  r   Úexternal_executionrß  rh  rà  Údelivery_statusrá  Ú	refreshedrÜ   râ  Úuser_cfgr
  rú  Ú	task_nameÚdelivery_contentrµ  rã  r²  Úcleaned_delivery_contentÚrequested_mediaÚ_policy_droppedÚpolicy_drop_errorsrË  r  rq   r	  rb   r'  rT  Úsuppressed_targetsrM   rU  Úbot_chat_errorÚreceipt_targetrƒ  rD  rS  rå  s+   &&&&$                                      r   Ú_deliver_resultr÷  å  sÑ  € ð ‡G�GÐ)¨4Ô0Ø‡G�GÐ2°DÔ9Ü'¨ÔE€GßÜ% c¨2Ô.Ü+¨CÓ=Ð=ô Ÿ™Ÿ™Ð(FÈÓKÐß˜xÒ/Ø"¤c¨#¯'©'°.Ó*A×*GÐ*GÀRÓ&HÔHß“ÑRÉ'ÓR——’ÑRÉ'ÓR×RÒRÝ8ä% c¨2Ô.Ù Ð!3¸'Ô[ˆÝ2Ù$Ð%7Ó8ˆß˜¨xÕ8¸LÔHØ:>ˆCÐ6Ñ7Ý%Ù˜C �IÓ&×,Ð,¨"ˆ	Ø&/§m¡mÐ4JÓ&KˆÐ"Ñ#Øˆå2ð €MØ€HÜ	×	Ò	œY×	'Õ	'Ü×%Ò%Ó'ˆØ Ÿ™ V¨RÓ0×4Ñ4°_ÀdÓKˆ÷ 
(ô 4°HÓ=€Oð  "ÐßØ—G‘G˜F C¨¥IÓ.ˆ	à   ð ,ØŸ™  bÓ)Ð*ð + àˆið %à%. K¨tð5ñ 	ð #Ðå:õ <Ù˜8Ô$Ø,?×,MÑ,MÐN^Ó,_Ñ)€KÐ)ô
  4Ð4LÐN`ÓaÐÜ˜+Ó&€OØ%×AÑAÀ+ÓN€Kà%¬¨KÓ(8Õ8€Oð
 
˜1Ô	ð Ð
ð Hð 	Hñð #%ð	 ðÜ6°sÓEˆð
 )×6Ñ6°wÓ?�N€A€{ô '¨×(9Ð(9°r×'@Ñ'@Ó'BÐDTÓU€KðÙ$Ó&ˆð €OØÐÜˆõ 	Pß˜F :Õ.Ô2CÔCÙ5°f¸ZÕ6HÈ(×SÒSØ !Õ#ÐÙà�*ÕÔ!2Ô2Ü1°#ÀÀyÕ@QÐ_jÔkˆNØ #§'¡'Ð*PÐRWÓ"XÕXÐßØ#,¨V°IÕ->×-IÐ-IÀ'Ð,JÐ!K�ØŸ'™'Ð"?ÀÓD×HÑHÈÓX�ß '¨(Õ"3Ð;PÔ"PØ#×*Ñ*¨>Ô:ß˜w xÕ0°KÔ?Ø&×-Ñ-¨nÔ=Úä$Ø� (¸fØ+Ø)°{ÐTcôeˆð Š9ÚØ ˆØ×(Ñ(÷ 
ð 
Ô-FØÐ'¨Ø'¸Ø1ô.
ˆ	÷
 ŠyÜØÐ+¨[¸-È÷ZñE ðN œS ›\Ô)Ø6:ˆÐ2Ò3à×ÑÐ1Ô2Ü! #Ð'9Ô:ß)8ˆ4�9‰9�_Ó%ÐB¸dÐB÷[ 
(×	'Ð	'ûô\ ô Ø‹ðûô ô Ø/°¨sÐ3ˆÜ�‰�^ S¨¥Y°Ô4Ø�
ûðús<   Æ8RÊR/ ËS ÒR,	Ò/S Ò?S ÓS=Ó$S8Ó2S=Ó8S=)Ú	scheduler)Úscheduler_delivery_origin)Úscheduler_preflight)Úscheduler_script)r
   r   Údiscordr   ÚsignalÚ
mattermostÚsmsÚemailÚdingtalkÚfeishuÚwecomÚweixinÚbluebubblesÚqqbotÚwhatsappÚwhatsapp_cloudrÿ   )NN)NFN)r   >   ú.3gpú.aviú.mkvú.movú.mp4ú.webm>   ú.gifú.jpgú.pngú.jpegú.webp)ry   N)gr"  Ú
__future__r   r–  Úconcurrent.futuresr«  r   r¯  Úloggingré   ri  r7  r   Útypingr   r   r   Ú	getLoggerr`   Ú	frozensetrÕ   r4   r  rî   r+   r5   r@   rG   rª  rR   rX   rc   rk   rn   r~   r¯   r‘   rª   r°   r³   rÅ   rÑ   rÖ   rÙ   rà   rð   ró   rö   rü   r  r  r#  r'  r*  r-  r?  rD  rI  rˆ  r�  r¢  r  ru  r6  r7  r£  r§  r­  r°  rÆ  rÇ  rÜ  rá  rê  rñ  rø  r  r  rÈ  r.  r<  rB  rP  rk  rs  r|  rƒ  r�  rµ  rÃ  rÉ  rÖ  rÙ  r÷  r;   rø  r=   rù  rJ  rú  r5  rû  rÉ  r   r   r   Ú<module>r     sä  ðñõ #ã Û Û Û Û Û 	Û Ý !ß &Ñ &ð 
×	Ò	Ð+Ó	,€ñ & yÐ2BÐ&CÓDÐ ñ
 '¨ ~Ó6Ð ðÐ ð !5Ð6GÐHÐ õõ(÷(õ&Oð" $ QÐ(9¸1¸fÀaÈÐUVÐWÐ ðØTX÷õ6"õ/õ(VõAñ'
à6;÷'
ð '
ð\ # G¨X°wÀ
ÈGÐTÐ õð.'àGKð'ð W\÷'÷T!FðHà7;ðàW[÷õB4õ"	õQõ7õ

ñÀe÷ ð õ*8õJõò6Hõõ"õJLõ#÷ðPVØ=B÷PVõfõ$ð"NSØ-2÷NSõb	ñ ˜U˜GÓ$€ð Ð à Ð õ
õõ0Uð'¸5÷ 'ð À÷  õF+ñ ÒIÓJ€ÙÒBÓC€÷:÷z.÷$õN#õLõað* ÷#Fð #Fó ð#FõLõSõ6HõrSõ*;ðZ #%Ð õc-õL<õ*.Uõb>õB@õF!õ:"&õJgRõTñ.VCØNS÷VCð VCõv %Ý 5Ý 2ß ,r   