+
    lHàj’$  ã                    ó¸  € R t ^ RIHtHtHtHt ^ RIHtHt ^ RI	H
t ^ RIHt ^ RIHt ^ RIHtHtHtHtHt ^ RIHtHt RR	R
R	RR	RR	RR	RR	RR	RR/R R lltRRRRRRRRRRRR]! ]4      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R0//R,. //t]P8                  ! RR1]R2 R3 R4R57       ]P8                  ! R6R7]R8 R9R:7       R	# );z‹Connection lifecycle tool for managed gateway accounts and local MCP servers.

Disconnecting accounts remains a portal-only user decision.
)ÚAnyÚCallableÚDictÚOptional)ÚMANAGE_CATALOG_SCHEMAÚmanage_catalog)Úconfig)Úrun_managed_action)Úrun_mcp_operation)ÚALIAS_PATTERNÚALL_ACTIONSÚMCP_ACTIONSÚnormalize_targetsÚvalidate_action)ÚregistryÚ
tool_errorÚclient_factoryNÚmcp_backendÚ
session_idÚtool_call_idÚturn_idÚconnection_callbackÚconnectors_availableÚcard_surfaceFc                óÜ  € V ^8„  d   QhR\         \        \        3,          R\        \        . \        3,          ,          R\        \        ,          R\        \        ,          R\        \        ,          R\        \        ,          R\        \        \         \        \        3,          .\        \        ,          3,          ,          R\        \        . \
        3,          ,          R	\
        R
\        /
# )é   Úargsr   r   r   r   r   r   r   r   Úreturn)ÚdictÚstrr   r   r   Úbool)Úformats   "Ú:/home/ubuntu/.hermes/hermes-agent/tools/connectors/tool.pyÚ__annotate__r#      sÀ   € ÷ ñ Ü
Œs”Cˆx�.ðô œX b¬# gÕ.Õ/ðô œ#•ð	ô
 œ•ðô œ3•-ðô ”c�]ðô "¤(¬D´´c°­NÐ+;¼XÄc½]Ð+JÕ"KÕLðô #¤8¨B´¨HÕ#5Õ6ðô ðô 	ñó    c                óv  € \        V P                  R 4      ;'       g    R4      P                  4       P                  4       p	\	        V P                  R4      4      w  r«pV'       d   \        V4      # \        WšV4      pV'       d   \        V4      # V	\        9   d   \        W¹VWcVR7      # \        WšV WWEWgVR7
      # )ÚactionÚstatusÚ
connectors)Úbackendr   r   r   )r   r   r   r   r   r   r   )
r   ÚgetÚstripÚlowerr   r   r   r   r
   r	   )r   r   r   r   r   r   r   r   r   r&   ÚmanagedÚmcp_targetsÚtarget_errorÚaction_errors   &$$$$$$$$     r"   Úmanage_connectionsr1      s°   € ô �—‘˜(Ó#×/Ð/ xÓ0×6Ñ6Ó8×>Ñ>Ó@€FÜ):¸4¿8¹8ÀLÓ;QÓ)RÑ&€G˜,ßÜ˜,Ó'Ð'Ü" 6°KÓ@€LßÜ˜,Ó'Ð'à”ÔÜ Ø¨Ø 3ÐYeô
ð 	
ô
 Ø˜Ø%È<Ø/Ø!ô	ð r$   Únamer1   Údescriptionu²  Connect the user to apps. Two kinds: a hosted connector account (Gmail, Notion, ...) served through the tool gateway, and a local MCP server from the bundled catalog. Targets go in 'connectors': a bare slug or {"name": "gmail"} is a hosted connector account; {"name": "linear", "mcp": true} is a local MCP server. Many names exist on both sides, so the user's own words decide. Pass "mcp": true only when the user asks for an MCP server, a local server or an install, or when the name exists only as a catalog entry; otherwise the target is hosted. 'connect' and 'reconnect' are hosted actions; 'install', 'enable' and 'authorize' are MCP actions. A target the other side owns is refused with the call that does work. Hosted actions: 'display' (desktop only; elsewhere returns status) shows every connector and waits for Continue (300 s); put slugs to suggest in 'connectors'. Returns connected/newly_connected (+timed_out); the user saw the list, so do not repeat it. 'connect' is for an app the user names. 'status' lists connectors and whether each is connected; 'connect' starts an authorization for the given connectors; 'reconnect' checks each one and repairs only what is not connected ('force': true restarts even a working one, for an account switch). A second account of one app is 'connect' with a new 'alias': pick a short lowercase name from the user's words (e.g. 'work'), and ask the user if unsure. 'status' lists each connector's accounts; 'rename' names or renames one. Pass SEVERAL slugs in one call. In the desktop app, the terminal UI and the interactive CLI the call shows the user a card and blocks until every app is connected, skipped, or the deadline passes; the result lists each target as connected / skipped / not_connected and never carries a link. Where no card exists (a one-shot run, a scheduled job, a messaging platform) the result carries a connect_url per app for the USER to open in a browser (never open it yourself); ask them to say when they are done, then use 'status'. When a hosted connector tool call returns CONNECTION_REQUIRED, use 'connect'. MCP actions (every target must carry "mcp": true): 'install' adds a catalog entry, 'enable' re-enables a disabled configured server, 'authorize' runs its OAuth. They show the user an approval card and block until it settles. Never hand-edit mcp_servers config â€” always use this tool. After a skip or a timeout, do not re-ask on your own: continue without the app or ask in chat. A later request from the USER for that same app is not a re-ask â€” run it. A connected server's tools are named in the result and are callable at once through tool_describe/tool_call. Where no card exists an MCP target runs at once and the result says what happened, with a link for the user to open when one is needed. This tool can NOT disconnect, delete, or revoke an account â€” that is deliberately user-only. When asked, say so and direct the user to the Nous Portal (their org's Connectors page) or the desktop app.Ú
parametersÚtypeÚobjectÚ
propertiesr&   ÚstringÚenumz�Defaults to status. connect, reconnect and rename take hosted connector slugs only. install, enable and authorize take mcp:true targets only.r(   ÚarrayÚitemsÚanyOfÚmcpÚbooleanzYtrue = a local MCP server from the catalog; absent or false = a hosted connector account.Úaliasz¾Hosted only: the account's name. connect: a new name adds another account; reconnect: repairs that account; rename: its current name (or its label when unnamed). One aliased target per call.ÚtoÚpatternzrename only: the new name.ÚrequiredÚadditionalPropertieszäTargets. REQUIRED for every action but status and display (e.g. ["gmail", {"name": "linear", "mcp": true}]); optional filter for status. A bare slug is a hosted connector, so an MCP server needs the object form with "mcp": true.ÚforcezXreconnect only: restart the authorization even if the app is connected (account switch).Úconnectionsc                 óv   € \        WP                  R 4      VP                  R4      \        P                  R7      # )r   r   )r   r   r   )r1   r*   Úgateway_configr   ©r   Úkws   &,r"   Ú<lambda>rJ   ¢   s*   € Ô1ØŸ™ Ó-¸B¿F¹FÀ>Ó<RÜ+×@Ñ@õ r$   c                  ó,   € \         P                  ! 4       # )N)rG   r   © r$   r"   rJ   rJ   ¦   s   € ”^×8Ò8Ô:r$   u   ðŸ”—)r2   ÚtoolsetÚschemaÚhandlerÚcheck_fnÚemojir   Úcatalogc                 ó8   € \        WP                  R 4      R7      # )r   )r   )r   r*   rH   s   &,r"   rJ   rJ   ¯   s   € œ~¨d¿v¹vÀlÓ?SÕTr$   u   ðŸ§©)r2   rM   rN   rO   rQ   )Ú__doc__Útypingr   r   r   r   Útools.connectors.catalog_toolr   r   Útools.connectors.gatewayr   rG   Útools.connectors.managedr	   Útools.connectors.mcpr
   Útools.connectors.targetsr   r   r   r   r   Útools.registryr   r   r1   ÚlistÚMANAGE_CONNECTIONS_SCHEMAÚregisterrL   r$   r"   Ú<module>r_      sÝ  ðñ÷
 1Ó 0ç OÝ =Ý 7Ý 2ß pÕ pß /ðð 37ðð "&ð	ð
 !%ðð #'ðð "ðð PTðð :>ðð ÷ðF Ð Øð"	HðH Ø�ØØØ˜Ø™˜[Ó)ØðPð	ð Ø˜ØØØ Ð*à" HØ(Ø &¨°Ð(:Ø %Ø$*¨IØ$1ð)Nð("ð !(Ø$*¨HØ$1ð)dð*"ð !%Ø$*¨HØ$-¨}Ø$1Ð3Oð'"ð#+ð. '¨¨Ø2°Eð5ðð ðB ð/ðI)ðT Ø˜	ØÐyððg7
ðp 	�Bðu;ðOcÐ ðL 	× Ò Ø	ØØ$ññ ;Ø
õð$ 	× Ò Ø	ØØ ÙTØ
÷r$   