feat(curator): track and expose recent activity per curator

Add a small bounded activity tracker (activityTracker, in
internal/domain/curator/activity.go) fed directly from the runtime's
existing emitRun point: last-run time, last-run action count, and up to
20 recent actions per curator, newest first. No persistence layer -- it
resets on restart, same as the rest of the runtime's in-memory state.
Registry.RecordActivity/Activity expose it.

Closes archie-core-1786637489932-6-1f803e02.
This commit is contained in:
sam committed 2026-08-28 22:28:48 +10:00
1 parent 76d13b76ce
commit ced7bb8038
15 files changed
+641 -8

No files matched your search

+1
View File
@@ -79,6 +79,7 @@ export const api = {
},
skills: () => req("/api/skills"),
channels: () => req("/api/channels"),
curators: () => req("/api/curators"),
channelReload: async (id) => {
const res = await fetch(`/api/channels/${encodeURIComponent(id)}/reload`, {
method: "POST", headers: { Accept: "application/json", "Content-Type": "application/json", "X-Archie-CSRF": "1" },
+1
View File
@@ -16,6 +16,7 @@ const paths = {
workflows: '<path d="M4 7h6a3 3 0 0 1 3 3v4a3 3 0 0 0 3 3h4"/><path d="M17 4l3 3-3 3"/><path d="M7 21l-3-3 3-3"/>',
memory: '<circle cx="12" cy="12" r="3.2"/><path d="M12 3v3.4M12 17.6V21M3 12h3.4M17.6 12H21M5.6 5.6l2.4 2.4M16 16l2.4 2.4M18.4 5.6L16 8M8 16l-2.4 2.4"/>',
channels: '<rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3.5 7l8.5 6 8.5-6"/>',
curators: '<circle cx="12" cy="12" r="8"/><path d="M12 8v4l3 2"/>',
captures: '<path d="M12 3v11M12 14l-4-4M12 14l4-4"/><path d="M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"/>',
mappings: '<circle cx="5" cy="7" r="2"/><circle cx="5" cy="17" r="2"/><circle cx="19" cy="12" r="2"/><path d="M7 7l10 5M7 17l10-5"/>',
settings: '<circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.9l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-2.9 1.2V21a2 2 0 1 1-4 0v-.1A1.7 1.7 0 0 0 7 19.4a1.7 1.7 0 0 0-1.9.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1A1.7 1.7 0 0 0 3 15H3a2 2 0 1 1 0-4h.1A1.7 1.7 0 0 0 4.6 7a1.7 1.7 0 0 0-.3-1.9l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1A1.7 1.7 0 0 0 9 3.6V3a2 2 0 1 1 4 0v.1A1.7 1.7 0 0 0 15 4.6h.1a1.7 1.7 0 0 0 1.9-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.9V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"/>',
+62
View File
@@ -0,0 +1,62 @@
/* Curators-only styles. */
.curator-card {
display: flex;
flex-direction: column;
gap: var(--sp-2);
}
.curator-health-message {
color: var(--fg-muted);
font-size: var(--text-sm);
margin: 0;
}
.curator-meta {
color: var(--fg-subtle);
font-size: var(--text-xs);
margin: 0;
}
.curator-actions {
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
gap: var(--sp-2);
}
.curator-action {
border-top: 1px solid var(--border);
padding-top: var(--sp-2);
}
.curator-action-head {
display: flex;
justify-content: space-between;
gap: var(--sp-2);
font-size: var(--text-sm);
}
.curator-action-type {
font-weight: 600;
color: var(--fg);
}
.curator-action-time {
color: var(--fg-subtle);
font-size: var(--text-xs);
}
.curator-action-detail {
color: var(--fg-muted);
font-size: var(--text-sm);
margin: var(--sp-1) 0 0;
}
.curator-action-reason {
color: var(--fg-subtle);
font-size: var(--text-xs);
margin: var(--sp-1) 0 0;
}
+104
View File
@@ -0,0 +1,104 @@
import "./curators.css";
import { api } from "../base/api.js";
import { el, empty, mount, pill, ago } from "../base/dom.js";
/**
* Curator observability (archie-core-1786637489932-6). Backed by GET
* /api/curators, which reads the daemon's live curator.Registry: which
* curators are registered, their point-in-time health, and their recent
* activity (last run, action count, and the actions themselves with the
* reason each one happened) -- see internal/webui/api_curators.go.
*/
export function curatorsPage() {
const root = el("div");
const cardGrid = el("div.grid.grid-2");
render();
load();
function render() {
mount(
root,
el(
"div.page-head",
el(
"div",
el("h1.page-title", "Curators"),
el("p.page-sub", "Background agents that maintain memory and skills: what ran, and why."),
),
el("div.page-actions", el("button.btn", { onclick: load }, "Refresh")),
),
cardGrid,
);
}
async function load() {
try {
const res = await api.curators();
renderCards(res?.curators || []);
} catch (err) {
mount(cardGrid, empty("Cannot reach archied", String(err.message || err)));
}
}
function renderCards(curators) {
if (!curators.length) {
mount(
cardGrid,
empty(
"No curators registered",
"Curators are background agent loops that maintain memory and skills. None are registered on this daemon.",
),
);
return;
}
mount(cardGrid, ...curators.map(curatorCard));
}
function healthKind(status) {
switch (status) {
case "healthy":
return "ok";
case "degraded":
return "warn";
case "unhealthy":
return "danger";
default:
return "idle";
}
}
function curatorCard(c) {
const actions = c.recent_actions || [];
return el(
"div.card.curator-card",
el(
"div.card-head",
el("h3.card-title", c.name),
pill(c.health?.status || "unknown", healthKind(c.health?.status)),
),
c.health?.message && el("p.curator-health-message", c.health.message),
el(
"p.curator-meta",
c.last_run_at
? `Last ran ${ago(c.last_run_at)} · ${c.last_run_actions} action${c.last_run_actions === 1 ? "" : "s"}`
: "Has not run yet",
),
actions.length
? el(
"ul.curator-actions",
...actions.map((a) =>
el(
"li.curator-action",
el("div.curator-action-head", el("span.curator-action-type", a.type || "action"), el("span.curator-action-time", ago(a.at))),
a.detail && el("p.curator-action-detail", a.detail),
a.reason && el("p.curator-action-reason", `Why: ${a.reason}`),
),
),
)
: el("p.curator-meta", "No recorded activity yet."),
);
}
return root;
}
+2
View File
@@ -6,6 +6,7 @@ import { tasksPage } from "./tasks/tasks.js";
import { skillsPage } from "./skills/skills.js";
import { workflowsPage } from "./workflows/workflows.js";
import { channelsPage } from "./channels/channels.js";
import { curatorsPage } from "./curators/curators.js";
import { settingsPage } from "./settings/settings.js";
import { logsPage } from "./logs/logs.js";
import { capturesPage } from "./captures/captures.js";
@@ -31,6 +32,7 @@ const routes = [
{ path: "/skills", label: "Skills", icon: "skills", view: skillsPage },
{ path: "/workflows", label: "Workflows", icon: "workflows", view: workflowsPage },
{ path: "/memory", label: "Memory", icon: "memory", view: memoryPage },
{ path: "/curators", label: "Curators", icon: "curators", view: curatorsPage },
{ path: "/channels", label: "Channels", icon: "channels", view: channelsPage },
{ path: "/settings", label: "Configuration", icon: "settings", view: settingsPage },
];