+
    iHàj[¥  ã                   ó  a € Rz ta0 t R 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 ^ RIHt ^ RIHt ^ RIHt ^ RIHt ]P.                  ! ]4      t]P4                  ! 4       t] ^ k R{R R	 llt]]].R3,          t]]].R3,          t ]. ]!3,          t"R
t#Rt$]PJ                  ! R4      t&]PJ                  ! R]PN                  4      t(^0t)^t*Rt+R|t,Rt-].! R ], 4       4      ]-P_                  4       0,          t0Rt1RRPe                  R ], 4       4      ,           R]- R2,           t3Rt4Rt5RRRRRRRRRR R!R"RR#//R$R".R%R&///t6]7;QJ d    . R' R} 4       F  NK  	  5M! R' R} 4       4      t8R(]R)R*R+R,3t9R- R. lt:R/ R0 lt;R1 R2 lt<R3 R4 lt=R5 R6 lt>R7 R8 lt?R9 R: lt@R; R< ltAR= R> ltBR? R@ ltCRAtD]PJ                  ! RB]D RC24      tERD RE ltFRF RG ltGR~RH RI lltHRJ RK ltIR~RL RM lltJRN RO ltKRP RQ ltLRR RS ltMRT RU ltNRV RW ltORX RY ltPRZ R[ ltQR\ R] ltRR^ R_ ltSR` Ra ltTRb Rc ltURd Re ltVRRf Rg lltWRh Ri ltXRjR/Rk ltYRl Rm ltZR€Rn Ro llt[RRp Rq llt\Rr Rs lt]Rt Ru lt^Rv Rw lt_R�Rx Ry llt`R# )‚až  Auto-generate short session titles from the user's opening message.

Two stages, both off the critical path: an **instant** deterministic title (written before the model
is called, cannot fail), then an **upgrade** from one small-model call (cheap tier, thinking off,
JSON-constrained). Storage enforces provenance ``derived < llm < user``: stage 2 only replaces stage 1
and neither replaces a name the user typed.N)Úsuppress)ÚAnyÚCallableÚOptional)Úcall_llm)ÚLEGACY_SUMMARY_PREFIX)Ú"is_dispatcher_owned_worker_context)Úflatten_message_textc                ó(   € V ^8„  d   QhR\         RR/# )é   ÚtimeoutÚreturnN)Úfloat)Úformats   "Ú:/home/ubuntu/.hermes/hermes-agent/agent/title_generator.pyÚ__annotate__r      s   € ÷ ;ñ ;¤Uð ;°dñ ;ó    c           	     óÔ   € \         P                  ! 4       V ,           p\        \        4       F8  pVP	                  \        RV\         P                  ! 4       ,
          4      4       K:  	  R# )zCBounded join of the auto-title threads still running; never raises.g        N)ÚtimeÚ	monotonicÚlistÚ_UPGRADE_THREADSÚjoinÚmax)r   ÚdeadlineÚthreads   &  r   Úwait_for_title_upgradesr      sB   € ä�~Š~Ó 'Õ)€HÜÔ'Ö(ˆØ�‰”C˜˜X¬¯ªÓ(8Õ8Ó9Ö:ó )r   iè  z

Pasted content:
z@(?:file|folder):\S+z4\n+--- (?:Context Warnings|Attached Context) ---\n.*i   zCode changesc              #   óR   "  € T F  qR 8w  g   K  VP                  4       x € K  	  R# 5i)úFriendly greetingN)Úlower©Ú.0Úts   & r   Ú	<genexpr>r#   T   s$   é € ð !Ù,�!Ð5HÑ0H„I€A‡G�G‡I€IÓ,ùs   ‚'�'zfriendly greetinga=  You name chat sessions. Given the user's opening message, write a title that lets them find this conversation again in a list.

Rules:
- 3 to 7 words, sentence case (capitalize only the first word and proper nouns).
- Name what the user wants DONE, not that they asked a question.
- Keep technical terms, filenames, numbers, and error codes exact.
- Drop filler words: the, this, my, a, an.
- No trailing punctuation, no quotes, no tool names, no 'Title:' prefix.
- Never answer the message. Name it.
- Always produce something, even for a bare greeting.
__LANGUAGE_RULE__
Ú c              #   ó.   "  € T F  pR V R2x € K  	  R# 5i)zGood: {"title": "z"}
N© r    s   & r   r#   r#   l   s   é € ÐKÑ5J°Ð" 1 # UÕ+Ó5Jùs   ‚zToo vague: {"title": "z™"}
Too long: {"title": "Investigate and fix the issue where the login button does not respond on mobile devices"}

Reply with JSON only: {"title": "..."}z=- Write the title in the same language as the user's message.z - Write the title in {language}.ÚtypeÚjson_schemaÚnameÚsession_titleÚstrictTÚschemaÚobjectÚ
propertiesÚtitleÚstringÚrequiredÚadditionalPropertiesFc              #   ó:   "  € T F  pR V R2RV R23x € K  	  R# 5i)Ú<Ú>z</Nr&   )r!   Útags   & r   r#   r#      s2   é € ð ñtˆð 	ˆˆˆQ€Z�2�c�U˜!�Õótùs   ‚z[CONTEXT COMPACTIONz[Runtime note:z[System note:z[SYSTEM]z7[System: The active model for this chat has changed to c                ó$   € V ^8„  d   QhR\         /# ©r   r   )Údict)r   s   "r   r   r   “   s   € ÷ añ a”tñ ar   c                 ó”   € ^ RI Hp  V ! 4       ;'       g    / P                  R4      ;'       g    / P                  R4      ;'       g    / # )za``auxiliary.title_generation`` (lazy read-only import: no hermes_cli cycle, no migration writes).©Úload_config_readonlyÚ	auxiliaryÚtitle_generation)Úhermes_cli.configr<   Úgetr;   s    r   Ú_title_configrA   “   s>   € å6Ù!Ó#×)Ð) r×.Ñ.¨{Ó;×AÐA¸r×FÑFÐGYÓZ×`Ð`Ð^`Ð`r   c                ó$   € V ^8„  d   QhR\         /# r8   ©Ústr)r   s   "r   r   r   ™   s   € ÷ ñ œñ r   c                 óŠ   €  \        \        4       P                  RR4      4      P                  4       #   \         d     R# i ; i)z3Configured title language, or "" to match the user.Úlanguager$   )rD   rA   r@   ÚstripÚ	Exceptionr&   r   r   Ú_title_languagerI   ™   s<   € ðÜ”=“?×&Ñ& z°2Ó6Ó7×=Ñ=Ó?Ð?øÜô Úðús   ‚03 ³AÁAc                ó$   € V ^8„  d   QhR\         /# r8   ©Úbool)r   s   "r   r   r   ¡   s   € ÷ ñ œTñ r   c                  ó¤   €  ^ RI Hp  V ! \        4       P                  R4      RR7      #   \         d    \
        P                  RRR7        R# i ; i)é    ©Úis_truthy_valueÚenabledT©Údefaultz'Failed to read title_generation.enabled©Úexc_info©ÚutilsrP   rA   r@   rH   ÚloggerÚdebugrO   s    r   Ú_auto_title_enabledrZ   ¡   sG   € ðÝ)Ùœ}›×2Ñ2°9Ó=ÀtÔLÐLøÜô Ü�‰Ð>ÈˆÔNÚðúó   ‚&) ©"AÁAc                ó$   € V ^8„  d   QhR\         /# r8   rK   )r   s   "r   r   r   ª   s   € ÷ ñ ¤dñ r   c                 ó¤   €  ^ RI Hp  V ! \        4       P                  R4      RR7      #   \         d    \
        P                  RRR7        R# i ; i)zcDistinct from ``enabled``: keep the instant derived title, skip the background model call (#85194).rO   Úmodel_upgrade_enabledTrR   z5Failed to read title_generation.model_upgrade_enabledrT   rV   rO   s    r   Ú_model_title_upgrade_enabledr_   ª   sJ   € ðÝ)Ùœ}›×2Ñ2Ð3JÓKÐUYÔZÐZøÜô Ü�‰ÐLÐW[ˆÔ\Úðúr[   c                óF   € V ^8„  d   QhR\         \        ,          R\        /# )r   Úmain_runtimer   )r   r9   rL   )r   s   "r   r   r   ´   s"   € ÷ Cñ C´8¼Dµ>ð CÄdñ Cr   c                óê  € \        T ;'       g    / P                  R4      ;'       g    R4      P                  4       P                  4       p\	        V4      '       g   R#  \        4       p\        VP                  R4      ;'       g    R4      P                  4       P                  4       p\        T ;'       g    / P                  R4      ;'       g    R4      P                  4       P                  R4      pVR9  d   \        W1V4      '       g   R# \        TP                  R4      ;'       g    R4      P                  4       P                  R4      pT'       * ;'       g    YT8H  #   \         d     R# i ; i)u�  True when the model title call would hit the SAME self-hosted endpoint as the turn's own request.

A self-hosted main route (``_is_self_hosted_provider``: custom, lmstudio, local and their aliases)
whose ``auxiliary.title_generation`` is not pinned elsewhere (a pin naming the same custom route â€”
``custom:<name>``, bare ``<name>`` or its display name â€” is not "elsewhere", #120558)
shares one local server between the streaming main request and the
concurrent ``response_format: json_schema`` title request. Single-slot servers then serve the
title grammar/completion into the main turn: the user's reply arrives as ``{"title": ...}``, is
persisted as a genuine assistant row and replayed, and the model adopts the format (#117296).
Running the title call after the turn settles keeps the two requests off the wire at once.
Hosted providers multiplex requests independently and keep the turn-start timing.
Úproviderr$   FÚbase_urlÚ/T)r$   Úauto)	rD   r@   rG   r   Ú_is_self_hosted_providerrA   ÚrstripÚ_title_pin_may_share_endpointrH   )ra   rc   ÚcfgÚpinned_providerÚmain_base_urlÚpinned_base_urls   &     r   Ú title_upgrade_must_wait_for_turnrn   ´   s2  € ô �L×&Ð& B×+Ñ+¨JÓ7×=Ð=¸2Ó>×DÑDÓF×LÑLÓN€HÜ# H×-Ò-ÙðÜ‹oˆÜ˜cŸg™g jÓ1×7Ð7°RÓ8×>Ñ>Ó@×FÑFÓHˆÜ˜\×/Ð/¨R×4Ñ4°ZÓ@×FÐFÀBÓG×MÑMÓO×VÑVÐWZÓ[ˆØ ,Ô.Ô7TØ¨=÷8:ò 8:áô ˜#Ÿ'™' *Ó-×3Ð3°Ó4×:Ñ:Ó<×CÑCÀCÓH€OØÔ×BÐB /Ñ"BÐBøô ô Úðús$   Á&E# Â0E# Â7E# Ã=E# Å#E2Å1E2c                ó0   € V ^8„  d   QhR\         R\        /# )r   rc   r   ©rD   rL   )r   s   "r   r   r   Ñ   s   € ÷ Yñ Y¤sð Y¬tñ Yr   c                óZ   € ^ RI Hp V! V 4      p V R9   ;'       g    V P                  R4      # )uä   ``custom``, a named ``custom:<name>`` route, LM Studio or ``local`` (vllm/llama.cpp): one local server per route.

Normalised here so the main route and the title pin resolve aliases (``ollama``, ``lm-studio``â€¦) the same way.
)Únormalize_providerzcustom:)ÚcustomÚlmstudioÚlocal)Úhermes_cli.providersrr   Ú
startswith)rc   rr   s   & r   rg   rg   Ñ   s0   € õ
 8Ù! (Ó+€HØÐ6Ñ6×XÐX¸(×:MÑ:MÈiÓ:XÐXr   c                óH   € V ^8„  d   QhR\         R\         R\         R\        /# )r   rk   Úmain_providerrl   r   rp   )r   s   "r   r   r   Û   s0   € ÷ _ñ _´3ð _Äsð _Ô[^ð _Ôcgñ _r   c                ó:  € ^ RI HpHp ^ RIHpHp \        V 4      '       d   R# V! V 4      V! V4      ,          '       d   R# V! W! V! 4       4      4      p\        T;'       d7    T;'       d-    VP                  P                  4       P                  R4      V8H  4      # )u�  A title pin that can land on the turn's own self-hosted server (only its ``base_url`` can prove otherwise).

Hosted pins (``openrouter``â€¦) multiplex and never share the slot. A pin to ``custom``/``lmstudio``/``local``/any
``custom:<name>`` is assumed to share until the caller compares ``base_url``, and a bare ``<name>`` /
display-name pin is the same endpoint when it aliases the main ``custom:<name>`` route
(``hermes_cli.providers.custom_provider_aliases`` â€” the resolver's own identity set) or resolves to a
configured custom entry serving ``main_base_url`` (a keyed ``providers:`` entry's display name does not
alias its ``custom:<key>`` id).
)Úget_compatible_custom_providersr<   )Úcustom_provider_aliasesÚresolve_custom_providerTre   )r?   r{   r<   rv   r|   r}   rg   rL   rd   rG   rh   )rk   ry   rl   r{   r<   r|   r}   Úpdefs   &&&     r   ri   ri   Û   s�   € ÷ XßUÜ ×0Ò0ÙÙ˜Ó/Ñ2IÈ-Ó2X×XÔXÙÙ" ?Ð4SÑThÓTjÓ4kÓl€DÜ�×]Ð]˜×]Ð]¨4¯=©=×+>Ñ+>Ó+@×+GÑ+GÈÓ+LÐP]Ñ+]Ó^Ð^r   c                óR   € V ^8„  d   QhR\         \        P                  ,          RR/# )r   Úupgrader   N)r   Ú	threadingÚThread)r   s   "r   r   r   ï   s%   € ÷ ñ ¤¬)×*:Ñ*:Õ!;ð Àñ r   c                óx   € V e   V P                   e   R# \        P                  V 4       V P                  4        R# )zdStart a (deferred) title upgrade thread; joinable via ``wait_for_title_upgrades`` only once started.N)Úidentr   ÚaddÚstart)r€   s   &r   Ústart_title_upgrader‡   ï   s*   € à‚˜'Ÿ-™-Ò3ÙÜ×Ñ˜Ô!Ø‡M�M†Or   c                ó0   € V ^8„  d   QhR\         R\         /# ©r   Útextr   rC   )r   s   "r   r   r   ÷   s   € ÷ ñ ¤ð ¬ñ r   c                ó²   € T ;'       g    RP                  4       p\        \        \        4      ^,          4       F  p\	        V4      pW18X  d    V# TpK  	  V# )ziRemove leading control wrappers (nested too) so a slash-command turn reduces to the prose the user typed.r$   )rG   ÚrangeÚlenÚ_CONTROL_WRAPPERSÚ_strip_one_wrapper)rŠ   ÚcurrentÚ_Ústrippeds   &   r   Ústrip_control_wrappersr“   ÷   sV   € à�zˆz�r× Ñ Ó"€GÜ”3Ô(Ó)¨AÕ-Ö.ˆÜ% gÓ.ˆØÔØà€Nð Šñ	 /ð
 €Nr   c                ó0   € V ^8„  d   QhR\         R\         /# r‰   rC   )r   s   "r   r   r     s   € ÷ 
ñ 
œSð 
¤Sñ 
r   c                 óŠ  € V P                  4       p\         F¨  w  r#VP                  V4      '       g   K  VP                  V4      pVR8X  d   V \	        V4      R P                  4       u # W\	        V4      ,           R P                  4       ;'       g    V \	        V4      V P                  4       P                  4       u # 	  V # )é   Néÿÿÿÿ)r   rŽ   rw   Úfindr�   rG   )rŠ   ÚloweredÚopen_tagÚ	close_tagÚends   &    r   r�   r�     s§   € Ø�j‰j‹l€Gß0ÑˆØ×!Ñ! (×+Ò+ÙØ�l‰l˜9Ó%ˆØ�"Œ9Øœ˜H›˜Ð'×-Ñ-Ó/Ò/àœ3˜y›>Õ)Ð*Ð+×1Ñ1Ó3×VÐV°t¼CÀ»MÈ#Ð7N×7TÑ7TÓ7V×]Ñ]Ó_Ò_ñ  1ð €Kr   z$(?:`[^`\n]+`|\"[^\"\n]+\"|'[^'\n]+')z(?<![\w/])@(?:file|folder):(?:z(?::\d+(?:-\d+)?)?|\S+)c                ó0   € V ^8„  d   QhR\         R\        /# ©r   Úmessager   rp   )r   s   "r   r   r     s   € ÷  ñ  ¤Sð  ¬Tñ  r   c                ó€   € \         P                  R\        P                  RV 4      4      pVP                  4       '       * # )u½   True when nothing but context references (and their expansion footer)
remain â€” a manual-attach opener with no typed request and no paste
preview has no topic of its own to title (#92068).r$   )Ú_CONTEXT_REFERENCE_TOKEN_REÚsubÚ_CONTEXT_FOOTER_RErG   )rŸ   Úresiduals   & r   Ú_attachment_only_openerr¥     s4   € ô +×.Ñ.¨rÔ3E×3IÑ3IÈ"ÈgÓ3VÓW€HØ�~‰~ÓÔÐr   c                ó0   € V ^8„  d   QhR\         R\         /# ©r   Úuser_messager   rC   )r   s   "r   r   r   &  s   € ÷ 
Tñ 
T¬#ð 
T´#ñ 
Tr   c                ó²   € V '       g   R# Rp ^ RI Hp V! V 4      p\        Vf   V 4      # T4      #   \         d    \        P	                  RRR7        L9i ; i)zkText worth titling: describe a ``/skill`` invocation (it embeds the whole skill body), then strip wrappers.r$   N)Údescribe_skill_invocationz-Skill-scaffolding summary failed; titling rawTrT   )Úagent.skill_commandsrª   rH   rX   rY   r“   )r¨   Ú	describedrª   s   &  r   Ú_summarize_user_messager­   &  s^   € çÙØ€IðUÝBÙ-¨lÓ;ˆ	ô "°)Ò2C ,ÓSÐSÈÓSÐSøô ô UÜ�‰ÐDÈtˆÖTðUús   Ž1 ±"AÁAc                óJ   € V ^8„  d   QhR\         R\         R,          R\         /# ©r   r¨   Útitle_previewNr   rC   )r   s   "r   r   r   3  s*   € ÷ Vñ V¤Cð V¼¸d½
ð VÌcñ Vr   c                ó  € \        V 4      p\        V\        4      '       d   VP                  4       MRpV'       g
   VR\         # \
        P                  RV4      P                  4       p\        P                  RV4      P                  4       '       g
   VR\         # \        \        V4      \        ^,          4      p\        V,
          \        \        4      ,
          pV^ 8:  d
   VR\         # VRV \        ,           VRV ,           # )az  Combine the opening text with a bounded Desktop-generated paste preview.

``title_preview`` is deliberately an explicit, auxiliary-only value: ordinary
attachments never populate it, and it is never returned to the main turn.
Keep enough of a separately typed request to preserve a useful instruction,
then spend the remaining title budget on the beginning of the pasted topic.
r$   N)r­   Ú
isinstancerD   rG   ÚMAX_TITLE_INPUT_CHARSr£   r¢   Ú_ATTACHMENT_REF_REÚminr�   Ú_PASTE_PREVIEW_LABEL)r¨   r°   rŸ   ÚpreviewÚmessage_budgetÚpreview_budgets   &&    r   Úbuild_title_inputrº   3  sç   € ô & lÓ3€GÜ'1°-Ä×'EÒ'Eˆm×!Ñ!Ô#È2€GßØÐ-Ô-Ð.Ð.ô !×$Ñ$ R¨Ó1×7Ñ7Ó9€Gô ×!Ñ! " gÓ.×4Ñ4×6Ò6ØÐ-Ô-Ð.Ð.Üœ˜W›Ô'<ÀÕ'AÓB€NÜ*¨^Õ;¼cÔBVÓ>WÕW€NØ˜ÔØÐ-Ô-Ð.Ð.Ø�?�NÐ#Ô&:Õ:¸WÀ_ÀnÐ=UÕUÐUr   c                ó0   € V ^8„  d   QhR\         R\        /# r§   rp   )r   s   "r   r   r   M  s   € ÷ ;ñ ;¬Cð ;´Dñ ;r   c                óH  € \        V \        4      ;'       dŒ    \        V P                  4       4      ;'       dk    V P	                  4       P                  \        4      '       * ;'       d;    \        \        V 4      P                  4       4      ;'       d    \        V 4      '       * # )zaFalse for machine-authored openers and turns that reduce to nothing once scaffolding is stripped.)	r²   rD   rL   rG   Úlstriprw   Ú_MACHINE_PREFIXESr­   r¥   )r¨   s   &r   Úis_titleable_user_messager¿   M  s”   € ä�|¤SÓ)÷ :ð :¬d°<×3EÑ3EÓ3GÓ.H÷ :ð :ÐQ]×QdÑQdÓQf×QqÑQqô  sDó  REô  NE÷ :ð :ÜÔ,¨\Ó:×@Ñ@ÓBÓC÷:ð :ô
 ,¨LÓ9Ô9ð;r   c                ó`   € V ^8„  d   QhR\         R\         R,          R\        \         ,          /# r¯   ©rD   r   )r   s   "r   r   r   W  s*   € ÷ ñ œsð ´3¸µ:ð ÌÔRUÍñ r   c                ól  € V'       g   \        V 4      '       d   R# RP                  \        \        W4      4      P	                  4       4      p\        V4      \        8”  dJ   VR\         pVP                  R4      pV\        ^,          8”  d   VRV MTP                  R4      R,           pT;'       g    R# )zWInstant title: first meaningful line trimmed to a word boundary. No model, never fails.NÚ u	    ,.;:â€”-õ   â€¦)	r¥   r   Ú_first_linerº   Úsplitr�   ÚMAX_DERIVED_TITLE_CHARSÚrfindrh   )r¨   r°   ÚlineÚcutÚspaces   &&   r   Úderive_titlerÌ   W  s—   € ÷ Ô4°\×BÒBÙØ�8‰8”KÔ 1°,Ó NÓO×UÑUÓWÓX€DÜ
ˆ4ƒyÔ*Ô*ØÐ+Ô+Ð,ˆØ—	‘	˜#“ˆØ$Ô'>À!Õ'CÔC��F�U‘È×TÑTÐU`ÓaÐdiÕiˆØ�<ˆ<�4Ðr   c                ó0   € V ^8„  d   QhR\         R\         /# r‰   rC   )r   s   "r   r   r   e  s   € ÷ Kñ Kœcð K¤cñ Kr   c                 ó~   € V P                  4       P                  R 4      '       d   V R,          P                  4       # T # )ztitle::é   NN)r   rw   rG   ©rŠ   s   &r   Ú_strip_title_prefixrÑ   e  s.   € Ø#Ÿz™z›|×6Ñ6°x×@Ò@ˆ4��8�>‰>ÓÐJÀdÐJr   c                ó0   € V ^8„  d   QhR\         R\         /# r‰   rC   )r   s   "r   r   r   i  s   € ÷ Lñ L”cð Lœcñ Lr   c                 óD   € \        R  V P                  4        4       R4      # )c              3   óp   "  € T F,  qP                  4       '       g   K  VP                  4       x € K.  	  R # 5i©N)rG   )r!   Úlns   & r   r#   Ú_first_line.<locals>.<genexpr>j  s"   é € ÐFÑ&7 ¿8¹8¿:”�—‘—�Ó&7ùs   ‚6ž6r$   )ÚnextÚ
splitlinesrÐ   s   &r   rÅ   rÅ   i  s   € ÜÑF d§o¡oÔ&7ÓFÈÓKÐKr   c                óF   € V ^8„  d   QhR\         R\        \         ,          /# ©r   Úrawr   rÁ   )r   s   "r   r   r   m  s   € ÷ ñ œSð ¤X¬c¥]ñ r   c                óZ  €  \         P                  ! V 4      p\        V\        4      '       d=   \        VP	                  R4      \
        4      '       d   VR,          P                  4       # \        P                  ! RT 4      pT'       dZ   \        \        4      ;_uu_ 4        \         P                  ! RTP                  ^4       R24      P                  4       uuRRR4       # R#   \        \        3 d     L�i ; i  + '       g   i     M; iTP                  ^4      P                  4       # )uq   Title from a ``{"title": ...}`` payload â€” strict parse, then a loose ``"title": "..."`` scan; None when absent.r/   z""title\"\s*:\s*"((?:[^"\\]|\\.)*)"Ú"N)ÚjsonÚloadsr²   r9   r@   rD   rG   Ú
ValueErrorÚ	TypeErrorÚreÚsearchr   Úgroup)rÜ   ÚparsedÚmatchs   &  r   Ú_extract_json_titlerè   m  s×   € ðÜ—’˜C“ˆÜ�fœd×#Ò#¬
°6·:±:¸gÓ3FÌ×(LÒ(LØ˜'•?×(Ñ(Ó*Ð*ô �IŠIÐ;¸SÓA€EßÜ”j×!Õ!Ü—:’:  %§+¡+¨a£.Ð!1°Ð3Ó4×:Ñ:Ó<÷ "Ò!ñ øô œ	Ð"ô Ùðú÷ "×!úà�{‰{˜1‹~×#Ñ#Ó%Ð%s   ‚A'C$ Â 7C;Ã$C8Ã7C8Ã;D	c                ó0   € V ^8„  d   QhR\         R\        /# rÛ   rp   )r   s   "r   r   r   }  s   € ÷ gñ g¬ð g´ñ gr   c                óœ   € V P                  R4      ;'       g5    V P                  R4      ;'       d    V P                  R4      ^,          ^8H  # )a=  Structured output the token cap cut before its closing quote/brace/fence (``{"title``, a bare fence opener).

Checked only after the JSON paths failed, and on structure alone (a JSON-shaped opener, a fence
opener that is never closed) so quoted, *emphasized* or ``[WIP]``-prefixed prose titles are
untouched (#83903).z```)z{"z["z[{)rw   Úcount)rÜ   s   &r   Ú_is_truncated_structured_outputrì   }  sC   € ð �>‰>Ð,Ó-×fÐf°#·.±.ÀÓ2G×2eÐ2eÈCÏIÉIÐV[ÓL\Ð_`ÕL`ÐdeÑLeÐfr   c                ó0   € V ^8„  d   QhR\         R\         /# )r   Úcontentr   rC   )r   s   "r   r   r   †  s   € ÷ Fñ F¤ð F¬ñ Fr   c                ó  € V '       g   R# V P                  4       p\        P                  ! RV\        P                  4      pV'       d    VP	                  ^4      P                  4       p\        V4      pVe   V# \        V4      '       d   R#  ^ RIHp V! RV4      P                  4       p\        \        V4      4      P                  R4      P                  4       #   \         d    \        P                  RRR7        LUi ; i)	a  Strict JSON, then a loose JSON scan, then first-line prose (a provider ignoring ``response_format`` still titles).

A truncated structured payload is dropped rather than handed to the prose fallback: the fragment
would otherwise be persisted as the session title.r$   z^```(?:json)?\s*(.*?)\s*```$N)Ústrip_think_blocksz/strip_think_blocks unavailable for title outputTrT   ú"')rG   rã   rç   ÚDOTALLrå   rè   rì   Úagent.agent_runtime_helpersrð   rH   rX   rY   rÑ   rÅ   )rî   rÜ   Úfencedr/   rð   s   &    r   Ú_extract_title_textrõ   †  sÑ   € ÷
 ÙØ
�-‰-‹/€CÜ�XŠXÐ5°s¼B¿I¹IÓF€FßØ�l‰l˜1‹o×#Ñ#Ó%ˆÜ Ó$€EØÒØˆÜ& s×+Ò+ÙðWÝBÙ   sÓ+×1Ñ1Ó3ˆô œ{¨3Ó/Ó0×6Ñ6°uÓ=×CÑCÓEÐEøô ô WÜ�‰ÐFÐQUˆÖVðWús   ÂC Ã"D Ã?D c                ó0   € V ^8„  d   QhR\         R\        /# rž   )r   rD   )r   s   "r   r   r   Ÿ  s   € ÷ 
ñ 
¤3ð 
¬3ñ 
r   c                óÚ   € R Fd  p\        WR4      p\        V\        4      '       g   K'  VP                  4       '       g   K?  \	        VP                  4       4      pV'       g   Kb  Vu # 	  R# )a  The ``{"title": ...}`` payload when a reasoning model put it in ``reasoning_content`` / ``reasoning``
and left ``content`` empty (glm-5 / minimax under ``json_schema``, #82291). Structured extraction only:
chain-of-thought prose is never a title, so there is no prose fallback here.Nr$   )Úreasoning_contentÚ	reasoning)Úgetattrr²   rD   rG   rè   )rŸ   ÚfieldrŠ   r/   s   &   r   Ú_title_from_reasoningrü   Ÿ  sP   € ó 4ˆÜ�w tÓ,ˆÜ�dœC× Ô  T§Z¡Z§\¤\Ü'¨¯
©
«Ó5ˆEß‰uØ’ñ 4ñ r   c                óF   € V ^8„  d   QhR\         R\        \         ,          /# r‰   rÁ   )r   s   "r   r   r   ¬  s   € ÷ ñ ”sð œx¬�}ñ r   c                ó2  € \        RP                  T ;'       g    RP                  4       4      P                  R4      P                  4       4      P	                  R4      p\        V4      ^P8”  d   VR,          P	                  4       R,           pT;'       g    R# )zFNormalize a model-produced title, or None when nothing usable remains.rÃ   r$   rñ   z.!,;::NéM   Nz...N)rÑ   r   rÆ   rG   rh   r�   )rŠ   r/   s   & r   Ú_clean_titler   ¬  sr   € ä §¡¨$¯*¨*°"×);Ñ);Ó)=Ó >× DÑ DÀUÓ K× QÑ QÓ SÓT×[Ñ[Ð\cÓd€EÜ
ˆ5ƒz�B„Ø�c•
×!Ñ!Ó# eÕ+ˆØ�=ˆ=�DÐr   c          
      ób   € V ^8„  d   QhR\         \        ,          R\        R\        R\        RR/# )r   ÚcallbackÚargsÚlog_fmtÚlabelr   N)r   r   ÚtuplerD   )r   s   "r   r   r   ´  s6   € ÷ 4ñ 4œX¤hÕ/ð 4´uð 4Äsð 4ÔSVð 4Ð[_ñ 4r   c                ór   €  V e	   V ! V!   R# R#   \          d    \        P                  Y#RR7        R# i ; i)z4Invoke an optional consumer callback, never raising.NTrT   )rH   rX   rY   )r  r  r  r  s   &&&&r   Ú_safe_callbackr  ´  s8   € ð4ØÒÙ�dŒOñ  øäô 4Ü�‰�W¨dˆ×3ð4ús   ‚
 �"6µ6c                óV   € V ^8„  d   QhR\         \        ,          R\        R\        RR/# )r   Úfailure_callbackÚexcr  r   N)r   ÚFailureCallbackÚBaseExceptionrD   )r   s   "r   r   r   ½  s5   € ÷ eñ e¤h¬Õ&?ð eÄmð eÔ\_ð eÐdhñ er   c                 ó&   € \        V R V3RV4       R# )ztitle generationz%s failure_callback raisedN©r  )r
  r  r  s   &&&r   Ú_report_failurer  ½  s   € ÜÐ#Ð&8¸#Ð%>Ð@\Ð^cÖdr   c          
      ób   € V ^8„  d   QhR\         \        ,          R\        R\        R\        RR/# )r   Útitle_callbackr/   Úsourcer  r   N)r   ÚTitleCallbackrD   )r   s   "r   r   r   Á  s=   € ÷ Qñ Q¤(¬=Õ"9ð QÄ#ð QÌsð QÔ[^ð QÐcgñ Qr   c                 ó$   € \        WV3R V4       R# )z%s callback failedNr  )r  r/   r  r  s   &&&&r   Ú_notify_titler  Á  s   € Ü�>¨6 ?Ð4HÈ%ÖPr   c                ó0   € V ^8„  d   QhR\         R\        /# ©r   r/   r   rp   )r   s   "r   r   r   Å  s   € ÷ añ a¬#ð a´$ñ ar   c                ó¶   € \         P                  ! RRV P                  4       \         P                  R7      P	                  4       pV\
        \
        R,           39   # )zcThe prompt's greeting placeholder (also "Friendly greeting in chat" and quoted/bracketed variants).ú^[\W_]+|[\W_]+$r$   ©Úflagsz in chat)rã   r¢   rG   ÚUNICODEr   Ú_PROVISIONAL_GREETING_TITLE©r/   Ú
normalizeds   & r   Ú_is_provisional_greeting_titler!  Å  sB   € ä—’Ð*¨B°·±³ÄRÇZÁZÔP×VÑVÓX€JØÔ5Ô7RÐU_Õ7_Ð`Ñ`Ð`r   c                ó0   € V ^8„  d   QhR\         R\        /# r  rp   )r   s   "r   r   r   Ë  s   € ÷ 	.ñ 	.¤3ð 	.¬4ñ 	.r   c                óœ   € \         P                  ! RRV P                  4       \         P                  R7      P	                  4       pV\
        9   # )uk  Return True when *title* is one of the prompt's own example titles.

Comparison is case-insensitive after stripping any leading/trailing run of
non-letter/non-digit characters, so bracket/quote wrappers cannot bypass
the guard â€” while ``_clean_title`` keeps brackets for real titles like
"(WIP) Fix build". Unicode-aware so full-width wrappers are covered too.
r  r$   r  )rã   r¢   rG   r  r   Ú_EXAMPLE_ECHO_REJECTr  s   & r   Ú_is_prompt_example_echor%  Ë  s8   € ô —’Ð*¨B°·±³ÄRÇZÁZÔP×VÑVÓX€JØÔ-Ñ-Ð-r   c                óà   € V ^8„  d   QhR\         R\        \        ,          R\        \        ,          R\        R,          R\        \
        ,          R\         R,          R\        \         ,          /# )	r   r¨   r   r
  ra   NÚruntime_validatorr°   r   )rD   r   r   r  r9   ÚRuntimeValidator)r   s   "r   r   r   ×  sr   € ÷ Yñ YÜðYä”e�_ðYô œÕ/ðYô ˜•+ð	Yô
  Ô 0Õ1ðYô ˜•:ðYô Œc…]ñYr   c                ó¨  € \        4       '       g   \        P                  R4       R#  Ve%   V! 4       '       g   \        P                  R4       R# \	        Y4      pTP                  4       '       d   T'       g   \        T4      '       d   R# \        4       p\        P                  RT'       d   \        P                  TR7      M\        4      p \        R	R
RRT/R
RRT/.\        RYR\        /RR/R7      p	T	P                   ^ ,          P"                  p
\%        \'        T
P(                  ;'       g    R4      ;'       g    \+        T
4      4      pTeW   \-        TP/                  4       4      \0        8”  d5   \        P                  R\-        TP/                  4       4      \0        4       R# Te*   \3        T4      '       d   \        P                  RT4       R# T#   \         d    \        P                  RRR7        EL­i ; i  \         dE   p\        P5                  RT4       \        P                  RRR7       \7        Y,R4        Rp?R# Rp?ii ; i)u®  Title from the opening message alone (waiting for the assistant made this slow and bought
nothing). ``runtime_validator`` runs right before the request; False skips silently.

If it returns False (e.g. the user's model was switched since the background thread captured its runtime
snapshot), the call is skipped silently â€” no request is sent, so a stale title request can't reload a
model the runtime already unloaded (#19027).
ú<Auto-title skipped: auxiliary.title_generation.enabled=falseNz:Title generation skipped: runtime validator returned Falsez*Title runtime validator raised; proceedingTrT   Ú__LANGUAGE_RULE__)rF   r>   ÚroleÚsystemrî   ÚuserÚresponse_formatrQ   F)ÚtaskÚmessagesÚ
max_tokensÚtemperaturer   ra   Ú
extra_bodyÚreasoning_configr$   z4Rejecting answer-shaped title output (%d words > %d)z'Rejecting prompt-example echo title: %rzTitle generation failed: %szTitle generation tracebackzTitle generation)rZ   rX   rY   rH   rº   rG   r¥   rI   Ú_TITLE_PROMPT_TEMPLATEÚreplaceÚ_LANGUAGE_RULE_PINNEDr   Ú_LANGUAGE_RULE_MATCH_USERr   ÚTITLE_MAX_TOKENSÚ_TITLE_RESPONSE_FORMATÚchoicesrŸ   r   rõ   rî   rü   r�   rÆ   Ú_MAX_TITLE_WORDSr%  Úwarningr  )r¨   r   r
  ra   r'  r°   Úuser_snippetrF   ÚpromptÚresponserŸ   r/   Úes   &&&&&&       r   Úgenerate_titlerC  ×  s   € ô × Ò Ü�‰ÐSÔTÙðRØÒ(Ñ1B×1DÒ1DÜ�L‰LÐUÔVÙô % \ÓA€LØ×Ñ×Ò÷ Ô5°l×CÒCáÜÓ €Hä#×+Ñ+Ø×PXÔ2×9Ñ9À8Ð9ÔLÔ^wó€Fð4ô Ø#Ø˜x¨°FÐ;¸fÀfÈiÐYeÐ=fÐgô (°TÀ7Ø)Ô+AÐBð (¨Ð/ô!
ˆð$ ×"Ñ" 1Õ%×-Ñ-ˆÜÔ0°·±×1FÐ1FÀBÓG×iÐiÔK`ÐahÓKiÓjˆð Ò¤ U§[¡[£]Ó!3Ô6FÔ!Fä�L‰LÐOÔQTÐUZ×U`ÑU`ÓUbÓQcÔeuÔvÙð ÒÔ!8¸×!?Ò!?Ü�L‰LÐBÀEÔJÙØˆøô{ ô RÜ�‰ÐAÈDˆ×QðRûô| ô ä�‰Ð4°aÔ8Ü�‰Ð1¸DˆÔAÜÐ(Ð-?Ô@ÝûðúsB   ©G ºG ÃA/H Å A(H Æ*+H ÇH Ç"G?Ç>G?ÈIÈ9IÉIc                ó0   € V ^8„  d   QhR\         R\        /# ©r   Ú
session_idr   rp   )r   s   "r   r   r   3  s   € ÷ ñ ´ð ¼ñ r   c                ó”   €  \        V RR4      pVe   V! V4      R9  # \        V P                  V4      4      #   \         d     R# i ; i)zUTrue when the session already carries an ``llm``/``user`` title (or the check fails).Úget_session_title_sourceNT)NÚderived)rú   rL   Úget_session_titlerH   )Ú
session_dbrF  Ú	source_fns   && r   Ú_has_upgraded_titlerM  3  sU   € ðÜ˜JÐ(BÀDÓIˆ	ØÒ Ù˜ZÓ(Ð0AÑAÐAÜ�J×0Ñ0°Ó<Ó=Ð=øÜô Úðús   ‚8 ž8 ¸AÁAÚdedupec               óÞ   a aaa€ \        S RR4      oVV VV3R lp V! V4      #   \         d>    \        S RR4      pT'       d   Te	   T! T4      MRpT'       d   Yr8X  d   h T! T4      u # i ; i)u‚  Persist at *source* authority via ``set_auto_title`` (precedence check + write in one
transaction, so a manual ``/title`` is never overwritten); None when a higher authority held the row.
``ValueError`` = unique-title index collision â†’ append ``#N`` via ``get_next_title_in_lineage``;
``dedupe=False`` re-raises instead (the derived title is on the critical path, collides constantly
on "hi", and the model replaces it a second later anyway).

``ValueError`` means the name is taken by an unrelated session (the unique-title index); rather than
leave the session untitled (#50537), append a ``#N`` suffix via ``get_next_title_in_lineage``.
Úset_auto_titleNc                 óú   <€ Se-   S! SV SR7      '       d   V # \         P                  RSS4       R # \        SRR 4      pVe   V! SV 4      '       d   V # R # SP                  SV 4      RJ d   \	        RS R24      hV # )N©r  zDSkipping %s title: a higher-authority title already holds session %sÚset_auto_title_if_emptyFzsession z not found when storing title)rX   rY   rú   Úset_session_titleÚRuntimeError)Ú	candidateÚ	legacy_fnÚauto_fnrK  rF  r  s   & €€€€r   Ú_setÚ$_persist_session_title.<locals>._setJ  s�   ø€ ØÒÙ�z 9°V×<Ó<Ø Ð Ü�L‰LÐ_ÐagÐisÔtÙÜ˜JÐ(AÀ4ÓHˆ	ØÒ Ù )¨*°i× @Ò @�9ÐJÀdÐJØ×'Ñ'¨
°IÓ>À%ÓGÜ ¨*¨Ð5RÐSÓTÐTØÐr   Úget_next_title_in_lineage)rú   rá   )	rK  rF  r/   r  rN  rY  Únext_title_fnÚdedupedrX  s	   ff&d$   @r   Ú_persist_session_titler^  >  st   û€ ô �jÐ"2°DÓ9€G÷ð ðÙ�E‹{ÐøÜô Ü 
Ð,GÈÓNˆß*0°]Ò5N‘- Ô&ÐTXˆß˜'Ô*ØÙ�G‹}Òðús   œ$ ¤5A,ÁA,Á+A,c                óR   € V ^8„  d   QhR\         R\         R\        \         ,          /# )r   rF  Úgoalr   rÁ   )r   s   "r   r   r   a  s%   € ÷ 	ñ 	´ð 	¼Cð 	ÄHÌSÅMñ 	r   c                óÊ   €  \        V4      '       d   \        V4      MRpV'       d   \        WRV 2RR7      # R#   \         d    \        P                  RTRR7        R# i ; i)a  Title a delegate run ``Subagent: <goal's first line>`` at ``derived`` authority. No model call:
runs fan out in bulk, and the prefix alone is what tells them apart from conversations wherever
``sessions.show_subagents`` lists them (#97202). Collisions get ``#N``. Never raises.Nz
Subagent: rI  rR  zSubagent title failed for %sTrT   )r¿   rÌ   r^  rH   rX   rY   )rK  rF  r`  rI  s   &&& r   Úapply_subagent_titlerb  a  sb   € ðÜ(AÀ$×(GÒ(G”,˜tÔ$ÈTˆßkrÔ% jÀ
È7È)Ð>TÐ]fÔgÐ|Ðx|Ð|øÜô Ü�‰Ð3°ZÈ$ˆÔOÚðús   ‚%; ¨; ¹; »#A"Á!A"c                óŽ   € V ^8„  d   QhR\         R\         R\        \        ,          R\         R,          R\        \         ,          /# )r   rF  r¨   r  r°   Nr   )rD   r   r  )r   s   "r   r   r   m  sC   € ÷ ñ ÜðÜ/2ðÜDLÌ]ÕD[ðä˜•:ðô Œc…]ñr   c                ó  € V '       d	   V'       g   R#  \        V4      '       d   \        W$4      MRpV'       d   \        WVRRR7      MRpV'       d   \        W6RR4       V#   \         d    \
        P                  RRR7        R# i ; i)	a+  Write the derived title inline. Returns it, or None (no usable text, or a ``derived``+ title exists). Never raises.

``title_preview`` must reach this stage too: the model upgrade's own ``derive_title`` fallback writes
``derived`` provenance, which never replaces the ``derived`` title written here.NrI  F)r  rN  zInstant-titlezInstant title failedTrT   )r¿   rÌ   r^  r  rH   rX   rY   )rK  rF  r¨   r  r°   r/   Ú	persisteds   &&&&&  r   Úapply_instant_titlerf  m  sy   € ÷ ŸZÙðÜ=VÐWc×=dÒ=d”˜\Ô9ÐjnˆßmrÔ*¨:À5ÐQZÐchÕiÐx|ˆ	ßÜ˜.°YÀÔPØÐøÜô Ü�‰Ð+°dˆÔ;Úðús   ”%A" ºA" ÁA" Á""BÂBc                óÎ   € V ^8„  d   QhR\         R\         R\        \        ,          R\        R,          R\        \        ,          R\        \
        ,          R\         R,          R	R/# )
r   rF  r¨   r
  ra   Nr  r'  r°   r   )rD   r   r  r9   r  r(  )r   s   "r   r   r   ‚  sr   € ÷ 2;ñ 2;äð2;ô ð2;ô œÕ/ð	2;ô
 ˜•+ð2;ô œ]Õ+ð2;ô  Ô 0Õ1ð2;ô ˜•:ð2;ð 
ñ2;r   c                ó&  €  V '       d   V'       d   \        W4      '       d   R# ^ RIHp ^ RIHp	 Tp
\        \        4      ;_uu_ 4        V P                  V4      ;'       g    Tp
RRR4       V	! V
4       V! W4       \        W#VWgR7      RrËV'       d   \        V4      '       d   RpV'       g   \        W'4      RrËV'       g   R#  \        WW¼R7      pTe&   \        P                  R	T4       \        Y]TR
4       R# R#   + '       g   i     L¡; i  \         d"   p\        P                  RT4        Rp?R# Rp?ii ; i  \         dE   p\        P                  RT4       \        P                  RRR7       \!        Y>R
4        Rp?R# Rp?ii ; i)u‹  Generate and store the model title (daemon-thread target); skips sessions already carrying an
``llm``/``user`` title (a ``derived`` one is expected â€” upgrading it is the point). Never lets an
exception escape (the threading excepthook would spray a traceback into the terminal); the canonical
trigger is the post-``hermes update`` window where lazy imports read NEW source against OLD modules.N)Úset_accounting_context)Úset_conversation_context)r
  ra   r'  r°   ÚllmrI  rR  z&Failed to set auto-generated title: %sz Auto-generated session title: %sz
Auto-titlezeAuto-title failed (harmless; if this started after an update, restart the running Hermes process): %szAuto-title tracebackTrT   )rM  Úagent.aux_accountingri  Úagent.portal_tagsrj  r   rH   Úget_conversation_rootrC  r!  rÌ   r^  rX   rY   r  r>  r  )rK  rF  r¨   r
  ra   r  r'  r°   ri  rj  Úconversation_idr/   r  re  rB  s   &&&&&&&&       r   Úauto_title_sessionrp  ‚  sR  € ð$;ß§Ô/BÀ:×/ZÒ/ZÙõ 	@Ý>Ø$ˆÜ”i× Õ Ø(×>Ñ>¸zÓJ×XÐXÈjˆO÷ !á  Ô1ñ 	˜zÔ6Ü&ØÈ,Ø/ô
ð ð ÷ Ô3°E×:Ò:ØˆFßÜ(¨ÓEÀy�6ßÙð	Ü.¨zÀuÔ\ˆIð Ò Ü�L‰LÐ;¸YÔGÜ˜.°V¸\ÖJñ !÷+ !× ûô$ ô 	Ü�L‰LÐAÀ1ÔEÝûð	ûô ô ;ä�‰Ð~ð  ABô  	CÜ�‰Ð+°dˆÔ;ÜÐ(¨\×:Ò:ûð	;úso   ‚E ŠE ’E ¥%E Á
C?Á&A	E Â0E ÃD Ã'E Ã?D	Ä
E ÄD>ÄD9Ä3E Ä9D>Ä>E ÅFÅ9FÆFc                ó0   € V ^8„  d   QhR\         R\        /# rž   )r   rL   )r   s   "r   r   r   ·  s   € ÷ mñ m¤ð m¬ñ mr   c                óà   € \        V \        4      '       d   V P                  R4      R8w  d   R# V P                  R4      p\        \        V\        4      '       d   V4      # \        V4      4      # )zUA question a person actually asked (Hermes persists machinery under ``role="user"``).r,  r.  Frî   )r²   r9   r@   r¿   rD   r	   )rŸ   rî   s   & r   Ú_is_real_user_turnrs  ·  sV   € ä�gœt×$Ò$¨¯©°FÓ(;¸vÔ(EÙØ�k‰k˜)Ó$€GÜ$´
¸7ÄC×0HÒ0H WÓlÐlÔNbÐcjÓNkÓlÐlr   c                ó0   € V ^8„  d   QhR\         R\        /# rE  rp   )r   s   "r   r   r   ¿  s   € ÷ ñ ´ð ¼ñ r   c                óô   € \        V RR4      p \        V4      ;'       d/    \        V! V4      ;'       g    R4      P                  4       '       * #   \         d    \
        P                  RTRR7        R# i ; i)zfNo title of any provenance; False when it can't tell (no model call per turn for an unreadable title).rJ  Nr$   zUntitled check failed for %sTrT   F)rú   ÚcallablerD   rG   rH   rX   rY   )rK  rF  Úgetters   && r   Ú_session_is_untitledrx  ¿  sl   € ä�ZÐ!4°dÓ;€FðÜ˜Ó×MÐM¬©F°:Ó,>×,DÐ,DÀ"Ó(E×(KÑ(KÓ(MÔ$MÐMøÜô Ü�‰Ð3°ZÈ$ˆÔOÚðús   �A ¡A ¶A Á#A7Á6A7c                ó:   € V ^8„  d   QhR\         \        ,          /# r8   )r   rD   )r   s   "r   r   r   É  s   € ÷ -ñ -œH¤S�Mñ -r   c                 óº  € \         P                  P                  R4      ;'       g    RP                  4       p V '       d   \	        4       '       g   R#  ^ RIHpHp ^ RIH	p VP                  4       ;_uu_ 4       pVP                  W@4      pRRR4       Xe4   RP                  VP                  ;'       g    RP                  4       4      MRpVP                  ^,
          p\!        V4      V8”  d"   VRV^,
           P#                  4       R,           pT;'       g    RT  2#   + '       g   i     Lœ; i  \$         d    \&        P)                  RT R	R
7       Rp LIi ; i)zÇKanban worker: the card's title, or ``Kanban task <id>`` when the board can't be read; None elsewhere
(including delegate_task children of the worker, which inherit the env var but are not the card).ÚHERMES_KANBAN_TASKr$   N)Ú	kanban_dbÚkanban_db_connect)Ú	SessionDBrÃ   rÄ   z:Kanban task %s unreadable; naming the session after its idTrT   zKanban task )ÚosÚenvironr@   rG   r   Ú
hermes_clir|  r}  Úhermes_stater~  Úconnect_closingÚget_taskr   r/   rÆ   ÚMAX_TITLE_LENGTHr�   rh   rH   rX   rY   )Útask_idr|  r}  r~  Úconnr0  r/   Úcaps           r   Ú_kanban_task_titler‰  É  s  € ô �z‰z�~‰~Ð2Ó3×9Ð9°r×@Ñ@ÓB€GßÔ<×>Ò>Ùðß;Ý*Ø×.Ñ.×0Ô0°DØ×%Ñ% dÓ4ˆD÷ 1à8<Ò8H�—‘˜$Ÿ*™*×*Ð*¨×1Ñ1Ó3Ô4Èbˆð ×(Ñ(¨1Õ,ˆÜˆu‹:˜ÔØ˜)˜C !�GÐ$×+Ñ+Ó-°Õ5ˆEð ×,Ð,�l 7 )Ð,Ð,÷ 1×0ûô ô Ü�‰ÐQÐSZÐeiˆÔjØŠðús1   Á&D2 Á9DÂ)D2 Â5AD2 ÄD/	Ä*D2 Ä2%EÅEc                ó"  € V ^8„  d   QhR\         R\         R\        \        ,          R\        \        ,          R\        R,          R\        \
        ,          R\        \        ,          R	\         R,          R
\        \        P                  ,          /	# )r   rF  r¨   Úconversation_historyr
  ra   Nr  r'  r°   r   )	rD   r   r   r  r9   r  r(  r�   r‚   )r   s   "r   r   r   à  s–   € ÷ @ñ @äð@ô ð@ô #¤4�.ð	@ô
 œÕ/ð@ô ˜•+ð@ô œ]Õ+ð@ô  Ô 0Õ1ð@ô ˜•:ð@ô Œi×ÑÕñ@r   c	           	     óœ  € V '       d   V'       d	   V'       g   R# \        R T;'       g    .  4       4      p	V	^8”  d,   \        W4      '       g   V	^8”  d   \        W4      '       g   R# \        4       p
V
'       dF   \	        \
        4      ;_uu_ 4        \        WV
RR7      pV'       d   \        WkRR4       RRR4       R# \        V4      '       g   R# \        4       '       g   \        P                  R4       R# \        WW&VR7       \        4       '       g   \        P                  R4       R# ^ R	IHp \!        WEVVR
7      p\#        V\$        4      '       d   VP'                  4       '       d   W�R&   V! \(        RWV3VR7      p\+        V4      '       d   \        P                  R4       V# \-        V4       V#   + '       g   i     R# ; i)u-  Instant inline title, then a daemon-thread upgrade. Call at the START of a turn, before the model.

Returns the upgrade thread: already started, or â€” when ``title_upgrade_must_wait_for_turn`` â€” left
UNSTARTED for the caller to hand to ``start_title_upgrade`` once the turn's model request settled.Nc              3   óL   "  € T F  p\        V4      '       g   K  ^x € K  	  R# 5i)r–   N)rs  )r!   Úms   & r   r#   Ú#maybe_auto_title.<locals>.<genexpr>ö  s   é € ÐZÑ%?˜qÔDVÐWX×DYŸšÓ%?ùs   ‚$š
$rk  rR  zKanban task titler*  )r°   ziInstant title persisted; model upgrade disabled by auxiliary.title_generation.model_upgrade_enabled=false)Úspawn_context_thread)r
  ra   r  r'  r°   z
auto-title)r)   r  Úkwargsz`Auto-title upgrade deferred past the turn: shares the self-hosted endpoint with the main request)ÚsumrM  rx  r‰  r   rH   r^  r  r¿   rZ   rX   rY   rf  r_   Úagent.memory_providerr�  r9   r²   rD   rG   rp  rn   r‡   )rK  rF  r¨   r‹  r
  ra   r  r'  r°   Úuser_msg_countÚkanban_titlere  r�  Úupgrade_kwargsr€   s   &&&&&&&&&      r   Úmaybe_auto_titler—  à  sx  € ÷ ŸZ¯|Ùô ÑZÐ%9×%?Ð%?¸RÐ%?ÓZÓZ€NØ˜ÔÜ˜J×3Ò3Ø˜QÔÔ';¸J×'SÒ'SáÜ%Ó'€Lßô ”i× Õ Ü.¨zÀ|Ð\aÔbˆIßÜ˜n¸Ð@SÔT÷ !ñ Ü$ \×2Ò2ÙÜ× Ò Ü�‰ÐSÔTÙÜ˜
°Ð\iÕjÜ'×)Ò)Ü�‰ð  Aô  	BÙõ ;ÜÐ+;ÐguØ,=ô?€Nä�-¤×%Ò%¨-×*=Ñ*=×*?Ò*?Ø*7�Ñ'Ù"Ü Ø lÐ3Øô€Gô
 (¨×5Ò5Ü�‰ÐwÔxØˆÜ˜Ô Ø€N÷? !Ö ñ ús   Â$F:Æ:G	c                ó~   € V ^8„  d   Qh/ ^ \         9   d)   \        P                  \        P                  ,          ;R&   # )r   r   )Ú__conditional_annotations__ÚweakrefÚWeakSetr�   r‚   )r   s   "r   r   r      s.   € ÷ /ñ /÷6 HÒ G”'—/‘/¤)×"2Ñ"2Õ3Ñ Gò7/r   )g      $@)zFix login button on mobilez#Postgres connection pool exhaustionr   )
zcommand-messagezcommand-namezcommand-argszlocal-command-caveatzlocal-command-stderrzlocal-command-stdoutztask-notificationzsystem-reminderÚide_opened_fileÚide_selectionrÕ   )NNNNN)NN)NNNNNN)br™  Ú__doc__rß   Úloggingr  rã   r�   r   rš  Ú
contextlibr   Útypingr   r   r   Úagent.auxiliary_clientr   Úagent.context_compressorr   Úagent.delegation_contextr   Úagent.message_contentr	   Ú	getLoggerÚ__name__rX   r›  r   r   rD   r  r  r  rL   r(  r³   r¶   Úcompiler´   rò   r£   rÇ   r=  r:  Ú_PROMPT_GOOD_EXAMPLESÚ_PROMPT_VAGUE_EXAMPLEÚ	frozensetr   r$  r  r   r6  r9  r8  r;  r  rŽ   r¾   rA   rI   rZ   r_   rn   rg   ri   r‡   r“   r�   Ú_QUOTEDr¡   r¥   r­   rº   r¿   rÌ   rÑ   rÅ   rè   rì   rõ   rü   r   r  r  r  r!  r%  rC  rM  r^  rb  rf  rp  rs  rx  r‰  r—  r   )r™  s   @r   Ú<module>r­     s  øðö/ó Û Û 	Û 	Û Û Û Ý ß *Ñ *å +Ý :Ý GÝ 6à	×	Ò	˜8Ó	$€ð
 7>·o²oÓ6GÐ Ó G÷;ð ˜C Ð/°Ð5Õ6€ð ˜#˜s˜ TÐ)Õ*€ð ˜B ˜HÕ%Ð ð Ð Ø.Ð Ø—Z’ZÐ 7Ó8Ð à—Z’ZÐ WÐY[×YbÑYbÓcÐ àÐ ð Ð ð Ð ðÐ ð
 'Ð ñ !ñ !Ù,ó!ó à× Ñ Ó"Ð#õ$Ð ð 2Ð ð
ð 	‡g�gÑKÑ5JÓKÓKõLð 	 Ð 5Ð6ð 7-ð -õ-ð ð& \Ð Ø:Ð ð ˆMØ�F˜O¨X°t¸XØ�˜,¨°6¸8Ð2DÐ(EÀzÐT[ÐS\Ð^tÐv{ðH}ð ~ðÐ ÷ �Eñ ñtó—E‘Eñ ñtóó Ð ð Ð0Ð2BÀOÐU_ð >ð
Ð õaõõõõCõ:Yõ_õ(õõ
ð& 2€ð !ŸjšjØ% g YÐ.EÐFóÐ õ
 õ
T÷Võ4;÷õKõLõõ gõFõ2
õõ4õeõQõaõ	.÷Yõxð ÈDô  õF	÷÷*2;õjmõõ-÷.@ñ @r   