+
    „WÝj;  ã                  ó’   € R t ^ RIHt ^ RIt^ RIHt ^ RIHt RtRt	 ! R R]P                  4      tR	 tR
 R ltR R ltR R ltR# )z;``hermes gateway`` and ``hermes proxy`` subcommand parsers.)ÚannotationsN)ÚCallable)Úadd_accept_hooks_flagz�Start a separate gateway for this profile even when the default multiplexer already serves it (not recommended: two pollers on one bot token, port conflicts)zî{verb} without asking even while sessions are live (turns, cron jobs, background delegations): they are interrupted. Without it the command names the live work and asks y/N (refuses when there is no terminal). --interrupt is the same flagc                  óP   a € ] tR t^tRtRR/V 3R lltRV 3R lltV 3R ltRtV ;t	# )	Ú_GatewayCommandParserzCEnsure's parser errors share its machine-readable command boundary.Úensure_jsonFc               	ó4   <€ Wn         \        SV `  ! V/ VB  R # )N)r   ÚsuperÚ__init__)Úselfr   ÚargsÚkwargsÚ	__class__s   &$*,€ÚRC:\Users\johnn\AppData\Local\hermes\hermes-agent\hermes_cli\subcommands\gateway.pyr
   Ú_GatewayCommandParser.__init__   s   ø€ Ø&ÔÜ‰Ò˜$Ð) &Ô)ó    c                	ó‚   <€ \         SV `  W4      w  r4V P                  '       d   V'       d   V P                  R 4       W43# )zunknown arguments)r	   Úparse_known_argsr   Úerror)r   r   Ú	namespaceÚparsedÚunknownr   s   &&&  €r   r   Ú&_GatewayCommandParser.parse_known_args   s7   ø€ Ü™'Ñ2°4ÓC‰ˆØ××Ð§Ø�J‰JÐ*Ô+ØˆÐr   c                	ó„   <€ V P                   '       g   \        SV `	  V4      # \        R 4       V P	                  ^R4       R# )zK{"endpoint":null,"reason_code":"invalid_invocation","state":"inaccessible"}z#gateway ensure: invalid invocation
N)r   r	   r   ÚprintÚexit)r   Úmessager   s   &&€r   r   Ú_GatewayCommandParser.error%   s6   ø€ Ø××ÐÜ‘7‘= Ó)Ð)ÜÐ[Ô\Ø�	‰	�!Ð;Ö<r   )r   )NN)
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r
   r   r   Ú__static_attributes__Ú__classcell__)r   s   @r   r   r      s!   ø† ÙMð*¨%÷ *÷÷=ó =r   r   c               ó2   € V P                   ! VR RRV/VB  R# )ÚactionÚ
store_trueÚhelpN)Úadd_argument)Úparserr(   ÚnamesÚkws   &$*,r   Ú_flagr-   ,   s   € Ø
×Ò˜ÐE |ÐE¸$ÐEÀ"ÔEr   c               ó    € V ^8„  d   QhRRRR/# ©é   r*   zargparse.ArgumentParserÚreturnÚNone© )Úformats   "r   Ú__annotate__r5   0   s   € ÷ Oñ OÐ&=ð OÀ$ñ Or   c                óJ   € V P                  RR\        P                  R7       R# )zåAccept stale `gateway <verb> --platform X` docs without advertising it.

Lifecycle commands operate on the gateway process, not one adapter; Photon briefly
printed a per-platform start command during setup, so keep it parseable.
z
--platformÚplatform©Údestr(   N)r)   ÚargparseÚSUPPRESS©r*   s   &r   Ú_add_compat_platform_flagr=   0   s   € ð ×Ñ˜¨:¼H×<MÑ<MÐÖNr   c               ó    € V ^8„  d   QhRRRR/# r/   r3   )r4   s   "r   r5   r5   9   s   € ÷ Tñ TÐ4ð T¸ñ Tr   c                ó"   € \        V R RR7       R# )ú--systemz-Target the Linux system-level gateway service©r(   N)r-   r<   s   &r   Ú_add_system_flagrB   9   s   € Ü	ˆ&�*Ð#R×Sr   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r0   Úcmd_gatewayr   Ú	cmd_proxyÚcmd_gateway_enrollr1   r2   r3   )r4   s   "r   r5   r5   =   s2   € ÷ M2ñ M2Ø (ðM2Ø5=ðM2ØS[ðM2à	ñM2r   c               ó¢
  € V P                  RRRR7      pVP                  R\        R7      pVP                  RRR	7      pVP                  R
RR^ RR7       VP                  RRRRR7       VP                  RRRR7       VP                  RRRR7       VP                  RRRR7       \	        VRRR	7       \	        VR\
        P                  R	7       \        V4       \        V4       ^ RIH	p VP                  RRR R!R"7      p\	        VR#R$R	7       VP                  R%R&R'R(7       VP                  VR)7       VP                  R*R+R	7      p	\        V	4       \	        V	R,R-R	7       \	        V	R\        R	7       \        V	4       VP                  R.R/R	7      p
\        V
4       \	        V
R,R0R	7       \	        V
R1R2R3R4\        P                  R.R57      R67       VP                  R7R8R	7      p\        V4       \	        VR,R9R	7       \	        VR\        R	7       \	        VR1R2R3R4\        P                  R7R57      R67       \	        VR:R;R	7       \        V4       VP                  R<R=R	7      p\	        VR>R?R	7       \	        VR@RARBR	7       \        V4       \        V4       VP                  RCRDR	7      p\	        VRRER	7       \	        VRFRGR	7       VP                  RHRIRJR67       \	        VRKRLRMRNRO7       VP                  RPRLRQRRRS7       \	        VRTRURMRVRO7       VP                  RWRURQRXRS7       \	        VRYRZR[R67       \	        VR\R]R^R67       \	        VR_R`\
        P                  R67       VP                  RaRbR	7      p\        V4       VP                  RcRdR	7       VP                  ReRfR	7       VP                  RgRhRiR7      p\	        VRjRkRlR67       \	        VR1R2RmRnR67       VP                  RoRpRqR7      p\	        VRrRsRtR67       \	        VRjRkRuR67       \	        VR1R2RmRvR67       VP                  RwRxRyR7      pVP                  RzRMR{R(7       VP                  R|R}RMR~RO7       VP                  RR€RMR�RO7       VP                  R‚RƒRMR„RO7       VP                  VR)7       V P                  R…R†R‡R7      pVP                  RˆR‰7      pVP                  R*RŠR	7      pVP                  R‹RŒR�R(7       VP                  RŽRMR�R(7       VP                  R�\         RMR‘R’7       VP                  R<R“R	7       VP                  R”R•R	7       VP                  VR)7       VP                  VR)7       RM# )–zCAttach the ``gateway`` and ``proxy`` subcommands to ``subparsers``.ÚgatewayzMessaging gateway managementzLManage the messaging gateway (Telegram, Discord, WhatsApp, Weixin, and more))r(   ÚdescriptionÚgateway_command)r9   Úparser_classÚrunz:Run gateway in foreground (recommended for WSL and Docker)rA   z-vz	--verboseÚcountz2Increase stderr log verbosity (-v=INFO, -vv=DEBUG))r&   Údefaultr(   z-qz--quietr'   zSuppress all stderr log output)r&   r(   z	--replacez:Replace any existing gateway instance (useful for systemd)z--forcezÝStart a foreground gateway even when a systemd/launchd/s6 service already supervises this profile. Without --force, the command refuses because a second dispatcher escapes the service and can corrupt shared gateway state.z--no-supervisea¯  Inside the s6-overlay Docker image, normally `gateway run` is automatically redirected to the supervised s6 service (so the gateway gets auto-restart on crash, plus a supervised dashboard if HERMES_DASHBOARD is set). Pass --no-supervise to opt out and get the historical pre-s6 foreground behavior: the gateway is the container's main process and the container exits with the gateway's exit code. No effect outside an s6 container.z--external-supervisorzøDeclare that an external process manager owns this foreground gateway. In-chat restarts and updates exit back to that manager instead of spawning a detached replacement. Use this when a launchd/systemd wrapper strips its native environment markers.z--idle-exit)Úcmd_gateway_ensureÚensureTz@Ensure a local runtime without installing or replacing a servicezËExit codes: 0 ready; 2 invalid invocation; 3 incompatible; 4 authorization/profile mismatch; 5 deadline; 6 draining/update-paused; 7 inaccessible/conflicting supervisor. Pending startup is not readiness.)r   r(   Úepilogz--jsonz.Emit one credential-free JSON result (default)z	--timeoutÚ60z/Total startup deadline in seconds (default: 60))rN   r(   )ÚfuncÚstartz6Start the installed systemd/launchd background servicez--allzDKill ALL stale gateway processes across all profiles before startingÚstopzStop gateway servicez.Stop ALL gateway processes across all profilesz-yz--yesz--interruptÚ	interrupt)Úverbr8   ÚrestartzRestart gateway servicez@Kill ALL gateway processes across all profiles before restartingz--detachz·Without an installed service, start the replacement in the background (as `gateway ensure` does) instead of in this terminal; used by apps that run the restart as a short-lived clientÚstatuszShow gateway statusz--deepzDeep status checkz-lz--fullz9Show full, untruncated service/log output where supportedÚinstallz7Install gateway as a systemd/launchd background servicezZForce reinstall, and install even when the default multiplexer already serves this profiler@   z8Install as a Linux system-level service (starts at boot)z--run-as-userÚrun_as_userz3User account the Linux system service should run asz--start-nowÚ	start_nowNz6Start the gateway service immediately after installing)r9   rN   r(   z--no-start-nowÚstore_falsez1Do not start the gateway service after installing)r9   r&   r(   z--start-on-loginÚstart_on_loginz7Enable the service to start automatically on login/bootz--no-start-on-loginz0Do not enable the service to start on login/bootz--if-missingÚ
if_missingz6Do nothing when a gateway service is already installedz--force-unit-pathÚforce_unit_pathzFRepoint a service definition that pins another HERMES_HOME at this onez--elevated-handoffÚelevated_handoffÚ	uninstallzUninstall gateway serviceÚlistz*List all profiles and their gateway statusÚsetupzConfigure messaging platformszmigrate-legacyz;Remove legacy hermes.service units from pre-rename installszÖStop, disable, and remove legacy Hermes gateway unit files (e.g. hermes.service) left over from older installs. Profile units (hermes-gateway-<profile>.service) and unrelated third-party services are never touched.z	--dry-runÚdry_runz+List what would be removed without doing itÚyeszSkip the confirmation promptÚmigratez<Converge every per-profile gateway onto the ONE host gatewaya  Converge this host onto the one-gateway-per-host model: stop and uninstall each secondary profile's gateway and its supervisor unit (systemd, launchd, Windows Scheduled Task), then restart the default profile's gateway so it serves every profile. Runs a preflight first (duplicate bot tokens, port-binding platforms without a /p/<profile>/ ingress) and changes nothing when blocked. Safe to re-run: a half-migrated host converges on the next run. Per-profile gateways are not a supported topology any more, so there is no rollback command.z--multiplexÚ	multiplexz,Converge onto the one host gateway (default)z5Print the plan and blockers without changing anythingzApply without confirmationÚenrollzLEnroll this gateway with a relay connector (writes relay auth creds to .env)a–  Redeem a single-use enrollment token with a relay connector. Authenticates as your Nous Portal account (the connector derives the authoritative tenant from it), mints this gateway's per-gateway secret and per-tenant delivery key, and writes GATEWAY_RELAY_ID / GATEWAY_RELAY_SECRET / GATEWAY_RELAY_DELIVERY_KEY into ~/.hermes/.env. Requires being logged in (hermes setup). Not available in managed installs.z--tokenz†The single-use enrollment token from the connector (delivered with your gateway config). Also settable via GATEWAY_RELAY_ENROLL_TOKEN.z--connector-urlÚconnector_urlz®The connector base/relay URL, e.g. wss://connector.example.com/relay or https://connector.example.com. Also settable via GATEWAY_RELAY_URL / gateway.relay_url in config.yaml.z--gateway-idÚ
gateway_idz[A stable id for this gateway instance (kill-switch granularity). Defaults to gw-<hostname>.z
--wake-urlÚwake_urlua  Phase 5 Â§5.2 wake URL: a reachable URL the connector pokes (payload-free GET) to wake this gateway when buffered work arrives while it's idle/suspended, so it reconnects and drains. Persisted as GATEWAY_RELAY_WAKE_URL in ~/.hermes/.env and forwarded at provision. Optional â€” without it the gateway still drains whenever it next reconnects on its own.Úproxyz0Local OpenAI-compatible proxy to OAuth providerszÝRun a local HTTP server that forwards OpenAI-compatible requests to an OAuth-authenticated provider (e.g. Nous Portal). External apps can point at the proxy with any bearer token; the proxy attaches your real credentials.Úproxy_command)r9   zRun the proxy in the foregroundz
--providerÚnouszMUpstream provider: nous or xai (default: nous). See `hermes proxy providers`.z--hostz@Bind address (default: 127.0.0.1). Use 0.0.0.0 to expose on LAN.z--portzBind port (default: 8645))ÚtyperN   r(   z$Show which proxy upstreams are readyÚ	providersz'List available proxy upstream providers)Ú
add_parserÚadd_subparsersr   r)   r-   r:   r;   r   Úhermes_cli.gateway_runtime_clirO   Úset_defaultsrB   Ú_FORCE_SERVED_PROFILE_HELPr=   Ú_INTERRUPT_HELPr4   Úint)Ú
subparsersrD   rE   rF   Úgateway_parserÚgateway_subparsersÚgateway_runrO   Úgateway_ensureÚgateway_startÚgateway_stopÚgateway_restartÚgateway_statusÚgateway_installÚgateway_uninstallÚgateway_migrate_legacyÚgateway_migrateÚgateway_enrollÚproxy_parserÚproxy_subparsersÚproxy_starts   &$$$                 r   Úbuild_gateway_parserrŠ   =   sm  € ð  ×*Ñ*¨9Ð;YØbð +ó d€Nà'×6Ñ6ØÔ-Bð 7ó DÐð %×/Ñ/ØÐPð 0ó €Kð ×ÑØØØØØAð ô ð ×ÑØˆi Ð3Sð ô ð ×ÑØØØIð ô ð
 ×ÑØØð,ð	 ô 	ð ×ÑØØðFð	 ô ô 
ˆ+Ð.ðMõNô 
ˆ+�}¬8×+<Ñ+<Õ=Ü˜+Ô&Ü˜.Ô)åAØ'×2Ñ2Ø˜dØOðZð 3ó [€Nô 
ˆ.˜(Ð)YÕZØ×Ñ °TØ%Vð  ô Xà×ÑÐ%7ÐÔ8à&×1Ñ1ØÐNð 2ó P€Mä�]Ô#Ü	ˆ-˜ØSõUä	ˆ-˜Ô)CÕDÜ˜mÔ,à%×0Ñ0°Ð>TÐ0ÓU€LÜ�\Ô"Ü	ˆ,˜Ð&VÕWÜ	ˆ,˜˜g }¸;Ì_×McÑMcÐioÐMcÓMpÕqà(×3Ñ3°IÐD]Ð3Ó^€OÜ�_Ô%Ü	ˆ/˜7ØOõQä	ˆ/˜9Ô+EÕFÜ	ˆ/˜4 ¨-¸kÔP_×PfÑPfÐluÐPfÓPvÕwÜ	ˆ/˜:ð	gõiô ˜oÔ.à'×2Ñ2°8ÐBWÐ2ÓX€NÜ	ˆ.˜(Ð)<Õ=Ü	ˆ.˜$ ØHõJä�^Ô$Ü˜nÔ-ð )×3Ñ3ØÐQð 4ó S€Oä	ˆ/˜9Øiõkä	ˆ/˜:ØGõIà× Ñ  °}ØBð !ô Dä	ˆ/˜=¨{ÀDØEõGà× Ñ Ð!1¸ÈMØ@ð !ô Bä	ˆ/Ð-Ð4DÈdØFõHà× Ñ Ð!6Ð=MÐVcØ?ð !ô Aä	ˆ/˜>°ØEõGä	ˆ/Ð.Ð5FØUõWä	ˆ/Ð/Ð6HÌx×O`ÑO`Õaà*×5Ñ5°kÐHcÐ5ÓdÐÜÐ&Ô'à×!Ñ! &Ð/[Ð!Ô\à×!Ñ! 'Ð0OÐ!ÔPà/×:Ñ:ØÐ\ð6ð ;ó 7Ðô 
Ð
  +°IØ:õ<ä	Ð
  $¨°eÐB`Õaà(×3Ñ3ØÐVðLð 4ó M€Oô 
ˆ/˜=¨{ÐAoÕpÜ	ˆ/˜;¨YÐ=tÕuÜ	ˆ/˜4 ¨uÐ;WÕXð (×2Ñ2°8Ø[ðZð 3ó [€Nð ×Ñ 	°4ðRð  ô Sð ×ÑÐ 1¸ÐQUð2ð  ô 3ð ×Ñ °\È4ð)ð  ô *ð ×Ñ °:Àtð%ð  ô &ð ×ÑÐ%7ÐÔ8ð ×(Ñ(ØÐHð.ð )ó /€Lð $×2Ñ2¸Ð2ÓHÐà"×-Ñ-¨gÐ<]Ð-Ó^€KØ×Ñ˜\°6Ø\ð ô ^à×Ñ˜X¨tØOð ô Qà×Ñ˜X¬C¸ÐD_ÐÔ`à×Ñ Ð/UÐÔVØ×Ñ Ð2[ÐÔ\Ø×Ñ 9ÐÔ-Ø×Ñ [ÐÖ1r   )r"   Ú
__future__r   r:   Útypingr   Úhermes_cli.subcommands._sharedr   rv   rw   ÚArgumentParserr   r-   r=   rB   rŠ   r3   r   r   Ú<module>r�      sS   ðÙ Aå "ã Ý å @ðFð ð:ð ô=˜H×3Ñ3ô =ò(FõOõT÷M2r   