{% if not static %} {% endif %} {% if not static %} {% endif %} {% if not static %}

{% if session.custom_title %} {{ session.custom_title }} {% elif session.workspace_name %} {{ session.workspace_name }} {% elif first_user_prompt %} {{ first_user_prompt | truncate(80, True) }} {% else %} Session {{ session.session_id[:8] }}… {% endif %}

{{ message_count }} msgs {{ session.vscode_edition }} {% if is_enriched %}
{% if has_cleanup_data %} {% endif %}
{% endif %}
View Settings
Content
Sections
Display
{% endif %}
{% if not static %} {% with messages = get_flashed_messages(with_categories=true) %} {% if messages %} {% for category, message in messages %} {% endfor %} {% endif %} {% endwith %} {% if needs_version_refresh %}
🔄 This session was enriched with v{{ enrichment_version or 'unknown' }}. A newer version (v{{ app_version }}) is available — re-enrich for improved parsing.
{% endif %} {% endif %}
{% if session.workspace_path %} 📁 {{ session.workspace_path | urldecode }} {% endif %} {%- if session.repository_url %} Repository: {{ session.repository_url }} {%- endif %} {% if session.created_at %} Created: {{ session.created_at | format_timestamp }} {% endif %} ID: {{ session.session_id }} {% if session.source_file %} Source: {{ session.source_file }} {% endif %}
{% if is_enriched %} {# ===== Macro: render_content_blocks ===== #} {# Renders content blocks, tool invocations, file changes, and command runs. #} {# Used for both outer messages and nested subagent content (recursive). #} {% macro render_content_blocks(content_blocks, tool_invocations, file_changes, command_runs, meta, fallback_content='') %} {% if content_blocks %} {# Render structured content blocks with kind differentiation #} {% for block in content_blocks %} {% if block.kind == 'intent' %} {{ block.content }} {% elif block.kind == 'skill' %} {% if block.description %}
⚡ skill: {{ block.content }}
{{ block.description }}
{% else %} skill: {{ block.content }} {% endif %} {% elif block.kind == 'status' %} {% if block.description == 'subagent' %} {# Hidden: standalone subagent status pills are redundant with agent block headers and read_agent backlinks #} {% elif block.description == 'subagent-error' %} {# Hidden: standalone subagent error pills are redundant with agent block headers and read_agent backlinks #} {% elif block.description == 'task-complete' %}
✅ Task complete
{{ block.content | markdown | safe }}
{% elif block.description == 'fork' %} {{ block.content | markdown | safe }} {% elif block.description == 'context-change' %} {{ block.content }} {% else %} {{ block.content }} {% endif %} {% elif block.kind in ('subagent', 'subagent_failed', 'subagent_incomplete') %}
{{ block.description or 'Agent' }} {% if block.is_background %} ↗ background {% endif %} {% if block.kind == 'subagent_failed' %} failed {% elif block.kind == 'subagent_incomplete' %} incomplete {% else %} completed {% endif %}
{% if block.prompt %}
Prompt
{{ block.prompt | markdown | safe }}
{% endif %} {% if include_agent_details is not defined or include_agent_details %} {# Full details: all tools, commands, file changes, result #} {% if block.content_blocks %} {{ render_content_blocks(block.content_blocks, block.tool_invocations, block.file_changes, block.command_runs, get_nested_meta(block), block.content) }} {% else %} {{ block.content | markdown | safe }} {% endif %} {% else %} {# Result only: just show text blocks (the agent's response) #} {% set has_result = false %} {% if block.content_blocks %} {% for inner in block.content_blocks %} {% if inner.kind == 'text' and inner.content.strip() %}
{{ inner.content | markdown | safe }}
{% set has_result = true %} {% endif %} {% endfor %} {% endif %} {% if not has_result %} {{ block.content | markdown | safe }} {% endif %} {% endif %}
{% elif block.kind == 'thinking' and (include_thinking is not defined or include_thinking) %}
Thinking {% if block.description %} — {{ block.description }} {% endif %}
{{ block.content | markdown | safe }}
{% elif block.kind == 'toolInvocation' %} {# Check for matched command run first (for CLI shell commands) #} {% set matched_cmd = meta.get('block_cmd_map', {}).get(loop.index0) if meta else none %} {# Then check for matched tool invocation #} {% set matched_tool = meta.get('block_tool_map', {}).get(loop.index0) if meta else none %} {% if matched_cmd %} {# CLI command run - show as collapsible command block with Input/Output like VSCode logs #}
{% if matched_cmd.title %} {{ matched_cmd.title }} {% else %} {{ matched_cmd.command | truncate(80, True) }} {% endif %} {% if matched_cmd.is_async %} {% if matched_cmd.is_detached %} detached {% else %} async {% endif %} {% endif %} {% if matched_cmd.status %} {{ matched_cmd.status }} {% endif %}
Input:
{{ matched_cmd.command }}
{% if matched_cmd.output or matched_cmd.result %} {% set cmd_output = (matched_cmd.output or matched_cmd.result) | strip_ansi %} {% if matched_cmd.is_async and matched_cmd.shell_id %}
shellId: {{ matched_cmd.shell_id }}
{% set is_boilerplate = cmd_output.strip().startswith(' Output:
{{ highlight_code(cmd_output, cmd_out_lang) }}
{% endif %} {% else %} {% set cmd_out_lang = detect_language(cmd_output) %}
Output:
{{ highlight_code(cmd_output, cmd_out_lang) }}
{% endif %} {% endif %} {% if matched_cmd.io_entries %} {% for io in matched_cmd.io_entries %}
{% if io.action == 'read' %} {% elif io.action == 'write' %} {% elif io.action == 'stop' %} {% else %} {% endif %} {{ io.action }} {% if io.pill_id %} ↗ context {% endif %}
{% if io.action == 'write' and io.input_text %}
Input:
{{ io.input_text }}
{% endif %} {% if io.result %} {% set io_result_clean = io.result | strip_ansi %} {% set io_result_lang = detect_language(io_result_clean) %}
{% if io.action == 'write' %}Response:{% elif io.action == 'read' %}Output:{% else %}Result:{% endif %}
{{ highlight_code(io_result_clean, io_result_lang) }}
{% endif %}
{% endfor %} {% endif %}
{# Inline fallback: shown when tools toggle hides the dropdown #}
{% if matched_cmd.title %} {{ matched_cmd.title }} {% else %} {{ matched_cmd.command | truncate(80, True) }} {% endif %} {% if matched_cmd.status %} {{ matched_cmd.status }} {% endif %}
{% elif matched_tool %} {# Show collapsible details for tools with input/output: #} {# - MCP tools (source_type == 'mcp') #} {# - run_in_terminal (has command input and terminal output) #} {# Internal file tools (copilot_readFile, etc.) just show pretty invocation message #} {% set is_mcp_tool = matched_tool.source_type == 'mcp' %} {% set is_terminal_tool = matched_tool.name == 'run_in_terminal' %} {% set has_tool_details = matched_tool.input or matched_tool.result %} {% set show_collapsible = (is_mcp_tool or is_terminal_tool) and has_tool_details %} {# Determine the pretty header text - use invocation_message if available, else block content #} {% set pretty_header = matched_tool.invocation_message if matched_tool.invocation_message else block.content %} {% if matched_tool.is_agent_backlink and matched_tool.backlink_agent_id %} {# Determine backlink state from read_agent result text #} {% set agent_result = matched_tool.result or '' %} {% if 'status: running' in agent_result or 'still running' in agent_result %} {% set bl_state = 'in-progress' %} {% set bl_label = 'in progress' %} {% elif 'failed' in agent_result or 'error' in agent_result.lower() %} {% set bl_state = 'failed' %} {% set bl_label = 'failed' %} {% else %} {% set bl_state = 'completed' %} {% set bl_label = 'completed' %} {% endif %} ↩ {{ matched_tool.invocation_message | replace('⏳ Checking agent ', '') }} — {{ bl_label }} {% elif matched_tool.is_shell_backlink %} {# Shell interaction — lightweight pill linking to IO entry inside shell block #} {% set shell_action = matched_tool.name | replace('_powershell', '') %} {% if shell_action == 'read' %} {% set shell_icon = 'fa-solid fa-book-open' %} {% elif shell_action == 'write' %} {% set shell_icon = 'fa-solid fa-keyboard' %} {% elif shell_action == 'stop' %} {% set shell_icon = 'fa-solid fa-stop' %} {% else %} {% set shell_icon = 'fa-solid fa-terminal' %} {% endif %} {% set shell_display = matched_tool.invocation_message | replace('↩ ', '') | replace(' — ' ~ shell_action, '') %} {% if matched_tool.shell_anchor_id %} {{ shell_action | upper }} — {{ shell_display }} {% else %} {{ shell_action | upper }} — {{ shell_display }} {% endif %} {% else %} {% if show_collapsible %}
{{ pretty_header | markdown | safe }} {% if matched_tool.status %} {{ matched_tool.status }} {% endif %}
{% if matched_tool.input %} {% set tool_in_lang = detect_language(matched_tool.input, matched_tool.name) %} {% set tool_in = matched_tool.input | prettify_json %}
Input:
{{ highlight_code(tool_in, tool_in_lang) }}
{% endif %} {% if matched_tool.result %} {% set tool_out_raw = matched_tool.result | strip_ansi %} {% set tool_out_lang = detect_language(tool_out_raw, matched_tool.name, is_output=True) %} {% set tool_out = tool_out_raw | prettify_json %}
Output:
{{ highlight_code(tool_out, tool_out_lang) }}
{% endif %}
{# Inline fallback: shown when tools toggle hides the dropdown #}
{{ pretty_header | markdown | safe }} {% if matched_tool.status %} {{ matched_tool.status }} {% endif %}
{% else %} {# Tool without collapsible details - just show the pretty message, no badge #}
{{ pretty_header | markdown | safe }}
{% endif %} {% endif %} {% else %}
{{ block.content | markdown | safe }}
{% endif %} {% elif block.kind == 'text' %} {% if block.content.strip() %}
{{ block.content | markdown | safe }}
{% endif %} {% else %}
{{ block.content | markdown | safe }}
{% endif %} {% endfor %} {% elif fallback_content %} {# Fallback to flat content for backwards compatibility #} {{ fallback_content | markdown | safe }} {% endif %} {# Show unmatched tool invocations #} {% set unmatched_tools = [] %} {% for tool in tool_invocations %} {% set is_collapsible_tool = (tool.source_type == 'mcp' or tool.name == 'run_in_terminal') and (tool.input or tool.result) %} {% if tool.name not in (meta.get('matched_tool_names', []) if meta else []) and is_collapsible_tool %} {% set _ = unmatched_tools.append(tool) %} {% endif %} {% endfor %} {% if unmatched_tools %}

Used {{ unmatched_tools | length }} tool{{ 's' if unmatched_tools | length > 1 else '' }}: {{ unmatched_tools | map(attribute='name') | list | join(', ') | truncate(100) }}

Tool Invocations ({{ unmatched_tools | length }})
{% for tool in unmatched_tools %}
{% if tool.invocation_message %} {{ tool.invocation_message | markdown | safe }} {% else %} {{ tool.name }} {% endif %} {% if tool.status %} {{ tool.status }} {% endif %}
{% if tool.input %} {% set utool_in_lang = detect_language(tool.input, tool.name) %} {% set utool_in = tool.input | prettify_json %}
Input:
{{ highlight_code(utool_in, utool_in_lang) }}
{% endif %} {% if tool.result %} {% set utool_out_raw = tool.result | strip_ansi %} {% set utool_out_lang = detect_language(utool_out_raw, tool.name, is_output=True) %} {% set utool_out = utool_out_raw | prettify_json %}
Output:
{{ highlight_code(utool_out, utool_out_lang) }}
{% endif %}
{% endfor %}
{# Inline fallbacks for unmatched tools: shown when tools toggle is OFF #} {% for tool in unmatched_tools %}
{% if tool.invocation_message %} {{ tool.invocation_message | markdown | safe }} {% else %} {{ tool.name }} {% endif %} {% if tool.status %} {{ tool.status }} {% endif %}
{% endfor %} {% endif %} {% if file_changes %}

Changed {{ file_changes | length }} file{{ 's' if file_changes | length > 1 else '' }}: {{ file_changes | map(attribute='path') | list | join(', ') | truncate(100) }}

File Changes ({{ file_changes | length }}) {{ file_changes | map(attribute='path') | map('extract_filename') | join(', ') | truncate(80) }}
{% for change in file_changes %}
{{ change.path | extract_filename }} {% if change.language_id %} {{ change.language_id }} {% endif %} {% if change.diff %} {% set stats = change.diff | parse_diff_stats %} {% if stats.additions > 0 %}+{{ stats.additions }}{% endif %} {% if stats.deletions > 0 %}-{{ stats.deletions }}{% endif %} {% endif %}
{% if change.explanation %}
{{ change.explanation }}
{% endif %} {% if change.diff %}
{{ change.diff }}
{% endif %}
{% endfor %}
{% endif %} {# Only show Command Runs section for commands not already rendered inline #} {% set unmatched_cmd_count = (command_runs | length) - ((meta.get('matched_cmd_indices', []) if meta else []) | length) %} {% if command_runs and unmatched_cmd_count > 0 %}

Ran {{ unmatched_cmd_count }} command{{ 's' if unmatched_cmd_count > 1 else '' }}

Command Runs ({{ unmatched_cmd_count }}) {{ command_runs | map(attribute='command') | join(', ') | truncate(80) }}
{% for cmd in command_runs %} {# Skip commands already rendered inline #} {% if loop.index0 not in ((meta.get('matched_cmd_indices') if meta else none) or []) %}
{% if cmd.title %} {{ cmd.title }} {% else %} {{ cmd.command }} {% endif %} {% if cmd.status %} {{ cmd.status }} {% endif %}
{% if cmd.output %}
Show output
{{ cmd.output | strip_ansi }}
{% endif %}
{% endif %} {% endfor %}
{% endif %} {% endmacro %}
{% for message in session.messages %} {%- if root_agent_markers is defined and root_agent_markers %} {% for marker in root_agent_markers.get(loop.index0, []) %}
{% if marker.kind == 'enter' %}🤖{% else %}↩{% endif %} {{ marker.label }}
{% endfor %} {%- endif %} {% set msg_meta = message_metadata.get(loop.index0, {}) %} {% set is_system_notification = message.role == 'user' and message.content.strip().startswith('') and 'agent' in message.content.lower() and ('completed' in message.content.lower() or 'failed' in message.content.lower()) %} {% if is_system_notification %}
🔔 {{ message.content | replace('', '') | replace('', '') | truncate(100) | safe }}
{% elif message.role == 'system' %} {% if not static or include_system_messages %}
{{ message.role }}
{% if message.timestamp %} {{ message.timestamp | format_timestamp }} {% endif %} #{{ loop.index }} {% if not static %} {% endif %}
{{ render_content_blocks(message.content_blocks, message.tool_invocations, message.file_changes, message.command_runs, msg_meta, message.content) }}
{% endif %} {% else %}
{{ message.role }}
{% if message.timestamp %} {{ message.timestamp | format_timestamp }} {% endif %} #{{ loop.index }} {% if not static %} {% endif %} {% if message.role == 'user' and not static and is_enriched %}
{% if message.original_content is none %} {% else %} {% endif %}
{% endif %}
{% if message.original_content is not none %}
{{ message.original_content | markdown }}
{% endif %}
{{ render_content_blocks(message.content_blocks, message.tool_invocations, message.file_changes, message.command_runs, msg_meta, message.content) }}
{% endif %} {% endfor %} {%- if root_agent_markers is defined and root_agent_markers %} {% for marker in root_agent_markers.get(session.messages | length, []) %}
{% if marker.kind == 'enter' %}🤖{% else %}↩{% endif %} {{ marker.label }}
{% endfor %} {%- endif %}
{%- if new_turns %}
📥 {{ new_turns | length }} new turn{{ 's' if new_turns | length != 1 else '' }} since last enrichment (showing basic data). {% if not static %}
{% endif %}
{% set ns2 = namespace(msg_num=message_count) %} {% for turn in new_turns %} {% if turn.user_message %} {% set ns2.msg_num = ns2.msg_num + 1 %}
user
#{{ ns2.msg_num }}
{{ turn.user_message | markdown | safe }}
{% endif %} {% if turn.assistant_response %} {% set ns2.msg_num = ns2.msg_num + 1 %}
assistant
#{{ ns2.msg_num }}
{{ turn.assistant_response | markdown | safe }}
{% endif %} {% endfor %}
{%- endif %} {% else %} {# Unenriched path: show basic turns data #} {% if not static %}
⚠️ This session has not been enriched yet. Showing basic data from Copilot's built-in session store.
{% endif %}
{% if turns %} {% set ns = namespace(msg_num=0) %} {% for turn in turns %} {% if turn.user_message %} {% set ns.msg_num = ns.msg_num + 1 %}
user
#{{ ns.msg_num }}
{{ turn.user_message | markdown | safe }}
{% endif %} {% if turn.assistant_response %} {% set ns.msg_num = ns.msg_num + 1 %}
assistant
#{{ ns.msg_num }}
{{ turn.assistant_response | markdown | safe }}
{% endif %} {% endfor %} {% else %}

No turns found for this session.

{% endif %}
{% endif %}
{% if static %} {% endif %}