{% from 'components/page-heading.html' import page_heading %} {% macro prompt_feedback_alerts() %} {% if prompt_saved %}

{{ t.prompt_saved_success }}

{% endif %} {% if prompt_conflict %}{% endif %} {% if prompt_write_error %}{% endif %} {% endmacro %} {% macro prompt_editor_form(draft_etag, draft_mode, draft_instructions, defaults, saved_mode, saved_text, saved_custom, demonstrations_count, can_return_to_auto, is_draft, is_saved=false, saved_revision='') %} {% set form_action = '/dashboard/prompts/profile-generate' ~ ('?scope=' ~ (scope|urlencode) ~ ('&lang=' ~ language if 'lang' in request.query_params else '') if scope else ('?lang=' ~ language if 'lang' in request.query_params else '')) %}

{{ t.prompt_editor_title }}

{{ t.prompt_custom_hint }}

{% if saved_custom and demonstrations_count %}

{{ t.prompt_demonstrations_preserved|replace('{count}', demonstrations_count|string) }}

{% endif %}
{% if can_return_to_auto %}{% endif %} {{ t.prompt_cancel }}
{% endmacro %} {{ page_heading(t.prompts,t.prompts_subtitle) }} {% if scope_descriptor %}

{{ scope_descriptor.title }} · {{ scope }}

{% endif %} {% if errors.get('prompts') %}{{ read_error(errors.prompts,t.prompts) }}{% endif %} {% set has_scope_draft = prompt_draft and prompt_draft.scope == scope %} {% if not data.prompts and not errors.get('prompts') and not has_scope_draft %}

{{ t.prompt_empty }}

{{ t.prompt_empty_body }}

{% endif %} {% set ns = namespace(draft_rendered=false, feedback_rendered=false) %}
{% set groups = [ ('memory', ['atomic_memory.extract', 'atomic_memory.reconcile', 'memory.rerank']), ('topics', ['topic_memory.probe', 'topic_memory.global', 'topic_memory.planner', 'topic_memory.evolve', 'topic_memory.temporary', 'topic_memory.reduce', 'topic_memory.reconcile']), ('experience', ['experience.incubate', 'experience.generate']), ('skill', ['skill.generate']), ('handoff', ['handoff.generate']), ('profile', ['profile.generate']) ] %} {% for group, keys in groups %}{% set prompts = data.prompts|selectattr('prompt_key', 'in', keys)|list %} {% if prompts %}
{{ t['prompt_group_' ~ group] }}{{ prompts|length }} {% if group == 'topics' %}

{{ t.prompt_topic_conditional }}

{% endif %}
{% for prompt in prompts %}{% set opened = prompt_opened if prompt_opened and prompt.prompt_key == prompt_key else none %}{% set failed = prompt.prompt_key == prompt_key and errors.get('prompt_selected') %}{% set mode = none if failed else (opened.content.mode if opened else prompt.mode) %}
{{ t.get(prompt.prompt_key,prompt.prompt_key) }}{{ t[prompt.prompt_key ~ '_purpose'] }}{{ t.prompt_revision_unavailable if failed else (t.prompt_custom if mode == 'custom' else t.prompt_builtin_default) }} {% if prompt.prompt_key == 'profile.generate' %} {% set unavailable = prompt.reason == 'injected_component' or (not prompt.effective and not prompt.builtin) %} {% if not failed %}

{{ t.prompt_mode }}: {{ t.prompt_custom if mode == 'custom' else t.prompt_auto }}

{% endif %}
{{ prompt.prompt_key }} · {{ t.prompt_revision }} {{ opened.revision if opened else (prompt.artifact.revision if prompt.artifact else t.prompt_auto) }} · {{ t.prompt_demonstrations }} {{ opened.content.demonstrations|length if opened else (prompt.effective.demonstrations|length if prompt.effective else 0) }}
{{ t.prompt_capability }}
{{ t.get('prompt_state_' ~ prompt.status,t.get('prompt_' ~ prompt.status,prompt.status)) }}
{% if prompt.reason %}
{{ t.prompt_reason }}
{{ prompt.reason }} · {{ t.get('prompt_reason_' ~ prompt.reason, prompt.reason) }}
{% endif %}
{{ t.prompt_saved_revision }}
{{ prompt.artifact.revision if prompt.artifact else t.prompt_not_saved }}
{% if failed %}{{ read_error(errors.prompt_selected,t.prompt_revision) }} {% elif unavailable %}

{{ t.prompt_unavailable }}. {{ t.prompt_unavailable_body }}

{% else %} {% set shown = opened.content.instructions if opened else (prompt.effective.instructions if prompt.effective else (prompt.builtin.instructions if prompt.builtin else '')) %}

{{ t.prompt_instructions if opened or prompt.effective else t.prompt_builtin_template }}

{% if opened and opened.content.mode == 'auto' and not shown %}

{{ t.prompt_opened_auto_summary }}

{% else %}
{{ shown }}
{% endif %} {% if prompt.builtin %} {% if shown != prompt.builtin.instructions %}
{{ t.prompt_builtin_template }} · {{ prompt.builtin.version }}
{{ prompt.builtin.instructions }}
{% else %} {% if opened or prompt.effective %}

{{ t.prompt_builtin_matches_effective }}

{% endif %}

{{ t.prompt_builtin_version }}: {{ prompt.builtin.version }}

{% endif %} {% endif %} {% set demonstrations = opened.content.demonstrations if opened else (prompt.effective.demonstrations if prompt.effective else []) %} {% if demonstrations %}

{{ t.prompt_demonstrations }}

{{ demonstrations|tojson(indent=2) }}
{% endif %} {% endif %}
{{ t.prompt_explain_title }}
  • {{ t.prompt_explain_auto }}
  • {{ t.prompt_explain_no_effect }}
  • {{ t.prompt_explain_timing }}
  • {{ t.prompt_explain_constraints }}
{% if opened %}← {{ t.prompt_return_editor }}{% elif prompt.artifact %}{{ t.revision_history }} →{% endif %} {% set ns.feedback_rendered = true %} {{ prompt_feedback_alerts() }} {% set show_editor = not opened and not failed and not unavailable and ( (profile_prompt_can_admin and (prompt.status == 'supported' or (prompt.artifact and prompt.mode == 'custom'))) or has_scope_draft ) %} {% if show_editor %} {% set ns.draft_rendered = true %} {% set saved_custom = prompt.artifact and prompt.mode == 'custom' and prompt.effective %} {% set draft_etag = prompt_draft.reconcile_etag if has_scope_draft else (prompt.artifact_etag if prompt.artifact else '') %} {% set draft_mode = prompt_draft.mode if has_scope_draft else mode %} {% set draft_instructions = prompt_draft.instructions if has_scope_draft else (prompt.effective.instructions if saved_custom else (prompt.builtin.instructions if prompt.builtin else '')) %} {{ prompt_editor_form( draft_etag, draft_mode, draft_instructions, prompt.builtin.instructions if prompt.builtin else '', 'custom' if saved_custom else 'auto', prompt.effective.instructions if saved_custom else '', saved_custom, prompt.effective.demonstrations|length if saved_custom else 0, prompt.artifact and prompt.mode == 'custom', has_scope_draft, prompt_saved, request.query_params.get('prompt_saved_revision', '') if prompt_saved else '' ) }} {% elif unavailable and not opened and not failed and profile_prompt_can_admin and prompt.artifact and prompt.mode == 'custom' %} {% set reset_action = '/dashboard/prompts/profile-generate' ~ ('?scope=' ~ (scope|urlencode) ~ ('&lang=' ~ language if 'lang' in request.query_params else '') if scope else ('?lang=' ~ language if 'lang' in request.query_params else '')) %}
{% endif %} {% else %}

{{ t.prompt_status }}: {{ t.get('prompt_state_' ~ prompt.status,t.get('prompt_' ~ prompt.status,prompt.status)) }}{% if prompt.reason %} — {{ t.get('prompt_reason_' ~ prompt.reason, prompt.reason) }}{% endif %}

{% if not failed %}

{{ t.prompt_mode }}: {{ t.prompt_custom if mode == 'custom' else t.prompt_auto }}

{{ prompt.prompt_key }} · {{ t.prompt_revision }} {{ opened.revision if opened else (prompt.artifact.revision if prompt.artifact else t.prompt_auto) }} · {{ t.prompt_demonstrations }} {{ opened.content.demonstrations|length if opened else (prompt.effective.demonstrations|length if prompt.effective else 0) }}

{{ t.prompt_instructions if opened or prompt.effective else t.prompt_builtin_template }}

{{ opened.content.instructions if opened else (prompt.effective.instructions if prompt.effective else (prompt.builtin.instructions if prompt.builtin else '')) }}
{% if opened %}← {{ t.prompt_return_current }}{% elif prompt.artifact %}{{ t.revision_history }} →{% endif %} {% set demonstrations = opened.content.demonstrations if opened else (prompt.effective.demonstrations if prompt.effective else []) %} {% if demonstrations %}

{{ t.prompt_demonstrations }}

{{ demonstrations|tojson(indent=2) }}
{% endif %} {% else %}{{ prompt.prompt_key }}{{ read_error(errors.prompt_selected,t.prompt_revision) }}{% endif %} {% endif %}
{% endfor %}
{% endif %}{% endfor %}
{% if not ns.feedback_rendered %}{{ prompt_feedback_alerts() }}{% endif %} {% if has_scope_draft and not ns.draft_rendered %} {{ prompt_editor_form( prompt_draft.reconcile_etag or '', prompt_draft.mode, prompt_draft.instructions, '', 'auto', '', false, 0, false, true ) }} {% endif %} {% include 'components/revision-history.html' %}