{# Guided agent setup (ADR-0018's onboarding half, ticket 20). Every fact is the service's own (`clear_record.service.setup`): the resolved endpoint and model, the config problems, and what a probe found. 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. #}
{% if setup.state == 'ready' %} {{ tr("agent ready") }} {% elif setup.state == 'problem' %} {{ tr("agent config problem") }} {% else %} {{ tr("no endpoint configured") }} {% endif %}
{% if error %}{% endif %} {% if notice %}

{{ notice }}

{% endif %} {% 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.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, translated for display; the console never restates the rule that raised it. #} {% endfor %} {% if setup.detection %} {% else %}

{% endif %} {% if not setup.configured %}

{{ tr("clear-record never stores a key: a hosted endpoint names the environment variable that holds it, and a local endpoint needs none.") }}

{% endif %} {# --- the MCP rung: point at a harness, then at its client config -------- Both locations are the **user's choice**, and the console asks for each rather than inventing one: an external harness's own config path is defined nowhere in this repo. The entry the second form writes is a command and its args, so there is no field here a credential could occupy. #}

{{ tr("Agent harness (MCP)") }}

{% if setup.mcp_config %}

{{ tr("Client config: {path}", path=setup.mcp_config) }}

{% else %}

{{ tr("No MCP client config has been pointed at yet, so no agent can launch clear-record's tools.") }}

{% endif %} {% if setup.harness %}

{{ tr("Harness: {path}", path=setup.harness) }}

{% endif %} {% for harness in harnesses %}
{{ harness.name }} {% if harness.found %} {# ``hx-vals`` carries the path ``find_harness`` found — the same shape the endpoint forms use, so no input markup the CSS scanner would read as a utility class. ``tojson`` escapes the path into valid JSON, and the JSON's own quotes are safe inside the single-quoted attribute. The path is still the user's to accept: this only saves typing it. #}
{% else %} {{ tr("not on PATH") }} {% endif %}
{% endfor %}
{# The download rung, told honestly: installing a harness is a human action, and this setup neither bundles one nor performs a download. #}

{{ tr("{name} is not bundled, and this setup will not download one for you: get {name} (or any other MCP-capable client) the way you get software yourself, then point at it above.", name=pi_agent) }}

{{ tr("MCP client config") }}

{# The only pre-filled value is a path a previous run recorded — never a guessed default. An empty field means the user must choose. #}

{{ tr("The path is yours to choose: a client's config location is not something clear-record can know. clear-record adds one entry to that file and leaves the rest of it alone — the command {command} with args {args}.", command=mcp_entry.command, args=mcp_entry.args | join(' ')) }}