Reload requires a daemon restart for this adapter.
+ )}
+
+ ))
+ )}
+
+
+ );
+}
+
+export function channelsPage(query) {
+ return ;
+}
diff --git a/ui/src/logs/logs.jsx b/ui/src/logs/logs.jsx
index cfb0df23f..9ca5e661a 100644
--- a/ui/src/logs/logs.jsx
+++ b/ui/src/logs/logs.jsx
@@ -1,17 +1,59 @@
+import { h } from "preact";
+import { useState, useEffect, useRef, useMemo } from "preact/hooks";
import "./logs.css";
import { api, subscribeLogs } from "../base/api.jsx";
-import { el, empty, mount, pill } from "../base/dom.jsx";
-import { logRow } from "../base/log-row.jsx";
-/**
- * The log view: history from the file on disk, then live lines appended from
- * the event stream.
- *
- * Filtering is applied server-side for history (the file is far larger than a
- * page of it) and client-side for live lines (they are already in hand). Both
- * paths go through the same matcher shape so a filter means the same thing
- * either side of the join.
- */
+function Pill({ text, kind = "idle" }) {
+ return {text};
+}
+
+function Empty({ title, detail }) {
+ return (
+
+
{title}
+ {detail &&
{detail}
}
+
+ );
+}
+
+export function levelKind(level) {
+ switch ((level || "").toUpperCase()) {
+ case "ERROR": return "danger";
+ case "WARN": return "warn";
+ case "DEBUG": return "idle";
+ default: return "info";
+ }
+}
+
+export function fmtValue(v) {
+ if (v == null) return "";
+ return typeof v === "object" ? JSON.stringify(v) : v;
+}
+
+export function shortTime(value) {
+ const d = value instanceof Date ? value : new Date(value);
+ if (Number.isNaN(d.getTime())) return "--:--:--";
+ return d.toTimeString().slice(0, 8);
+}
+
+function LogRow({ entry }) {
+ const fields = entry.fields || {};
+ return (
+
+ );
+}
+
+export function logsPage(query) {
+ return ;
}
diff --git a/ui/src/memory/memory.jsx b/ui/src/memory/memory.jsx
index 6f147c358..4a2e6ff63 100644
--- a/ui/src/memory/memory.jsx
+++ b/ui/src/memory/memory.jsx
@@ -1,102 +1,118 @@
+import { h } from "preact";
+import { useState, useEffect } from "preact/hooks";
import "./memory.css";
import { api } from "../base/api.jsx";
-import { el, empty, mount, pill } from "../base/dom.jsx";
-import { icon } from "../base/icons.jsx";
-/**
- * Memory: what Archie can recall, and with what.
- *
- * Memory is otherwise invisible -- it is a set of tools handed to the model at
- * discovery time, so without this page the only way to know what the agent can
- * remember is to read the provider source.
- */
-export function memoryPage() {
- const root = el("div");
- const body = el("div");
-
- render();
- load();
-
- function render() {
- mount(
- root,
- el(
- "div.page-head",
- el(
- "div",
- el("h1.page-title", "Memory"),
- el("p.page-sub", "What Archie can recall between conversations, and the tools it uses to do it."),
- ),
- el("div.page-actions", el("button.btn", { onclick: load }, icon("refresh", { size: 15 }), "Refresh")),
- ),
- body,
- );
- }
-
- async function load() {
- mount(body, el("div.card", el("div.mem-loading", "Loading…")));
- try {
- const res = await api.memory();
- if (!res.enabled || !res.providers?.length) {
- mount(
- body,
- el(
- "div.card",
- empty(
- "Memory is not configured",
- "Without a provider, Archie starts every conversation with no recollection of earlier ones.",
- ),
- ),
- );
- return;
- }
- mount(body, el("div.grid.grid-2", ...res.providers.map(providerCard)));
- } catch (err) {
- mount(body, el("div.card", empty("Cannot read memory providers", String(err.message || err))));
- }
- }
-
- return root;
+function Pill({ text, kind = "idle" }) {
+ return {text};
}
-function providerCard(p) {
- const tools = p.tools || [];
- return el(
- "div.card",
- el(
- "div.card-head",
- el(
- "div",
- el("h2.card-title", p.name || "provider"),
- el("p.card-sub", roleLabel(p.role)),
- ),
- p.available
- ? pill("ready", "ok")
- : pill("unavailable", "danger"),
- ),
- !p.available &&
- el(
- "p.mem-warning",
- "Configured but not usable right now — a required binary or connection may be missing.",
- ),
- tools.length
- ? el(
- "ul.mem-tools",
- ...tools.map((t) =>
- el(
- "li.mem-tool",
- el("div.mem-tool-name.mono", t.name),
- t.description && el("div.mem-tool-desc", t.description),
- ),
- ),
- )
- : el("p.mem-warning", "This provider exposes no tools, so the agent cannot use it."),
+function Empty({ title, detail }) {
+ return (
+
+
{title}
+ {detail &&
{detail}
}
+
);
}
-// Plain language: "builtin" and "external" are implementation words.
function roleLabel(role) {
return role === "external"
? "Added by you — an external store Archie was given"
: "Built in — always available to Archie";
}
+
+function ProviderCard({ provider: p }) {
+ const tools = p.tools || [];
+ return (
+
+
+
+
{p.name || "provider"}
+
{roleLabel(p.role)}
+
+ {p.available ? : }
+
+ {!p.available && (
+
+ Configured but not usable right now — a required binary or connection may be missing.
+
+ )}
+ {tools.length ? (
+
+ {tools.map((t, idx) => (
+
+
{t.name}
+ {t.description &&
{t.description}
}
+
+ ))}
+
+ ) : (
+
This provider exposes no tools, so the agent cannot use it.
What Archie can recall between conversations, and the tools it uses to do it.
+
+
+
+
+
+
+ {loading ? (
+
Loading…
+ ) : error ? (
+
+ ) : !enabled || !providers.length ? (
+
+
+
+ ) : (
+
+ {providers.map((p, idx) => (
+
+ ))}
+
+ )}
+
+
+ );
+}
+
+export function memoryPage(query) {
+ return ;
+}
diff --git a/ui/src/settings/config-row.jsx b/ui/src/settings/config-row.jsx
index 137cf0b00..93d8926a5 100644
--- a/ui/src/settings/config-row.jsx
+++ b/ui/src/settings/config-row.jsx
@@ -1,176 +1,152 @@
+import { h } from "preact";
+import { useState, useRef, useEffect } from "preact/hooks";
import { api } from "../base/api.jsx";
-import { el, mount } from "../base/dom.jsx";
-/**
- * One key/value row on the Configuration page, and its inline edit flow.
- *
- * Split out of settings.js so it can be unit-tested: settings.js imports
- * its own stylesheet, which the node test shim cannot parse. Same reason
- * tasks/task-row.js exists separately from tasks.js.
- *
- * A row renders as a three-column grid: label, value, actions. That shape
- * is the fix for three faults in the previous flex layout, all of which
- * were visible on screen:
- *
- * - label and value were pushed to opposite ends of a full-width card by
- * `justify-content: space-between`, so reading a pair meant tracking
- * across the viewport;
- * - the value could not shrink (no `min-width: 0`), so long values
- * overflowed into the Edit button and appeared truncated ("400" as
- * "40");
- * - the locked reason sat beside the overflowing value and ran onto the
- * end of it, rendering "...archie/work" and "pins the daemon's working
- * layout" as one unbroken string.
- */
-
-// valueText normalises a config value for display. 0 and false are real
-// values and must not collapse to the em dash the way null or an unset
-// string does, so the emptiness test is explicit rather than falsy.
export function valueText(value) {
if (value === null || value === undefined || value === "") return "—";
return String(value);
}
-// row renders one label/value pair. opts.key makes it editable via a
-// PATCH to /api/config; opts.locked[key] disables it with the server's
-// reason; opts.overridden marks a key whose file value is shadowed by the
-// runtime overlay and offers a reset; no key means a plain read-only row
-// (structured values and provenance).
-//
-// The value carries a title attribute because the column truncates with
-// an ellipsis: a long path or gate command must stay recoverable without
-// widening the row back into the action column.
-export function row(label, value, opts) {
+export function Row({ label, value, opts }) {
const text = valueText(value);
- // opts.hint (a field's backend-authored description, e.g. "0 means
- // unlimited.") rides as a tooltip on the label rather than its own DOM
- // node, so a generic schema-driven field can carry an explanation
- // without every hardcoded caller having to pass one.
- const labelEl = el("span.kv-label", opts?.hint ? { title: opts.hint } : {}, label);
- const valueEl = el(`span.kv-value.mono${text === "—" ? ".is-empty" : ""}`, { title: text }, text);
+ const [isEditing, setIsEditing] = useState(false);
+ const [editValue, setEditValue] = useState("");
+ const [error, setError] = useState(null);
+ const [saving, setSaving] = useState(false);
+ const [resetting, setResetting] = useState(false);
- if (!opts?.key) return el("div.kv", labelEl, valueEl);
+ const key = opts?.key;
+ if (!key) {
+ return (
+
+ {label}
+ {text}
+
+ );
+ }
- const lockedReason = opts.locked?.[opts.key];
+ const lockedReason = opts.locked?.[key];
if (lockedReason) {
- // The reason gets its own grid line rather than sitting beside the
- // value, which is what produced the run-together string above.
- return el("div.kv.is-locked", labelEl, valueEl, el("span.kv-note", lockedReason));
+ return (
+
+ {label}
+ {text}
+ {lockedReason}
+
+ );
}
- // opts.editable distinguishes a field the schema marks not-yet-editable
- // (e.g. a structured field with no dedicated editor) from a locked one:
- // no reason to show, just no edit affordance.
- if (opts.editable === false) return el("div.kv", labelEl, valueEl);
-
- const overridden = opts.overridden?.includes(opts.key);
- const editBtn = el("button.kv-btn", { type: "button", title: `Edit ${label}` }, "Edit");
- const resetBtn = overridden
- ? el("button.kv-btn", { type: "button", title: "Discard the dashboard value and fall back to the config file" }, "Reset")
- : null;
- const actions = el(
- "div.kv-actions",
- overridden && el("span.kv-flag", { title: "Set from the dashboard; this shadows the value in the config file" }, "overridden"),
- editBtn,
- resetBtn,
- );
- const rowEl = el("div.kv", labelEl, valueEl, actions);
-
- editBtn.addEventListener("click", () => startEdit(rowEl, label, opts, [labelEl, valueEl, actions]));
- resetBtn?.addEventListener("click", () => resetOverride(rowEl, resetBtn, opts));
- return rowEl;
-}
-
-// resetOverride deletes one runtime-overlay row via the reset seam, then
-// re-renders so the row returns to its file value. A failure reports on
-// the row's own note line; the previous version overwrote the "overridden"
-// marker's text with the error, destroying the marker to show it.
-function resetOverride(rowEl, btn, opts) {
- const { key, onSaved } = opts;
- btn.disabled = true;
- api
- .configReset(key)
- .then(() => onSaved?.())
- .catch((err) => {
- btn.disabled = false;
- note(rowEl, String(err.message || err));
- });
-}
-
-// note puts a message on the row's secondary line, creating the line if
-// the row does not already have one.
-function note(rowEl, message) {
- let target = rowEl.querySelector?.(".kv-note");
- if (!target) {
- target = el("span.kv-note.is-error");
- rowEl.appendChild(target);
+ if (opts.editable === false) {
+ return (
+
);
}
-// Work lifecycle: the vocabulary archied ships as a server catalog. Both the
-// statuses (label + pill severity) and the operator actions (label + button
-// variant) are rendered from the /api/task-meta payload, so a status or action
-// added on the backend appears here on the next load with no frontend change.
-// statusLabel/statusKind are used as fallbacks for an entry that arrives
-// without its own label/kind so the card degrades gracefully.
-function lifecycleCard(data) {
- const statuses = data?.statuses || [];
- const actions = data?.actions || [];
-
- const statusList = statuses.length
- ? el("div.kv-list", ...statuses.map((s) => statusLifecycleRow(s)))
- : empty("No statuses reported", "The server did not return any lifecycle statuses.");
-
- const actionList = actions.length
- ? el("div.kv-list", ...actions.map((a) => actionLifecycleRow(a)))
- : empty("No actions reported", "The server did not return any operator actions.");
-
- return section(
- "Work lifecycle",
- "The task statuses and operator actions archied ships. Add one on the backend and it appears here without a frontend change.",
- el("h3.cfg-subhead", "Statuses"),
- statusList,
- el("h3.cfg-subhead", "Actions"),
- actionList,
+function ProvenanceCard({ origins }) {
+ if (!origins?.length) return (
+
+
+
+ );
+ return (
+
+
+ {origins.map((origin, i) => (
+
+ ))}
+
+
);
}
-function statusLifecycleRow(s) {
- const label = s.label ?? statusLabel(s.id);
- const kind = s.kind ?? statusKind(s.id);
- return el("div.kv", el("span.kv-label", s.id), el("span.kv-value", pill(label, kind)));
-}
-
-function actionLifecycleRow(a) {
- const label = a.label ?? a.id;
- const cls = roleButtonClass(a.kind);
- const spec = cls ? `button.btn.btn-small.${cls}` : "button.btn.btn-small";
- return el("div.kv", el("span.kv-label", a.id), el("span.kv-value", el(spec, { type: "button", disabled: true }, label)));
-}
-
-// The button variant token for an action kind, matching the tasks board's
-// mapping: quiet/danger get their own tokens, everything else (primary, link)
-// falls back to the default .btn styling. A new kind never needs a new case.
function roleButtonClass(kind) {
return kind === "quiet" ? "btn-quiet" : kind === "danger" ? "btn-danger" : "";
}
-function repositoriesCard(repos, onSaved) {
- if (!repos?.length) {
- return section(
- "Repositories",
- "The repositories Archie polls for work.",
- empty("No repositories configured", "Add a [[repos]] entry in config.toml so Archie has somewhere to work."),
+function LifecycleCard({ data, error }) {
+ if (error) {
+ return (
+
+
+
);
}
- return section(
- "Repositories",
- "Each repository Archie polls, and the quality gate a change must pass before it opens a pull request. " +
- "Concurrent tasks, retries, and self-review are per-repository overrides -- PATCH /api/config/repos/{owner}/{name}, " +
- "not the file config.toml directly.",
- el(
- "div.table-scroll",
- el(
- "table.table",
- el(
- "thead",
- el(
- "tr",
- ...["Repository", "Base branch", "Ecosystem", "Quality gate", "Protected paths", "Concurrent", "Max retries", "Self-review"].map((h) =>
- el("th", h),
- ),
- ),
- ),
- el(
- "tbody",
- ...repos.map((r) =>
- el(
- "tr",
- el("td.strong", `${r.owner}/${r.name}`),
- el("td.mono", r.base),
- el("td", r.ecosystem || "go"),
- el("td.mono", gateSummary(r.gate)),
- el("td.mono", r.protect?.length ? r.protect.join(", ") : "—"),
- repoBoolCell(r, "allow_concurrent", onSaved),
- repoIntCell(r, "max_retries", onSaved),
- repoBoolCell(r, "review_enabled", onSaved),
- ),
- ),
- ),
- ),
- ),
+ const statuses = data?.statuses || [];
+ const actions = data?.actions || [];
+
+ return (
+
+
+ );
+}
-/**
- * Per-component deployment/update status (GET /api/version): how each
- * component is installed, what's actually running, and whether that
- * agrees with what the update-check command claims. The comparison basis
- * -- the exact installed claim, running version and reference this status
- * was computed from -- sits in the row's title attribute (a hover tooltip)
- * rather than a separate expand control, since it's supplementary detail
- * an operator wants on demand, not on every glance at the table.
- *
- * Split out from settings.js (which top-level imports settings.css) so it
- * can be unit tested under plain node --test.
- */
-export function updateStatusCard(components) {
- if (!components.length) {
- return section(
- "How each component is deployed, and whether what's running matches what's installed.",
- empty("No components reported", "The configured update-check command returned nothing."),
+function Section({ sub, title, children }) {
+ return (
+