{# Guided agent setup (ADR-0018's onboarding half) as ONE flow with numbered stages: Endpoint -> Harness -> MCP config -> Try it. It has two entry points (/setup/agent and /settings/agent) and one implementation; Settings -> Status re-runs the Try it check from the same service call. Every fact is the service's own (clear_record.service.setup / clear_record.service.agent_flow): the resolved endpoint and model, the config problems, what a probe found, and the hello-world check's finding. The console only renders and translates -- it never recomputes the service's answer. A credential is never shown and never written: api_key_env is a variable NAME, and a local endpoint has none at all. #} {# No id here: index.html's mount owns #agent-setup, and this fragment is swapped into it -- a second id would make the htmx target ambiguous. #}
{{ notice }}
{% endif %}{{ tr("Connect an OpenAI-compatible model endpoint. The same endpoint is what the agent tasks and the MCP harness use.") }}
{% if setup.state == 'ready' %}{{ tr("Endpoint: {endpoint}", endpoint=setup.endpoint or tr("the configured command template")) }}
{% if setup.model %}{{ tr("Model: {model}", model=setup.model) }}
{% endif %} {% if setup.api_key_env %}{{ tr("Key read from the environment variable {name}; never stored.", name=setup.api_key_env) }}
{% endif %} {% if setup.api_key_env %}export {{ setup.api_key_env }}='your-key'{% endif %}
{% if setup.commands %}{{ tr("Command templates: {kinds}", kinds=setup.commands | join(', ')) }}
{% endif %} {% else %}{{ tr("No agent endpoint is configured yet, so agent tasks cannot run. Start a local OpenAI-compatible server (Ollama, LM Studio or llama.cpp) and detect it, or enter an address below.") }}
{% endif %} {% for problem in setup.problems %} {# The service's own wording, shown verbatim: a config problem is a runtime string (it embeds the config path), not an extractable message ID, so wrapping it in tr() was a no-op. The console never restates the rule. #}{{ probe.candidate.base_url }}
{% if probe.verified %}
{{ tr("verified") }}
{% elif probe.reachable %}
{{ tr("reachable") }}
{% else %}
{{ tr("not running") }}
{% endif %}
{{ tr("clear-record never stores a key: a hosted endpoint names the environment variable that holds it, and a local endpoint needs none.") }}
export MY_KEY='your-key'
{{ tr("Run that export in the shell that launches clear-record (or restart the server after setting it), then type the same variable name in the field above. A local endpoint needs no key.") }}
{% endif %}{{ tr("Run the whole chain once: a hello-world tape through transcription, read back as the transcript an MCP agent receives.") }}