{# The progress fragment: included by job.html and polled at /jobs/{id}/progress. Its root carries the header's line (the stage, the time left), which app.js copies at every poll, the browser tab's prefix, and the running stage, which app.js announces when it changes. The running time (#run-for) is copied in place too: both change at every poll and must not make app.js replace the fragment. #} {% import "_icons.html" as icons with context %} {% import "_hint.html" as hints with context %}

{{ t('progress.pipeline') }}

{% if p.current_index %}{{ t('progress.stage_of', current=p.current_index, total=p.steps | length) }}{% endif %}
    {% for s in p.steps %}
  1. {% if s.state == 'done' %} {% elif s.state == 'running' %} {% elif s.state == 'failed' %}{{ icons.sev('error', '', 20) }} {% else %}{% endif %} {{ s.title }}{{ icons.who(s.who) }}{{ t('progress.state.' ~ s.state) }} {{ s.description }} {% if s.detail %}{{ s.detail }}{% endif %} {% if s.key == 'check' and s.state == 'done' %}{{ t('progress.no_model', rules=rule_count) }}{% endif %}
  2. {% endfor %}
{# The calls, tokens and model time per stage and the models, folded away: a reviewer waits for the stage line, not for these. app.js keeps the block open across polls once it was opened. #}
{{ t('progress.details') }} {% for s in p.steps if s.usage %} {% endfor %}
{{ t('progress.usage.stage') }}{{ t('progress.usage.calls') }}{{ t('progress.usage.tokens') }}{{ t('progress.usage.time') }}
{{ s.title }}{{ s.usage.calls }}{{ t.number(s.usage.tokens_in + s.usage.tokens_out) }}{{ duration(s.usage.seconds) }}
{{ t('progress.usage.total') }}{{ p.usage | sum(attribute='calls') }}{{ t.number(p.tokens) }}{{ duration(p.usage | sum(attribute='seconds')) }}

{{ t('progress.running_for', time=duration(p.elapsed_s)) }}

{% if job.config.endpoint %}
{{ t('site.endpoint') }}
{{ job.config.endpoint }}
{% endif %}
{{ t('progress.writer') }}
{{ job.config.writer_model or job_llm.models.writer }}
{% if job.config.judge_model %}
{{ t('progress.judge') }}
{{ job.config.judge_model }}
{% endif %}
{% if job.status == "failed" %} {% endif %} {% if p.factsheet or p.draft or p.live %}

{{ t('progress.results') }}

{% if p.live %}{{ hints.note('results', t('progress.results_hint')) }}{% endif %}
{% endif %} {% if p.factsheet or p.draft %}
{% if p.factsheet %}

{{ t('progress.factsheet') }}

{{ icons.who('model') }} {{ t('detail.facts', n=p.factsheet.facts | length, keep=p.factsheet.facts | selectattr('must_keep') | list | length) }}
{% for c in p.core %}
{{ c.label }}
{% if c.answer.text %}{{ c.answer.text }}{% else %}{{ t('core.unanswered') }}{% endif %}
{% endfor %}
{{ t('progress.must_keep') }}
    {% for f in p.factsheet.facts if f.must_keep %}
  • {{ f.id }}{{ t.get('kind.' ~ f.kind, f.kind) }}{{ f.text }}{% if f.value_norm %}{{ f.value_norm }}{% endif %}
  • {% endfor %}
{% if p.factsheet.omit_candidates %}

{{ t('progress.background', n=p.factsheet.omit_candidates | length) }}

{% endif %}
{% endif %} {% if p.draft %} {% set errors = p.rules.findings | selectattr('severity', 'equalto', 'error') | list | length if p.rules else 0 %} {% set warns = p.rules.findings | selectattr('severity', 'equalto', 'warn') | list | length if p.rules else 0 %}

{{ t('draft.version', version=p.draft.version) }}

{{ icons.who('model') }} {% if p.rules %}{{ icons.icon('code', 12) }}{{ t('progress.checked_by_code') }}{% endif %} {% if p.rules %}{{ t('count.errors', n=errors) }} ยท {{ t('count.warnings', n=warns) }}{% endif %}
{% for b in p.draft.blocks %} {% set mark = p.block_marks.get(b.id) %}
{% if mark %}{{ icons.sev(mark, t('sev.' ~ mark)) }}{% endif %}{% if b.kind == "list_item" %}• {% endif %}{{ b.text }}
{% endfor %}
{% if p.rules %}

{{ t('progress.findings', errors=errors, warns=warns) }} {{ t('progress.doc_findings') }}

{% endif %}
{% endif %}
{% endif %}