feat(webui): Personas and Schedules settings pages

Personas: a filterable list with the default marked, and an editor with
name, a default toggle, the system prompt with a character and token
count, Duplicate and Delete. Renaming or deleting the default keeps the
collection naming one that exists; the last persona cannot be deleted.

Schedules: an empty state, then one card per job with ID, task title,
instructions, when (interval, cron line or a single time) and overlap.
Settings opens on Personas.
This commit is contained in:
sam committed 2026-09-25 15:14:18 +10:00
1 parent 426085a890
commit 33da726cb1
11 files changed
+426 -15

No files matched your search

+2
View File
@@ -28,9 +28,11 @@ const settings: NavSpec = {
{
label: "Agents",
paths: [
"/settings/personas",
"/settings/models",
"/settings/skills",
"/settings/curators",
"/settings/schedules",
"/settings/scheduling-policy",
"/settings/advanced",
],
+27 -1
View File
@@ -8,6 +8,8 @@ import LogsPage from "@/logs/LogsPage.vue";
import SchedulingPolicyPage from "@/settings/SchedulingPolicyPage.vue";
import ToolsPage from "@/settings/ToolsPage.vue";
import HistoryPage from "@/settings/HistoryPage.vue";
import PersonasPage from "@/settings/PersonasPage.vue";
import SchedulesPage from "@/settings/SchedulesPage.vue";
import SystemAdvancedPage from "@/settings/SystemAdvancedPage.vue";
import SystemIdentitiesPage from "@/settings/SystemIdentitiesPage.vue";
import SystemAppearancePage from "@/settings/SystemAppearancePage.vue";
@@ -194,6 +196,30 @@ const routes = [
section: "channels",
},
},
{
path: "/settings/personas",
name: "settings-personas",
component: PersonasPage,
meta: {
navPath: "/settings",
settings: true,
label: "Personas",
description: "The system prompts chat runs under, and the default.",
section: "settings",
},
},
{
path: "/settings/schedules",
name: "settings-schedules",
component: SchedulesPage,
meta: {
navPath: "/settings",
settings: true,
label: "Schedules",
description: "Work Archie starts on its own, on a timetable.",
section: "settings",
},
},
{
path: "/settings/scheduling-policy",
name: "settings-scheduling-policy",
@@ -245,7 +271,7 @@ const routes = [
},
{
path: "/settings",
redirect: "/settings/models",
redirect: "/settings/personas",
meta: {
label: "Settings",
description: "Everything you configure: agents, integrations, runtime.",
+139
View File
@@ -0,0 +1,139 @@
<script setup lang="ts">
import { computed, onMounted, ref } from "vue";
import { storeToRefs } from "pinia";
import { Copy, Plus, Trash2 } from "@lucide/vue";
import PageHeader from "@/base/PageHeader.vue";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { SettingRow } from "@/components/ui/setting-row";
import { StatusPill } from "@/components/ui/status-pill";
import { Switch } from "@/components/ui/switch";
import { Textarea } from "@/components/ui/textarea";
import { cn } from "@/lib/utils";
import { resourcesForPage, useControlPlaneStore } from "@/stores/control-plane";
import HistoryLink from "./HistoryLink.vue";
import {
duplicatePersona,
removePersona,
renamePersona,
type PersonaCollection,
} from "./personas";
const KIND = "personas";
const store = useControlPlaneStore();
const { catalog, catalogError } = storeToRefs(store);
onMounted(store.load);
const resources = computed(() => resourcesForPage(catalog.value, "personas"));
const collection = computed(() => store.drafts[KIND]?.value as PersonaCollection | undefined);
const error = computed(() => store.stateFor(KIND).error);
const filter = ref("");
const selected = ref(0);
const shown = computed(() =>
(collection.value?.personas ?? [])
.map((persona, index) => ({ persona, index }))
.filter(({ persona }) => persona.name.toLowerCase().includes(filter.value.trim().toLowerCase())),
);
const current = computed(() => collection.value?.personas[selected.value]);
const isDefault = computed(() => !!current.value && collection.value?.default === current.value.name);
const chars = computed(() => current.value?.prompt.length ?? 0);
function add() {
const c = collection.value;
if (!c) return;
const taken = new Set(c.personas.map((p) => p.name));
let name = "new-persona";
for (let n = 2; taken.has(name); n++) name = `new-persona-${n}`;
c.personas.push({ name, prompt: "" });
selected.value = c.personas.length - 1;
}
function duplicate() {
if (collection.value) selected.value = duplicatePersona(collection.value, selected.value);
}
function remove() {
if (collection.value && removePersona(collection.value, selected.value))
selected.value = Math.max(0, selected.value - 1);
}
function rename(name: string | number) {
if (collection.value) renamePersona(collection.value, selected.value, String(name));
}
</script>
<template>
<div>
<PageHeader title="Personas">
<HistoryLink :kinds="resources.map((r) => r.kind)" />
</PageHeader>
<p class="-mt-4 mb-8 text-sm text-fg-muted">The system prompts chat can run under. One is the default.</p>
<p v-if="catalogError || error" class="mb-4 text-sm text-danger" role="alert">
{{ catalogError || error }}
</p>
<div v-if="collection" class="grid gap-6 md:grid-cols-[16rem_1fr]">
<div class="flex min-w-0 flex-col gap-2">
<div class="flex gap-2">
<Input v-model="filter" placeholder="Filter" aria-label="Filter personas" />
<Button variant="outline" size="icon" aria-label="New persona" @click="add"><Plus /></Button>
</div>
<ul class="flex flex-col gap-0.5" aria-label="Personas">
<li v-for="{ persona, index } in shown" :key="index">
<button
type="button"
:aria-current="index === selected ? 'true' : undefined"
:class="
cn(
'w-full rounded-md px-3 py-2 text-left transition-colors hover:bg-secondary',
index === selected && 'bg-secondary',
)
"
@click="selected = index"
>
<span class="flex items-center gap-2">
<span class="truncate font-mono text-[13px]" :class="index === selected && 'font-medium'">{{
persona.name || "unnamed"
}}</span>
<StatusPill v-if="collection.default === persona.name" tone="accent" class="h-5">default</StatusPill>
</span>
<span class="block truncate text-xs text-fg-subtle">{{ persona.prompt || "No prompt yet" }}</span>
</button>
</li>
</ul>
</div>
<section v-if="current" class="min-w-0 rounded-lg border border-border bg-card px-5 pt-4 pb-2" aria-label="Persona">
<header class="flex items-center gap-2">
<h2 class="min-w-0 flex-1 truncate font-mono text-[15px] font-medium">{{ current.name || "unnamed" }}</h2>
<Button variant="ghost" size="sm" @click="duplicate"><Copy data-icon="inline-start" /> Duplicate</Button>
<Button
variant="ghost"
size="sm"
class="text-danger"
:disabled="collection.personas.length <= 1"
@click="remove"
><Trash2 data-icon="inline-start" /> Delete</Button
>
</header>
<SettingRow label="Name" for="persona-name" hint="How chat refers to it.">
<Input id="persona-name" :model-value="current.name" class="max-w-sm font-mono" @update:model-value="rename" />
</SettingRow>
<SettingRow label="Default persona" hint="Used when a chat does not pick one. Exactly one is the default.">
<Switch
:model-value="isDefault"
:disabled="isDefault"
aria-label="Default persona"
@update:model-value="(on: boolean) => on && (collection!.default = current!.name)"
/>
</SettingRow>
<div class="border-t border-border py-4">
<label for="persona-prompt" class="text-[13px] font-medium">System prompt</label>
<Textarea id="persona-prompt" v-model="current.prompt" :rows="12" class="mt-2 font-mono text-[13px]" />
<p class="mt-1.5 text-xs text-fg-subtle">{{ chars.toLocaleString() }} chars · ~{{ Math.round(chars / 4).toLocaleString() }} tokens</p>
</div>
</section>
</div>
</div>
</template>
+148
View File
@@ -0,0 +1,148 @@
<script setup lang="ts">
import { computed, onMounted } from "vue";
import { storeToRefs } from "pinia";
import { CalendarClock, Plus, Trash2 } from "@lucide/vue";
import PageHeader from "@/base/PageHeader.vue";
import { Button } from "@/components/ui/button";
import { DurationInput } from "@/components/ui/duration-input";
import { Input } from "@/components/ui/input";
import { SegmentedControl } from "@/components/ui/segmented-control";
import { SettingRow } from "@/components/ui/setting-row";
import { Textarea } from "@/components/ui/textarea";
import { resourcesForPage, useControlPlaneStore } from "@/stores/control-plane";
import HistoryLink from "./HistoryLink.vue";
const KIND = "schedules";
/** A scheduled job; only the "workflow" kind is wired, so every job is one. */
interface Job {
id: string;
kind: string;
detail?: string;
pool?: string;
schedule: { kind?: string; interval?: string; cron?: string; at?: string };
target: Record<string, unknown>;
payload: { text?: string };
next_run?: string;
}
const store = useControlPlaneStore();
const { catalog, catalogError } = storeToRefs(store);
onMounted(store.load);
const resources = computed(() => resourcesForPage(catalog.value, "schedules"));
const jobs = computed(() => store.drafts[KIND]?.value as Job[] | undefined);
const error = computed(() => store.stateFor(KIND).error);
const whenKinds = [
{ value: "interval", label: "Every" },
{ value: "cron", label: "Cron" },
{ value: "once", label: "Once" },
];
const pools = [
{ value: "", label: "Sequential" },
{ value: "parallel", label: "Parallel" },
];
function add() {
jobs.value?.push({
id: "",
kind: "workflow",
detail: "",
pool: "",
schedule: { kind: "interval", interval: "24h0m0s" },
target: {},
payload: { text: "" },
});
}
// datetime-local speaks local wall time without a zone; the document stores
// an RFC 3339 instant.
function toLocalInput(iso?: string): string {
if (!iso) return "";
const d = new Date(iso);
const pad = (n: number) => String(n).padStart(2, "0");
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}`;
}
function fromLocalInput(value: string): string | undefined {
return value ? new Date(value).toISOString() : undefined;
}
const whenKind = (job: Job) => job.schedule.kind || "interval";
</script>
<template>
<div>
<PageHeader title="Schedules">
<HistoryLink :kinds="resources.map((r) => r.kind)" />
<Button v-if="jobs?.length" size="sm" @click="add"><Plus data-icon="inline-start" /> Add schedule</Button>
</PageHeader>
<p class="-mt-4 mb-8 text-sm text-fg-muted">Work Archie starts on its own, on a timetable.</p>
<p v-if="catalogError || error" class="mb-4 text-sm text-danger" role="alert">
{{ catalogError || error }}
</p>
<template v-if="jobs">
<div v-if="!jobs.length" class="flex flex-col items-center rounded-lg border border-border bg-card px-6 py-12 text-center">
<span class="mb-3 grid size-10 place-items-center rounded-md bg-secondary text-muted-foreground">
<CalendarClock class="size-5" aria-hidden="true" />
</span>
<p class="font-medium">No schedules yet</p>
<p class="mt-1 mb-4 text-sm text-fg-muted">A schedule starts a task on an interval, a cron line, or once.</p>
<Button size="sm" @click="add"><Plus data-icon="inline-start" /> Add schedule</Button>
</div>
<section
v-for="(job, i) in jobs"
:key="i"
class="mb-4 rounded-lg border border-border bg-card px-5 pt-4 pb-2"
:aria-label="job.detail || job.id || 'New schedule'"
>
<header class="flex items-center gap-2">
<h2 class="min-w-0 flex-1 truncate text-[15px] font-medium">{{ job.detail || job.id || "New schedule" }}</h2>
<span v-if="job.next_run" class="text-xs text-fg-subtle">Next run {{ new Date(job.next_run).toLocaleString() }}</span>
<Button variant="ghost" size="icon" aria-label="Delete schedule" @click="jobs.splice(i, 1)"><Trash2 /></Button>
</header>
<SettingRow label="ID" :for="`job-${i}-id`" hint="Unique. Runs are recorded against it.">
<Input :id="`job-${i}-id`" v-model="job.id" class="max-w-sm font-mono" :aria-invalid="!job.id.trim() || undefined" />
</SettingRow>
<SettingRow label="Task title" :for="`job-${i}-title`" hint="The title of each task it starts. Empty uses the ID.">
<Input :id="`job-${i}-title`" v-model="job.detail" class="max-w-md" />
</SettingRow>
<SettingRow label="Instructions" :for="`job-${i}-text`" hint="What the task is asked to do.">
<Textarea :id="`job-${i}-text`" v-model="job.payload.text" :rows="3" />
</SettingRow>
<SettingRow label="When" hint="An interval, a five-field cron line, or a single time.">
<div class="flex flex-wrap items-center gap-3">
<SegmentedControl
:model-value="whenKind(job)"
label="When"
:options="whenKinds"
@update:model-value="(k: string) => (job.schedule = { kind: k, interval: k === 'interval' ? '24h0m0s' : undefined })"
/>
<DurationInput v-if="whenKind(job) === 'interval'" v-model="job.schedule.interval!" :units="['m', 'h']" />
<Input
v-else-if="whenKind(job) === 'cron'"
v-model="job.schedule.cron"
class="w-48 font-mono"
placeholder="0 9 * * 1-5"
aria-label="Cron expression"
/>
<Input
v-else
type="datetime-local"
class="w-60 font-mono"
aria-label="Run at"
:model-value="toLocalInput(job.schedule.at)"
@update:model-value="(v) => (job.schedule.at = fromLocalInput(String(v)))"
/>
</div>
</SettingRow>
<SettingRow label="Overlap" hint="Sequential waits for the previous run to finish.">
<SegmentedControl :model-value="job.pool ?? ''" label="Overlap" :options="pools" @update:model-value="(p: string) => (job.pool = p)" />
</SettingRow>
</section>
</template>
</div>
</template>
+34
View File
@@ -0,0 +1,34 @@
/** The personas resource document. */
export interface PersonaCollection {
default: string;
personas: { name: string; prompt: string }[];
}
// The collection must always name a default that exists (the server refuses
// one that does not), so every edit that touches a name keeps it valid.
export function renamePersona(c: PersonaCollection, index: number, name: string): void {
const persona = c.personas[index];
if (!persona) return;
if (c.default === persona.name) c.default = name;
persona.name = name;
}
/** removePersona deletes one persona; the last one cannot go. */
export function removePersona(c: PersonaCollection, index: number): boolean {
if (c.personas.length <= 1 || !c.personas[index]) return false;
const [removed] = c.personas.splice(index, 1);
if (removed!.name === c.default) c.default = c.personas[0]!.name;
return true;
}
/** duplicatePersona copies one persona under a free name and returns its index. */
export function duplicatePersona(c: PersonaCollection, index: number): number {
const source = c.personas[index];
if (!source) return -1;
const taken = new Set(c.personas.map((p) => p.name));
let name = `${source.name}-copy`;
for (let n = 2; taken.has(name); n++) name = `${source.name}-copy-${n}`;
c.personas.splice(index + 1, 0, { name, prompt: source.prompt });
return index + 1;
}
+4 -2
View File
@@ -165,6 +165,8 @@ export type ControlPlanePage =
| "channels"
| "scheduling"
| "tools"
| "personas"
| "schedules"
| "advanced"
| "workflows";
@@ -175,9 +177,9 @@ const PAGE_RESOURCES: Record<ControlPlanePage, string[]> = {
channels: ["channel-settings"],
scheduling: ["scheduling-policy"],
tools: ["tool-settings"],
personas: ["personas"],
schedules: ["schedules"],
advanced: [
"personas",
"schedules",
"plugin-settings",
"container-runtime-policies",
],