A name, a tagline, a logo, a favicon and the launcher icons derived from it; the Middle-earth strings as data; themes as token sets; and a stylesheet for what none of that reaches. All four are on one page, in one settings group. The snapshot is a Jinja global over a process-level cache, because render() has no session and four render paths never reach it at all -- the sign-in page, the error pages, the offline page and the SSE fragments. A context value would have had to be threaded through every one and would still have missed those. It being a global is also what lets mark() branch on an uploaded logo without any of its six call sites learning about branding; the macro that renders the sidebar link is called brandlink now, because a macro imported as `brand` shadows the global for the whole template and took out every page at once. Defaults in code and overrides in the database, as the prompt fragments do, with one difference stated in the module: an empty fragment means off, an empty flavour string means the shipped wording. And blanked rather than dropped -- settings_store.update merges, so an omitted key leaves what was stored last time and "I typed the default back in" would store something different from "I changed nothing". A custom theme sets a handful of tokens and inherits the rest, and the inheritance is a CSS fact: tokens.css matches [data-base="shire"] as well as [data-theme="shire"], so a custom light theme lands on parchment rather than four light colours on near-black. Values are validated on read rather than on save, because a theme written straight into the settings table still has to produce a stylesheet that parses -- a `}` in a value ends the rule and silently breaks every rule after it. The soft variants are derived from the accent, or a changed accent leaves focus rings in the old hue and reads as half-working. /branding.css is a route, not an inline block: an external stylesheet has no HTML context to escape from. The link carries a content hash, so a save is not left to the browser's cache, and it is deliberately outside the service worker's precache list, which is versioned by the release. The instance name moved off /admin/general rather than being duplicated there. An upgrade keeps it: the general row is read as a seed exactly while the branding row has never mentioned the name, which is `key in row` and not `row[key] is truthy` -- the two read alike would resurrect the old name underneath a cleared one. The theme list stops being a hard-coded pair in five places. Every failure mode in that area is silent, so it is driven under a DOM stub as well as tested. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
104 lines
3.6 KiB
HTML
104 lines
3.6 KiB
HTML
{% extends "agents/_layout.html" %}
|
|
{% from "_macros.html" import icon %}
|
|
|
|
{% block title %}Connections - {{ brand.name }}{% endblock %}
|
|
{% block heading %}Connections{% endblock %}
|
|
{% block actions %}
|
|
<a class="btn btn--primary btn--sm" href="/agents/new">
|
|
{{ icon("plus", "icon--sm") }} Add a connection
|
|
</a>
|
|
{% endblock %}
|
|
|
|
{% block agents_content %}
|
|
<p class="admin-lede">
|
|
Machines an <strong>Agent</strong> chat can work on. A model with one of these
|
|
can read files, write files and run commands <em>there</em> — never here.
|
|
Which of those it may do without asking you first is the chat's mode.
|
|
</p>
|
|
|
|
<div class="alert">
|
|
{{ icon("shield", "icon--sm") }}
|
|
<span>
|
|
Whatever this connection can reach, a model in an agent chat can reach. A
|
|
container built for the job, with one project mounted into it, is a very
|
|
different thing from a key to a machine you care about — and {{ brand.name }} cannot
|
|
tell them apart.
|
|
</span>
|
|
</div>
|
|
|
|
{% if problem %}
|
|
<div class="alert alert--error">
|
|
{{ icon("warning", "icon--sm") }} <span>{{ problem }}</span>
|
|
</div>
|
|
{% elif not enabled %}
|
|
<div class="alert alert--error">
|
|
{{ icon("warning", "icon--sm") }}
|
|
<span>
|
|
Agent chats are switched off for this instance. You can still add
|
|
connections here, but nothing will use them until an administrator turns
|
|
them on.
|
|
</span>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if saved %}
|
|
<div class="alert alert--success">{{ icon("check", "icon--sm") }} <span>{{ saved }}</span></div>
|
|
{% endif %}
|
|
|
|
{% if not profiles %}
|
|
<div class="empty">
|
|
{{ icon("server", "empty__mark") }}
|
|
<h2 class="empty__title">No connections yet</h2>
|
|
<p class="empty__text">
|
|
Add the host, the user to log in as, and a key or password. Then press
|
|
<strong>Check</strong> — you will be shown its fingerprint to confirm before
|
|
anything is sent to it.
|
|
</p>
|
|
<a class="btn btn--primary" href="/agents/new">
|
|
{{ icon("plus", "icon--sm") }} Add a connection
|
|
</a>
|
|
</div>
|
|
{% else %}
|
|
|
|
<div class="model-rows">
|
|
{% for profile in profiles %}
|
|
{# `refused` is why this connection cannot be used at all, which is a stronger
|
|
statement than `disabled` -- that one is the owner's own choice and this one
|
|
is not theirs to make. Greyed out with the same class, because "you cannot
|
|
use this" is one visual idea however it came about. #}
|
|
{% set refused = refusals.get(profile.id, "") %}
|
|
<div class="model-row {{ 'is-off' if not profile.enabled or refused }}">
|
|
<div class="model-row__main">
|
|
<div class="model-row__title">
|
|
<a class="model-row__name" href="/agents/{{ profile.id }}">{{ profile.name }}</a>
|
|
{% if refused %}
|
|
<span class="badge badge--danger">not allowed</span>
|
|
{% elif profile.verified %}
|
|
<span class="badge badge--leaf">key confirmed</span>
|
|
{% else %}
|
|
<span class="badge badge--danger">not checked</span>
|
|
{% endif %}
|
|
{% if not profile.enabled %}<span class="badge">disabled</span>{% endif %}
|
|
{% if profile.auth == "password" %}<span class="badge">password</span>{% endif %}
|
|
</div>
|
|
<code class="model-row__id">
|
|
{{ profile.address }}{% if profile.default_dir %} · {{ profile.default_dir }}{% endif %}
|
|
</code>
|
|
{% if refused %}
|
|
<p class="text-xs danger">{{ refused }}</p>
|
|
{% elif profile.last_error %}
|
|
<p class="text-xs danger">{{ profile.last_error }}</p>
|
|
{% elif profile.server_info.system %}
|
|
<p class="text-xs faint">{{ profile.server_info.system }}</p>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="model-row__actions">
|
|
<a class="btn btn--sm" href="/agents/{{ profile.id }}">Open</a>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
{% endblock %}
|