{% import "components.html" as c with context %} {# the configuration of an agent as cards: the agent itself, then one card per channel and per runtime, kept as a stack of pages per kind with a blank page at the end to start another. field names carry the card's number, so the handler reads the cards back in the order they were added; the values sent are the configuration's own words, the page shows them in the reader's #} {% macro kind_name(family, kind) -%} {{ t.text("agents." ~ family ~ "." ~ kind) if t.has("agents." ~ family ~ "." ~ kind) else kind }} {%- endmacro %} {% macro logo(family, kind) -%} {% if family == "channel" %}{{ c.channels((kind,)) }}{% else %}{{ c.runtimes((kind,)) }}{% endif %} {%- endmacro %} {% macro basic(values) -%}
{{ c.select("agent-mode", "mode", [("session", t.text("agents.mode.session")), ("dangerous_individual", t.text("agents.mode.dangerous_individual"))], values.get("mode", "session"), attrs='x-model="mode"') }}
{{ t.text("agents.seconds") }}
{%- endmacro %} {# what the agent tells a conversation still waiting to be looked at #} {% macro reply(value) -%}
{{ t.text("contacts.reply") }}

{{ t.text("contacts.reply_hint") }}

{%- endmacro %} {% macro model_options(models) -%} {% set fallback = models|selectattr("default")|list %} {% for item in models if item.id != "default" %}{% endfor %} {%- endmacro %} {# a field waiting on what the computer lists: turning while it is asked, the way to ask again when it did not answer #} {% macro waiting() -%} {{ c.icon("loader") }} {%- endmacro %} {% macro initial(values, reply, kept=false, origins=none) -%} {% set labels = {"modelDefault": t.text("agents.model_default"), "effortDefault": t.text("agents.effort_default"), "basic": t.text("agents.step.basic"), "reply": t.text("contacts.reply"), "filled": t.text("agents.summary.filled"), "empty": t.text("agents.summary.empty"), "on": t.text("agents.summary.on"), "off": t.text("agents.summary.off"), "none": t.text("agents.summary.none"), "seconds": t.text("agents.seconds"), "secrets": secrets, "fields": {"name": t.text("agents.name"), "mode": t.text("agents.mode"), "idle_timeout": t.text("agents.idle"), "model": t.text("agents.model"), "effort": t.text("agents.effort"), "sandbox_mode": t.text("agents.sandbox"), "network_access": t.text("agents.network"), "env": t.text("agents.env"), "app_id": t.text("agents.field.app_id"), "region": t.text("agents.field.region"), "bot_id": t.text("agents.field.bot_id"), "websocket_url": t.text("agents.field.websocket_url"), "token": t.text("agents.field.token"), "app_secret": t.text("agents.field.app_secret"), "secret": t.text("agents.field.secret")}, "values": {"mode": {"session": t.text("agents.mode.session"), "dangerous_individual": t.text("agents.mode.dangerous_individual")}, "region": {"feishu": t.text("agents.region.feishu"), "lark": t.text("agents.region.lark")}, "sandbox_mode": {"workspace-write": t.text("agents.sandbox.workspace-write"), "danger-full-access": t.text("agents.sandbox.danger-full-access")}}, "channel": {"telegram": kind_name("channel", "telegram")|trim, "lark": kind_name("channel", "lark")|trim, "wecom": kind_name("channel", "wecom")|trim}, "runtime": {"codex": kind_name("runtime", "codex")|trim, "claudecode": kind_name("runtime", "claudecode")|trim}} %} {%- endmacro %} {% macro card_head(family) -%}
{% for kind in ("telegram", "lark", "wecom") if family == "channel" %}{% endfor %} {% for kind in ("codex", "claudecode") if family == "runtime" %}{% endfor %}
{%- endmacro %} {% macro channel_card() -%} {{ card_head('channel') }} {% for kind, field in secrets.items() %} {% endfor %} {%- endmacro %} {% macro runtime_card() -%} {{ card_head('runtime') }}
{{ c.icon('chevron-down') }}{{ waiting() }}
{{ c.icon('chevron-down') }}{{ waiting() }}
{{ c.icon('chevron-down') }}
{%- endmacro %} {% macro kinds(family, listed) -%} {% if listed.answer != 'listed' %}

{{ t.text('agents.' ~ listed.answer, {'code': listed.code}) }}

{% else %} {% for item in listed.kinds %}{% endfor %} {% endif %} {%- endmacro %} {% macro deck(family, owner) -%}
{{ t.text('agents.blank.' ~ family) }}
{{ c.icon('loader') }}
{%- endmacro %}