Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust
9.3 KB
Raw Blame
{% extends "management/base.html" %}
{% block content %}
{% if screen == "login" %}
<section class="management-panel max-w-md mx-auto"><h1>Sign in</h1><p class="management-muted mb-6">Use your ai-memory username and password.</p>
<form action="{{ root }}/action" method="post" class="space-y-4"><input type="hidden" name="action" value="login">
<label>Username<input name="username" autocomplete="username" required></label><label>Password<input name="password" type="password" autocomplete="current-password" required></label><button class="management-primary">Sign in</button></form></section>
{% else if screen == "password" %}
<section class="management-panel max-w-lg"><h1>Change password</h1><p class="management-muted mb-6">Choose a new password before continuing. Changing it signs out your other browser sessions.</p>
<form action="{{ root }}/action" method="post" class="space-y-4"><input type="hidden" name="action" value="password"><input type="hidden" name="csrf" value="{{ csrf }}">
<label>Current password<input type="password" name="current_password" autocomplete="current-password" required></label>
<label>New password (at least {{ min_password }} characters)<input type="password" name="new_password" autocomplete="new-password" minlength="{{ min_password }}" required></label>
<label>Confirm new password<input type="password" name="new_password_confirmation" autocomplete="new-password" minlength="{{ min_password }}" required></label><button class="management-primary">Change password</button></form></section>
{% else if screen == "sessions" %}
<h1>{% if admin %}All sessions{% else %}Your sessions{% endif %}</h1><p class="management-muted mb-6">Inspect captured events and manage sessions. Shared legacy sessions require an Admin to delete.</p>
<nav aria-label="Projects" class="flex flex-wrap gap-3 mb-6">{% for p in projects %}<a href="{{ p.href }}">{{ p.name }}</a>{% endfor %}</nav>
<h2 class="mb-4">{{ workspace }} / {{ project }}</h2><div class="management-panel overflow-x-auto">{% if sessions.is_empty() %}<p class="management-muted py-8">No sessions in this project, or no accessible projects.</p>{% else %}<table class="w-full text-left text-sm"><thead><tr><th>Session</th><th>Owner</th><th>Started (UTC)</th><th>State</th><th>Events</th><th>Actions</th></tr></thead><tbody>
{% for s in sessions %}<tr><td>{{ s.agent }}<br><span class="management-mono management-muted" title="{{ s.id }}">{{ s.short_id }}</span></td><td>{{ s.owner }}</td><td>{{ s.started }}</td><td>{{ s.state }}</td><td>{{ s.count }}</td><td><div class="flex gap-2 items-center"><a class="management-button" href="{{ s.href }}">Inspect</a>
{% if s.can_delete %}<form action="{{ root }}/action" method="post"><input type="hidden" name="action" value="preview-purge"><input type="hidden" name="csrf" value="{{ csrf }}"><input type="hidden" name="session" value="{{ s.id }}"><input type="hidden" name="workspace" value="{{ workspace }}"><input type="hidden" name="project" value="{{ project }}"><button class="management-danger">Delete</button></form>{% endif %}</div></td></tr>{% endfor %}
</tbody></table>{% endif %}</div>
{% else if screen == "session" %}
<h1>Session events</h1><p class="management-mono management-muted mb-6">{{ session_id }}</p><div class="space-y-4">{% for o in observations %}<article class="management-panel"><h2>{{ o.kind }} · {{ o.title }}</h2><pre class="whitespace-pre-wrap break-words text-sm mt-4">{{ o.body }}</pre></article>{% endfor %}</div>
{% else if screen == "users" %}
<h1>Users</h1><p class="management-muted mb-6">Add operators and manage access. Disabling browser access does not revoke existing MCP API keys.</p>
<form action="{{ root }}/action" method="post" class="management-panel flex flex-wrap gap-4 items-end mb-6"><input type="hidden" name="action" value="add-user"><input type="hidden" name="csrf" value="{{ csrf }}"><label>Username<input name="username" required maxlength="64"></label><label>Display name<input name="name"></label><label>Role<select name="role"><option value="user">User</option><option value="root">Admin</option></select></label><button class="management-primary">Add user</button></form>
<div class="space-y-4">{% for u in users %}<article class="management-panel"><h2>{{ u.username }}</h2><p class="management-muted mb-4">{{ u.name }} · {{ u.role }} · {{ u.status }}</p>
<div class="flex flex-wrap gap-3">
<form action="{{ root }}/action" method="post"><input type="hidden" name="action" value="role"><input type="hidden" name="username" value="{{ u.username }}"><input type="hidden" name="role" value="{{ u.next_role }}"><input type="hidden" name="csrf" value="{{ csrf }}"><button>{% if u.next_role == "root" %}Make admin{% else %}Make user{% endif %}</button></form>
<form action="{{ root }}/action" method="post"><input type="hidden" name="action" value="reset-password"><input type="hidden" name="username" value="{{ u.username }}"><input type="hidden" name="csrf" value="{{ csrf }}"><button>Reset password</button></form>
<form action="{{ root }}/action" method="post"><input type="hidden" name="action" value="{% if u.enabled %}disable{% else %}enable{% endif %}"><input type="hidden" name="username" value="{{ u.username }}"><input type="hidden" name="csrf" value="{{ csrf }}"><button>{% if u.enabled %}Disable{% else %}Enable{% endif %}</button></form>
<form action="{{ root }}/action" method="post" class="flex gap-2"><input type="hidden" name="action" value="issue-key"><input type="hidden" name="username" value="{{ u.username }}"><input type="hidden" name="csrf" value="{{ csrf }}"><label>Key label<input name="label" value="console-issued" required></label><button>Issue MCP key</button></form>
</div><ul class="mt-5 space-y-2">{% for k in u.keys %}<li class="flex flex-wrap gap-3 items-center">{{ k.label }} · {% if k.active %}Active{% else %}Revoked{% endif %}{% if k.active %}<form action="{{ root }}/action" method="post"><input type="hidden" name="action" value="revoke-admin-key"><input type="hidden" name="credential" value="{{ k.id }}"><input type="hidden" name="csrf" value="{{ csrf }}"><button class="management-danger">Revoke</button></form>{% endif %}</li>{% endfor %}</ul>
</article>{% endfor %}</div>
{% else if screen == "keys" %}
<h1>MCP connection</h1><p class="management-muted mb-6">Connect your coding agent with a personal API key. Browser passwords and session cookies cannot authenticate MCP.</p>
<div class="management-panel mb-6"><p>Remote MCP endpoint: <code class="management-mono" id="mcp-endpoint">{{ mcp_path }}</code></p><p class="management-muted mt-3">Use your server's origin with this path and send the key as an Authorization: Bearer header. Use the same key for lifecycle hooks.</p></div>
<form action="{{ root }}/action" method="post" class="management-panel flex flex-wrap gap-4 items-end mb-6"><input type="hidden" name="action" value="create-key"><input type="hidden" name="csrf" value="{{ csrf }}"><label>Key label<input name="label" required></label><button class="management-primary">Create API key</button></form>
<div class="management-panel space-y-4">{% for k in keys %}<div class="flex flex-wrap gap-4 items-center justify-between"><span>{{ k.label }} <code>{{ k.preview }}</code> · {% if k.active %}Active{% else %}Revoked{% endif %}</span>{% if k.active %}<form action="{{ root }}/action" method="post"><input type="hidden" name="action" value="revoke-key"><input type="hidden" name="credential" value="{{ k.id }}"><input type="hidden" name="csrf" value="{{ csrf }}"><button class="management-danger">Revoke</button></form>{% endif %}</div>{% endfor %}{% if keys.is_empty() %}<p>No API keys yet.</p>{% endif %}</div>
{% else if screen == "secret" %}
<section class="management-panel max-w-lg"><h1>{{ secret_title }}</h1><p class="management-muted my-4">Shown once. Save it now; leaving this page clears it from the console.</p><pre class="management-mono whitespace-pre-wrap break-all" id="issued-secret" data-return="{{ root }}/sessions">{{ secret }}</pre><a class="management-button mt-6 inline-block" href="{{ root }}/sessions">I saved it</a></section>
{% else if screen == "purge" %}
<section class="management-panel max-w-lg"><h1>Delete session</h1><p class="management-muted mb-4">This removes captured events, authored handoffs, generated session-page versions, and review records. Maintained knowledge and later manual page versions are preserved. Git history and backups can retain earlier content.</p>
<dl class="grid grid-cols-2 gap-3 mb-5">{% for c in counts %}<dt>{{ c.label }}</dt><dd>{{ c.value }}</dd>{% endfor %}</dl>
<form action="{{ root }}/action" method="post"><input type="hidden" name="action" value="purge"><input type="hidden" name="csrf" value="{{ csrf }}"><input type="hidden" name="session" value="{{ session_id }}"><input type="hidden" name="workspace" value="{{ workspace }}"><input type="hidden" name="project" value="{{ project }}"><label class="flex gap-3"><input type="checkbox" name="confirm" value="true" required>I understand and want to delete this session.</label><button class="management-danger mt-5">Delete session</button></form></section>
{% endif %}
{% if !previous.is_empty() || !next.is_empty() %}<nav aria-label="Pagination" class="flex justify-between mt-5">{% if !previous.is_empty() %}<a class="management-button" href="{{ previous }}">Previous</a>{% else %}<span></span>{% endif %}{% if !next.is_empty() %}<a class="management-button" href="{{ next }}">Next</a>{% endif %}</nav>{% endif %}
{% endblock %}