Ë
    âß²jt  ã                   óv   — d Z ddlmZ ddlmZ ddlmZ  G d„ de«      Z eddd	d
dddddd¬«
      Z ee«       y)aa  GitHub Copilot ACP provider profile.

copilot-acp does not speak OpenAI-over-HTTP: it drives an external ACP subprocess over
stdio, so the profile supplies its own client via :meth:`ProviderProfile.create_client`.
An out-of-tree ACP provider (``~/.hermes/plugins/model-providers/`` or a pip entry point)
uses the same three lines without touching core.
é    )ÚAny)Úregister_provider)ÚProviderProfilec            
       óZ   — e Zd ZdZdedefd„Zddddœdedz  d	edz  d
edee   dz  fd„Z	y)ÚCopilotACPProfileuA   GitHub Copilot ACP â€” external process, no REST models endpoint.Úclient_kwargsÚreturnc                 ó   — ddl m}  |di |¤ŽS )z4Build the ACP stdio shim rather than an HTTP client.r   )ÚCopilotACPClient© )Úagent.copilot_acp_clientr   )Úselfr   r   s      úQ/home/ubuntu/.hermes/hermes-agent/plugins/model-providers/copilot-acp/__init__.pyÚcreate_clientzCopilotACPProfile.create_client   s   € å=áÑ0 -Ñ0Ð0ó    Ng      .@)Úapi_keyÚbase_urlÚtimeoutr   r   r   c                ó|  — ddl m} 	  || j                  «      }t        |j	                  d«      xs d«      j                  d«      sy| j                  |j	                  d«      |j	                  d«      |j	                  d«      |j	                  d	«      ¬
«      }|j                  |¬«      xs dS # t        $ r Y yw xY w)uØ  Enabled models advertised by a short-lived signed-in ACP session (``session/new``).

        The CLI may keep its login in an OS credential store with no token Hermes can reuse, so
        the session is the only source that reflects the account's enablement. ``api_key`` /
        ``base_url`` are ignored: the subprocess owns auth. None when the CLI is missing, refuses
        ``--acp``, or the probe fails/times out â€” callers fall back to their next source.
        r   )Ú-resolve_external_process_provider_credentialsr   Ú zacp://Nr   ÚcommandÚargs)r   r   r   r   )Útimeout_seconds)	Úhermes_cli.authr   ÚnameÚstrÚgetÚ
startswithr   Úlist_modelsÚ	Exception)r   r   r   r   r   ÚcredsÚclients          r   Úfetch_modelszCopilotACPProfile.fetch_models   s²   € õ 	Rð	ÙAÀ$Ç)Á)ÓLˆEÜ�u—y‘y Ó,Ò2°Ó3×>Ñ>¸xÔHØØ×'Ñ'ØŸ	™	 )Ó,°u·y±yÀÓ7LØŸ	™	 )Ó,°5·9±9¸VÓ3Dð (ó FˆFð ×%Ñ%°gÐ%Ó>ÒFÀ$ÐFøÜò 	ñ ð	ús   ˆ?B/ ÁA&B/ Â/	B;Â:B;)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   ÚfloatÚlistr$   r   r   r   r   r      sX   „ ÙKð1¨Sð 1°Só 1ð (,ÀDÐ[_òØ ™*ðØ7:¸T±zðØSXðà	ˆc‰�TÑ	ôr   r   zcopilot-acp)zgithub-copilot-acpzcopilot-acp-agentÚchat_completionsr   zacp://copilotÚexternal_processÚcopilot)z--acpz--stdio)ÚHERMES_COPILOT_ACP_COMMANDÚCOPILOT_CLI_PATHÚHERMES_COPILOT_ACP_ARGS)
r   ÚaliasesÚapi_modeÚenv_varsr   Ú	auth_typeÚprocess_commandÚprocess_argsÚprocess_command_env_varsÚprocess_args_env_varN)	r(   Útypingr   Ú	providersr   Úproviders.baser   r   Úcopilot_acpr   r   r   ú<module>r=      sX   ðñõ å 'Ý *ô ˜ô  ñF  Ø	Ð KØØØØ ð Ø%ØOØ2ô€ñ �+Õ r   