{# Copyright 2025 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. #} {# SVG icons and UI components #} {%- macro icon_chevron_down(size_class='w-5 h-5', rotate_condition='') -%} {%- endmacro -%} {%- macro icon_copy(size_class='w-4 h-4') -%} {%- endmacro -%} {%- macro collapsible_section(title, open_var, content_id='') -%} {%- endmacro -%} {# Other components #} {%- macro code_block(code, language='plaintext', show_line_numbers=true) -%}
{% if show_line_numbers %}
{% for line in code|remove_trailing_empty_lines|splitlines %}{{ loop.index }}{% endfor %}
{% endif %}
{{ code|remove_trailing_empty_lines }}
{%- endmacro -%} {%- macro expand_collapse_buttons(expand_id, collapse_id, expand_text='Expand All', collapse_text='Collapse All') -%}
{%- endmacro -%} {%- macro sortable_table_header(columns) -%} {% for col in columns %} {{ col.label }} {% endfor %} {%- endmacro -%} {%- macro crash_badge(has_crash, is_potential_vuln=false) -%} {% if has_crash %} Crashed {% else %} No Crash {% endif %} {%- endmacro -%} {%- macro vulnerability_badge(is_vuln) -%} {% if is_vuln %} Potential Vulnerability {% else %} No Potential Vulnerability {% endif %} {%- endmacro -%} {%- macro agent_cycle_section(cycle_data, loop_index, color_classes, default_lang='', sample=false) -%} {% if 'standalone' in cycle_data %} {# Standalone agents #} {% for agent_name, agent_data in cycle_data.standalone.items() %}
{% if agent_data.steps %} {% for step in agent_data.steps %}
{% for log_part in step.log_parts %}
{{ log_part.content|syntax_highlight|safe }}
{% endfor %}
{% endfor %} {% else %} {% for log_part in agent_data.logs %}
{{ log_part.content|syntax_highlight_agent(default_lang, agent_name)|safe }}
{% endfor %} {% endif %}
{% endfor %} {% else %} {# Cycle with multiple agents #} {% set color_index = (loop_index - 1) % color_classes|length %}
Cycle {{ loop_index }}
{% for agent_name, agent_data in cycle_data.items() %}
{% if agent_data.steps %} {% if agent_data.steps|length == 1 %} {# Single step - show raw content #} {% set step = agent_data.steps[0] %} {% if step.number and step.name %}
Step {{ step.number }} - {% if 'Stderr' in step.name %} {{ step.name.replace('Stderr', 'Stderr') | safe }} {% else %} {{ step.name }} {% endif %}
{% if step.bash_commands %}
Commands: {% for cmd in step.bash_commands %} {{ cmd }} {% endfor %}
{% endif %} {% if step.log_parts %} {% for log_part in step.log_parts %}
{{ log_part.content|syntax_highlight|safe }}
{% endfor %} {% else %}
{{ step.content|syntax_highlight|safe }}
{% endif %}
{% else %} {% if step.log_parts %} {% for log_part in step.log_parts %}
{{ log_part.content|syntax_highlight|safe }}
{% endfor %} {% else %}
{{ step.content|syntax_highlight|safe }}
{% endif %} {% endif %} {% else %} {# Multiple steps - show collapsible #} {% for step in agent_data.steps %}
{% if step.log_parts %} {% for log_part in step.log_parts %}
{{ log_part.content|syntax_highlight_agent(default_lang, agent_name)|safe }}
{% endfor %} {% else %}
{{ step.content|syntax_highlight|safe }}
{% endif %}
{% endfor %} {% endif %} {% else %} {% for log_part in agent_data.logs %}
{{ log_part.content|syntax_highlight_agent(default_lang, agent_name)|safe }}
{% endfor %} {% endif %}
{% endfor %}
{% endif %} {%- endmacro -%}