diff --git a/api/openapi.yaml b/api/openapi.yaml index cc22169c2..fd545cc5c 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -3242,12 +3242,24 @@ components: properties: advisory: type: boolean + built_in: + type: boolean digest: type: string + enabled: + type: boolean + error: + type: string + installation_id: + type: string latest: $ref: "#/components/schemas/JudgementJudgeStanding" name: type: string + package: + type: string + scope: + type: string settings: additionalProperties: type: string @@ -3258,11 +3270,14 @@ components: type: - array - "null" + state: + type: string version: type: string required: - name - advisory + - enabled - settings - settings_schema type: object @@ -4773,6 +4788,12 @@ components: $ref: "#/components/schemas/SystemFailure" runner: $ref: "#/components/schemas/SystemRunner" + setup: + items: + $ref: "#/components/schemas/SystemSetupStep" + type: + - array + - "null" version: type: string waiting: @@ -4804,6 +4825,21 @@ components: - healthy - workers type: object + SystemSetupStep: + additionalProperties: false + properties: + detail: + type: string + done: + type: boolean + path: + type: string + title: + type: string + required: + - title + - done + type: object SystemWaiting: additionalProperties: false properties: diff --git a/internal/app/archie/health.go b/internal/app/archie/health.go index 5c807c02a..af731e754 100644 --- a/internal/app/archie/health.go +++ b/internal/app/archie/health.go @@ -8,6 +8,8 @@ import ( "github.com/samcharles93/archie-core/internal/platform/health" "github.com/samcharles93/archie-core/modules/approvals" "github.com/samcharles93/archie-core/modules/connectors" + "github.com/samcharles93/archie-core/modules/events" + "github.com/samcharles93/archie-core/modules/governance" "github.com/samcharles93/archie-core/modules/runs" "github.com/samcharles93/archie-core/modules/system" ) @@ -15,7 +17,7 @@ import ( // healthSources joins what each module knows about itself into the sources the // system health report reads. The report asks them on demand, so nothing here // polls or keeps state. -func healthSources(checks *health.Registry, conns *connectors.Module, engine *runs.Engine, allow *approvals.Module) system.Sources { +func healthSources(checks *health.Registry, conns *connectors.Module, engine *runs.Engine, allow *approvals.Module, settings *governance.Module, hear *events.Module) system.Sources { return system.Sources{ Checks: func(ctx context.Context) []health.Result { return slices.DeleteFunc(checks.Results(ctx), func(r health.Result) bool { @@ -39,5 +41,23 @@ func healthSources(checks *health.Registry, conns *connectors.Module, engine *ru LastFailedRun: func(ctx context.Context) (*runs.RunView, error) { return engine.LastFailed(ctx, orgID) }, + Setup: func(ctx context.Context) []system.SetupStep { + _, modelErr := settings.AgentModel(ctx) + sources, srcErr := hear.SourceCount(ctx) + return []system.SetupStep{ + { + Title: "Set an agent model", + Detail: "Configure a model provider and assign the agent role so workflows and chat can run.", + Done: modelErr == nil, + Path: "/settings/models", + }, + { + Title: "Add an event source", + Detail: "Connect a webhook or polling source to start receiving events.", + Done: srcErr == nil && sources > 0, + Path: "/events?tab=sources", + }, + } + }, } } diff --git a/internal/app/archie/run.go b/internal/app/archie/run.go index 063fe609c..fdb4c7aef 100644 --- a/internal/app/archie/run.go +++ b/internal/app/archie/run.go @@ -219,7 +219,7 @@ func wire(log *slog.Logger, configPath string, cfg Config, db *sqlx.DB) (*binary remember.UseProposals(proposed) // Approving an action that can't be undone needs a fresh passkey assertion. proposed.UseConfirmer(settings) - sys.UseHealth(healthSources(checks, conns, engine, allow)) + sys.UseHealth(healthSources(checks, conns, engine, allow, settings, hear)) apiModules{ settings: settings, conns: conns, system: sys, tell: tell, allow: allow, actionTypes: actionTypes, policies: policies, hear: hear, judge: judge, engine: engine, chat: talk, proposals: proposed, diff --git a/modules/connectors/list.go b/modules/connectors/list.go index d367cc130..08159f049 100644 --- a/modules/connectors/list.go +++ b/modules/connectors/list.go @@ -84,8 +84,25 @@ func (m *Module) list(contract string) func(context.Context, *struct{}) (*httpap } } +// GuardInstallations lists every guard installation the caller can see, +// running, disabled, or failed. +func (m *Module) GuardInstallations(ctx context.Context) ([]ExtensionView, error) { + if m.store == nil { + return nil, nil + } + return m.viewsFor(ctx, func(a store.Installed) bool { return a.Contract == store.ContractGuard }) +} + // listViews returns the installations the caller can see that keep accepts. func (m *Module) listViews(ctx context.Context, keep func(store.Installed) bool) (*httpapi.Reply[[]ExtensionView], error) { + views, err := m.viewsFor(ctx, keep) + if err != nil { + return nil, err + } + return httpapi.OK(views), nil +} + +func (m *Module) viewsFor(ctx context.Context, keep func(store.Installed) bool) ([]ExtensionView, error) { auth, err := authorityOf(ctx) if err != nil { return nil, err @@ -116,7 +133,7 @@ func (m *Module) listViews(ctx context.Context, keep func(store.Installed) bool) } views = append(views, view) } - return httpapi.OK(views), nil + return views, nil } // viewOf shows an installation. A caller who may not change it sees what it is diff --git a/modules/events/events.go b/modules/events/events.go index 2d41e0bbf..0c30554d5 100644 --- a/modules/events/events.go +++ b/modules/events/events.go @@ -436,6 +436,15 @@ func (m *Module) Work(ctx context.Context) { } } +// SourceCount reports how many event sources exist for the organisation. +func (m *Module) SourceCount(ctx context.Context) (int, error) { + sources, err := m.store.Sources(ctx, m.orgID) + if err != nil { + return 0, err + } + return len(sources), nil +} + // startListeners starts one listener for each source whose connector listens // and has none yet. A listener lives until ctx ends. func (m *Module) startListeners(ctx context.Context, wg *sync.WaitGroup, listening map[uuid.UUID]bool) { diff --git a/modules/judgement/judges.go b/modules/judgement/judges.go index 5f50321b7..e08608ced 100644 --- a/modules/judgement/judges.go +++ b/modules/judgement/judges.go @@ -17,19 +17,30 @@ import ( // guard's last recorded standing. const judgeScanLimit = 200 -// JudgeControl is one running guard as the Controls page shows the judge it -// asks: what it was configured with, and the last standing a model judge -// recorded. +// JudgeControl is one guard as the Controls page shows it: built-in guards and +// every guard extension installation (running, disabled, or failed), with its +// configuration and the last model judgement recorded for it. type JudgeControl struct { Name string `json:"name"` + InstallationID string `json:"installation_id,omitempty"` + Package string `json:"package,omitempty"` + Scope string `json:"scope,omitempty"` + BuiltIn bool `json:"built_in,omitempty"` Version string `json:"version,omitempty"` Digest string `json:"digest,omitempty"` Advisory bool `json:"advisory"` + Enabled bool `json:"enabled"` + State string `json:"state,omitempty"` + Error string `json:"error,omitempty"` Settings map[string]string `json:"settings"` SettingsSchema []connectors.Setting `json:"settings_schema"` Latest *JudgeStanding `json:"latest,omitempty"` } +type guardInstallationLister interface { + GuardInstallations(ctx context.Context) ([]connectors.ExtensionView, error) +} + // JudgeStanding is the last model judgement a guard recorded: what the judge // answered, whether its eval counts it, and the date that eval is from. type JudgeStanding struct { @@ -41,25 +52,93 @@ type JudgeStanding struct { At time.Time `json:"at"` } -// Judges returns each running guard with its judge configuration and the last -// model judgement recorded for it. +// Judges returns each built-in guard and every guard extension installation with +// its configuration and the last model judgement recorded for it. func (m *Module) Judges(ctx context.Context) ([]JudgeControl, error) { - if m.extensions == nil { - return []JudgeControl{}, nil - } - guards := m.extensions.Guards(ctx) - out := make([]JudgeControl, 0, len(guards)) - for _, g := range guards { - control := JudgeControl{ - Name: g.Name(), Version: g.Version(), Digest: g.Digest(), Advisory: g.Advisory(), - Settings: g.Settings(), SettingsSchema: g.SettingsSchema(), - } + out := make([]JudgeControl, 0, len(m.guards)) + for _, g := range m.guards { latest, err := m.latestJudge(ctx, g.Name()) if err != nil { return nil, err } - control.Latest = latest - out = append(out, control) + out = append(out, JudgeControl{ + Name: g.Name(), + BuiltIn: true, + Advisory: g.Advisory(), + Enabled: true, + State: "running", + Settings: map[string]string{}, + Latest: latest, + }) + } + if m.extensions == nil { + return out, nil + } + ext, err := m.extensionJudges(ctx) + if err != nil { + return nil, err + } + return append(out, ext...), nil +} + +func (m *Module) extensionJudges(ctx context.Context) ([]JudgeControl, error) { + running := map[string]*connectors.Guard{} + for _, g := range m.extensions.Guards(ctx) { + running[g.Name()] = g + } + if lister, ok := m.extensions.(guardInstallationLister); ok { + views, err := lister.GuardInstallations(ctx) + if err == nil && views != nil { + return m.viewsToJudges(ctx, views, running) + } + } + out := make([]JudgeControl, 0, len(running)) + for _, g := range running { + latest, err := m.latestJudge(ctx, g.Name()) + if err != nil { + return nil, err + } + out = append(out, JudgeControl{ + Name: g.Name(), + Version: g.Version(), + Digest: g.Digest(), + Advisory: g.Advisory(), + Enabled: true, + State: "running", + Settings: g.Settings(), + SettingsSchema: g.SettingsSchema(), + Latest: latest, + }) + } + return out, nil +} + +func (m *Module) viewsToJudges(ctx context.Context, views []connectors.ExtensionView, running map[string]*connectors.Guard) ([]JudgeControl, error) { + out := make([]JudgeControl, 0, len(views)) + for _, v := range views { + advisory := false + if g := running[v.Name]; g != nil { + advisory = g.Advisory() + } + latest, err := m.latestJudge(ctx, v.Name) + if err != nil { + return nil, err + } + out = append(out, JudgeControl{ + Name: v.Name, + InstallationID: v.ID.String(), + Package: v.Package, + Scope: v.Scope, + Version: v.Version, + Digest: v.Digest, + Advisory: advisory, + Enabled: v.Enabled, + State: v.State, + Error: v.Error, + Settings: v.Settings, + SettingsSchema: v.SettingsSchema, + Latest: latest, + }) } return out, nil } diff --git a/modules/system/health.go b/modules/system/health.go index d3bb53fbc..275541835 100644 --- a/modules/system/health.go +++ b/modules/system/health.go @@ -33,6 +33,16 @@ type Sources struct { Waiting func(context.Context) (Waiting, error) // LastFailedRun is the most recent run that failed; nil when none has. LastFailedRun func(context.Context) (*runs.RunView, error) + // Setup reports what the instance still needs before workflows and chat can run. + Setup func(context.Context) []SetupStep +} + +// SetupStep is one readiness item on the Home dashboard. +type SetupStep struct { + Title string `json:"title"` + Detail string `json:"detail,omitzero"` + Done bool `json:"done"` + Path string `json:"path,omitzero"` } // UseHealth sets where the health report reads from. @@ -80,8 +90,9 @@ type Health struct { Connectors []connectors.Health `json:"connectors"` Runner Runner `json:"runner"` // Waiting is absent when it could not be read; that is a failed check. - Waiting *Waiting `json:"waiting,omitzero"` - LastFailure *Failure `json:"last_failure,omitzero"` + Waiting *Waiting `json:"waiting,omitzero"` + LastFailure *Failure `json:"last_failure,omitzero"` + Setup []SetupStep `json:"setup,omitzero"` } func (m *Module) registerHealth(api huma.API) { @@ -133,6 +144,9 @@ func (m *Module) getHealth(ctx context.Context, _ *struct{}) (*httpapi.Reply[Hea } h.Healthy = healthy(h) h.LastFailure = lastFailure(h, lastRun) + if src.Setup != nil { + h.Setup = src.Setup(ctx) + } return httpapi.OK(h), nil } diff --git a/ui/pages/pages.json b/ui/pages/pages.json index c1b950a48..10391afda 100644 --- a/ui/pages/pages.json +++ b/ui/pages/pages.json @@ -46,12 +46,12 @@ }, { "path": "/memory", - "label": "Memory", + "label": "Personal memory", "description": "What Archie remembers for you, and the notes shared with the organisation." }, { "path": "/settings/memory", - "label": "Memory", + "label": "Shared memory", "description": "Notes shared with everyone, the proposals waiting for review, and their published versions." }, { diff --git a/ui/src/App.vue b/ui/src/App.vue index f59deffb3..566bbc399 100644 --- a/ui/src/App.vue +++ b/ui/src/App.vue @@ -12,6 +12,7 @@ import CommandPalette from "@/components/command-palette/CommandPalette.vue"; import AccountMenu from "@/components/topbar/AccountMenu.vue"; import OrgCrumb from "@/components/topbar/OrgCrumb.vue"; import ChatTopbarButton from "@/chat/ChatTopbarButton.vue"; +import AppSidebar from "@/components/AppSidebar.vue"; import SectionCrumb from "@/components/topbar/SectionCrumb.vue"; import Brand from "@/components/topbar/Brand.vue"; import Logo from "@/components/topbar/Logo.vue"; @@ -53,8 +54,8 @@ watch([() => route.path, hidden], () => { if (!routerReady.value) return; if (!hidden.value.includes(typeof route.meta.navPath === "string" ? route.meta.navPath : route.path)) return; // Home may be hidden too, so land on the first destination that is served. - const first = navTree(hidden.value).find((node) => node.kind === "link"); - void router.replace(first?.kind === "link" ? first.entry.path : "/account"); + const first = navTree(hidden.value).flatMap((node) => (node.kind === "link" ? [node.entry] : node.items))[0]; + void router.replace(first ? first.path : "/account"); }); watch(() => [route.path, accounts.instance], () => { const scope = route.meta.org ? "Organisation" : route.meta.settings ? "Instance" : ""; @@ -111,6 +112,7 @@ watch(() => accounts.status?.user, (user) => { Skip to main content +
diff --git a/ui/src/alerts/AlertsBell.vue b/ui/src/alerts/AlertsBell.vue index 47fce8c6f..f6118bdcc 100644 --- a/ui/src/alerts/AlertsBell.vue +++ b/ui/src/alerts/AlertsBell.vue @@ -43,8 +43,8 @@ function failedDeliveries(alert: OperatorAlert): number { - {{ errors.alerts.load }} {{ dismissError }} + {{ errors.alerts.load }}

Loading alerts…

No alerts
diff --git a/ui/src/captures/CapturesPage.vue b/ui/src/captures/CapturesPage.vue index b46d03412..1ff7fbea3 100644 --- a/ui/src/captures/CapturesPage.vue +++ b/ui/src/captures/CapturesPage.vue @@ -72,7 +72,8 @@ onMounted(async () => { // for the list; an id it no longer holds falls back to the newest capture, // which is what a page opened with nothing named starts on too. const named = String(route.query.capture ?? ""); - if (!named || !selectById(named)) selectNewest(); + if (named && selectById(named)) return; + if (route.query.tab === "inspector") selectNewest(); }); onBeforeUnmount(() => { @@ -82,6 +83,7 @@ onBeforeUnmount(() => { watch(stacked, measure); watch(selected, (capture) => { + if (route.query.tab !== "inspector") return; const query = { ...route.query }; if (capture) query.capture = String(capture.id); else delete query.capture; diff --git a/ui/src/chat/ChatTranscript.vue b/ui/src/chat/ChatTranscript.vue index fa716a885..691f6d5b3 100644 --- a/ui/src/chat/ChatTranscript.vue +++ b/ui/src/chat/ChatTranscript.vue @@ -100,13 +100,20 @@ const rows = computed(() => { :error="row.error" > - +
+ + +
diff --git a/ui/src/components/AppSidebar.vue b/ui/src/components/AppSidebar.vue new file mode 100644 index 000000000..f38d1e0fc --- /dev/null +++ b/ui/src/components/AppSidebar.vue @@ -0,0 +1,88 @@ + + + diff --git a/ui/src/components/command-palette/CommandPalette.vue b/ui/src/components/command-palette/CommandPalette.vue index 3bbab2383..ddb979515 100644 --- a/ui/src/components/command-palette/CommandPalette.vue +++ b/ui/src/components/command-palette/CommandPalette.vue @@ -17,6 +17,7 @@ import { api } from "@/lib/api"; import { errors } from "@/copy/errors"; import { navEntries } from "@/lib/nav"; import { statusLabel } from "@/lib/task-meta"; +import { useSessionStore } from "@/stores/session"; /** * Jump to a page, a task or a workflow by name. Opened from the top bar, with @@ -45,8 +46,10 @@ const pages = computed(() => navEntries(props.hidden)); const tasks = ref([]); const workflows = ref<{ id: string; name: string }[]>([]); const shortcut = navigator.platform.startsWith("Mac") ? "⌘K" : "Ctrl K"; +const session = useSessionStore(); const showWorkflows = computed(() => !props.hidden.includes("/workflows")); const showTasks = computed(() => !props.hidden.includes("/tasks")); +const showNewTask = computed(() => session.sections?.work_requests !== false); // A failed read shows as an error item with Retry in that group, not as a // missing group: the pages still work either way. @@ -107,7 +110,7 @@ onUnmounted(() => document.removeEventListener("keydown", onGlobalKeydown)); No matches. - + New task diff --git a/ui/src/components/topbar/SectionCrumb.vue b/ui/src/components/topbar/SectionCrumb.vue index 5759c9aa0..73510882f 100644 --- a/ui/src/components/topbar/SectionCrumb.vue +++ b/ui/src/components/topbar/SectionCrumb.vue @@ -27,7 +27,7 @@ const { summary } = storeToRefs(store); // The attention count has to stay current on every page, not only the dashboard. useLiveResource("tasks", () => void store.load(), 5000); const links = computed(() => - navTree(props.hidden).flatMap((node): NavEntry[] => (node.kind === "link" ? [node.entry] : [])), + navTree(props.hidden).flatMap((node): NavEntry[] => (node.kind === "link" ? [node.entry] : node.items)), ); // Detail routes carry the primary destination they belong to in meta.navPath. const activePath = computed(() => (typeof route.meta.navPath === "string" ? route.meta.navPath : activeNavPath(route.path))); diff --git a/ui/src/controls/ControlsPage.vue b/ui/src/controls/ControlsPage.vue index 0407e97a9..effbedd28 100644 --- a/ui/src/controls/ControlsPage.vue +++ b/ui/src/controls/ControlsPage.vue @@ -4,6 +4,7 @@ import { RouterLink, useRoute, useRouter } from "vue-router"; import PageHeader from "@/base/PageHeader.vue"; import { Badge } from "@/components/ui/badge"; +import { Button } from "@/components/ui/button"; import { DataTable, type DataTableColumn } from "@/components/ui/data-table"; import { DropdownMenuItem } from "@/components/ui/dropdown-menu"; import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty"; @@ -41,7 +42,8 @@ const show = (id: unknown) => void router.replace({ query: { ...route.query, tab const judgeColumns: DataTableColumn[] = [ { id: "name", label: "Guard", fixed: true, width: "auto", sort: (j) => j.name }, { id: "mode", label: "Mode", fixed: true, width: "8rem" }, - { id: "latest", label: "Last evaluation", hide: "md", width: "28rem" }, + { id: "status", label: "Status", hide: "sm", width: "8rem" }, + { id: "latest", label: "Last evaluation", hide: "md", width: "24rem" }, ]; const actionTypeColumns: DataTableColumn[] = [ { id: "action", label: "Action", fixed: true, width: "auto", sort: (c) => `${c.connector}.${c.action}` }, @@ -79,20 +81,43 @@ async function reset(c: ActionType): Promise {
- - + + + + -

Manage guards

+
+ Manage guards + Browse guard extensions +
diff --git a/ui/src/dashboard/DashboardPage.vue b/ui/src/dashboard/DashboardPage.vue index 415762e7b..81c680ba1 100644 --- a/ui/src/dashboard/DashboardPage.vue +++ b/ui/src/dashboard/DashboardPage.vue @@ -4,6 +4,7 @@ import { useSystemHealth } from "@/lib/system-health"; import HealthCard from "./HealthCard.vue"; import NeedsAttentionCard from "./NeedsAttentionCard.vue"; import RecentRunsCard from "./RecentRunsCard.vue"; +import SetupPanel from "./SetupPanel.vue"; /** What is wrong, what waits on you, then what ran. */ const { data: health, error, reload } = useSystemHealth(); @@ -13,6 +14,7 @@ const { data: health, error, reload } = useSystemHealth();

Home

+
diff --git a/ui/src/dashboard/HealthCard.vue b/ui/src/dashboard/HealthCard.vue index aee277eed..c338aa973 100644 --- a/ui/src/dashboard/HealthCard.vue +++ b/ui/src/dashboard/HealthCard.vue @@ -33,6 +33,7 @@ const problems = computed(() => { ...(h.runner.healthy ? [] : [{ key: "runner", label: "runner", cause: h.runner.error ?? "", at: h.runner.error_at }]), ]; }); +const setupIncomplete = computed(() => (props.health?.setup ?? []).some((step) => !step.done));