feat(ui,judgement,system): unify nav, surface built-in guards, readiness and decision reasoning
This commit is contained in:
34 files changed
+548
-103
No files matched your search
@@ -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:
|
||||
|
||||
@@ -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",
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+96
-17
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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."
|
||||
},
|
||||
{
|
||||
|
||||
+4
-2
@@ -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) => {
|
||||
<TooltipProvider v-else :delay-duration="350">
|
||||
<SidebarProvider class="bg-[var(--workspace)]">
|
||||
<a href="#main-content" class="sr-only focus:not-sr-only focus:fixed focus:top-2 focus:left-4 focus:z-[60] focus:rounded-md focus:bg-card focus:px-3 focus:py-2">Skip to main content</a>
|
||||
<AppSidebar :hidden="hidden" />
|
||||
<SidebarInset class="min-w-0 bg-[var(--workspace)] md:ml-[var(--chat-pin-l,0px)] md:mr-[var(--chat-pin-r,0px)]" :class="workflowsPage && 'max-md:h-dvh'">
|
||||
<header class="bg-card border-border-strong sticky top-0 z-30 flex h-14 shrink-0 items-center gap-2 border-b px-3 shadow-[var(--shadow-sm)] sm:px-4">
|
||||
<Brand />
|
||||
|
||||
@@ -43,8 +43,8 @@ function failedDeliveries(alert: OperatorAlert): number {
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent align="end" :collision-padding="8" class="w-[calc(100vw-1rem)] max-w-none p-0 sm:w-96">
|
||||
<Alert v-if="failed" variant="destructive" class="px-3 py-6 text-center"><AlertDescription>{{ errors.alerts.load }}</AlertDescription></Alert>
|
||||
<Alert v-if="dismissError" variant="destructive" class="px-3 py-2"><AlertDescription>{{ dismissError }}</AlertDescription></Alert>
|
||||
<Alert v-if="failed" variant="destructive" class="px-3 py-6 text-center"><AlertDescription>{{ errors.alerts.load }}</AlertDescription></Alert>
|
||||
<p v-else-if="!loaded" class="px-3 py-6 text-center text-label text-fg-muted" role="status">Loading alerts…</p>
|
||||
<Empty v-else-if="!groups.length" class="border-0"><EmptyHeader><EmptyTitle>No alerts</EmptyTitle></EmptyHeader></Empty>
|
||||
<div v-else class="relative max-h-[calc(100dvh-6rem)] overflow-y-auto">
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -100,13 +100,20 @@ const rows = computed(() => {
|
||||
:error="row.error"
|
||||
>
|
||||
<ChatAskCard v-for="ask in row.approvals" :key="ask.id" :ask="ask" />
|
||||
<Button
|
||||
v-if="row.live && streamingTurn?.isError && streamingTurn.retryText"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
class="mt-2"
|
||||
@click="sendMessage({ retry: streamingTurn.retryText })"
|
||||
>Retry</Button>
|
||||
<div v-if="row.live && streamingTurn?.isError" class="mt-2 flex flex-wrap items-center gap-2">
|
||||
<Button
|
||||
v-if="streamingTurn.retryText"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
@click="sendMessage({ retry: streamingTurn.retryText })"
|
||||
>Retry</Button>
|
||||
<Button
|
||||
v-if="row.error && /agent model/i.test(row.text)"
|
||||
as-child
|
||||
variant="outline"
|
||||
size="sm"
|
||||
><RouterLink to="/settings/models">Configure model</RouterLink></Button>
|
||||
</div>
|
||||
</ChatBubble>
|
||||
</MessageScrollerItem>
|
||||
</template>
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
import { PanelLeftClose, PanelLeftOpen } from "@lucide/vue";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
import { useSidebar } from "@/components/ui/sidebar/utils";
|
||||
import { activeNavPath, navTree } from "@/lib/nav";
|
||||
import { navIcons } from "@/lib/nav-icons";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = defineProps<{ hidden: string[] }>();
|
||||
|
||||
const route = useRoute();
|
||||
const { open, toggleSidebar, isMobile } = useSidebar();
|
||||
|
||||
const nodes = computed(() => navTree(props.hidden));
|
||||
const activePath = computed(() =>
|
||||
typeof route.meta.navPath === "string" ? route.meta.navPath : activeNavPath(route.path),
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<aside
|
||||
v-if="!isMobile"
|
||||
aria-label="Primary navigation"
|
||||
:class="
|
||||
cn(
|
||||
'sticky top-0 flex h-dvh shrink-0 flex-col border-r border-border bg-card transition-[width] duration-150',
|
||||
open ? 'w-56' : 'w-14',
|
||||
)
|
||||
"
|
||||
>
|
||||
<div class="flex h-14 items-center border-b border-border px-2.5" :class="open ? 'justify-between' : 'justify-center'">
|
||||
<span v-if="open" class="px-1.5 text-caption font-semibold tracking-[0.06em] text-fg-subtle uppercase">Navigation</span>
|
||||
<Tooltip>
|
||||
<TooltipTrigger as-child>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
:aria-label="open ? 'Collapse navigation' : 'Expand navigation'"
|
||||
:aria-expanded="open"
|
||||
@click="toggleSidebar"
|
||||
>
|
||||
<PanelLeftClose v-if="open" class="size-4" aria-hidden="true" />
|
||||
<PanelLeftOpen v-else class="size-4" aria-hidden="true" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="right">{{ open ? "Collapse navigation (⌘B)" : "Expand navigation (⌘B)" }}</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
<nav class="flex-1 overflow-y-auto px-2 py-3">
|
||||
<div v-for="node in nodes" :key="node.kind === 'link' ? node.entry.path : node.label" class="mb-4 last:mb-0">
|
||||
<template v-if="node.kind === 'group'">
|
||||
<p v-if="open" class="mb-1 px-2.5 text-caption font-medium tracking-[0.06em] text-fg-subtle uppercase">
|
||||
{{ node.label }}
|
||||
</p>
|
||||
<ul class="flex flex-col gap-0.5">
|
||||
<li v-for="entry in node.items" :key="entry.path">
|
||||
<Tooltip :disabled="open">
|
||||
<TooltipTrigger as-child>
|
||||
<RouterLink
|
||||
:to="entry.path"
|
||||
:aria-current="entry.path === activePath ? 'page' : undefined"
|
||||
:aria-label="open ? undefined : entry.label"
|
||||
:class="
|
||||
cn(
|
||||
'flex h-8 items-center gap-2.5 rounded-md px-2.5 text-label transition-colors hover:bg-secondary hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring',
|
||||
!open && 'justify-center px-0',
|
||||
entry.path === activePath && 'bg-secondary font-medium text-foreground',
|
||||
)
|
||||
"
|
||||
>
|
||||
<component :is="navIcons[entry.path]" v-if="navIcons[entry.path]" class="size-4 shrink-0" aria-hidden="true" />
|
||||
<span v-if="open" class="truncate">{{ entry.label }}</span>
|
||||
</RouterLink>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="right">{{ entry.label }}</TooltipContent>
|
||||
</Tooltip>
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
</div>
|
||||
</nav>
|
||||
</aside>
|
||||
</template>
|
||||
@@ -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<TaskEntry[]>([]);
|
||||
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));
|
||||
<CommandInput placeholder="Find a page, task or workflow" />
|
||||
<CommandList>
|
||||
<CommandEmpty>No matches.</CommandEmpty>
|
||||
<CommandGroup v-if="showWorkflows" heading="Actions">
|
||||
<CommandGroup v-if="showNewTask" heading="Actions">
|
||||
<CommandItem value="New task" @select="newTask">New task</CommandItem>
|
||||
</CommandGroup>
|
||||
<CommandGroup heading="Views">
|
||||
|
||||
@@ -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)));
|
||||
|
||||
@@ -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<Judge>[] = [
|
||||
{ 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<ActionType>[] = [
|
||||
{ id: "action", label: "Action", fixed: true, width: "auto", sort: (c) => `${c.connector}.${c.action}` },
|
||||
@@ -79,20 +81,43 @@ async function reset(c: ActionType): Promise<void> {
|
||||
<div v-else-if="tab === 'guards'">
|
||||
<ReadError v-if="judges.error.value" :message="judges.error.value" retry-label="Retry" @retry="judges.reload" />
|
||||
<Skeleton v-else-if="!judges.data.value" class="h-16 w-full" />
|
||||
<DataTable v-else :columns="judgeColumns" :rows="judges.data.value" :row-key="(j) => j.name" storage-key="judges">
|
||||
<template #cell-name="{ row }"><span class="font-medium">{{ row.name }}</span> <span class="text-caption text-fg-subtle">{{ row.version }}</span></template>
|
||||
<DataTable v-else :columns="judgeColumns" :rows="judges.data.value" :row-key="(j) => j.installation_id || j.name" storage-key="judges">
|
||||
<template #cell-name="{ row }">
|
||||
<span class="font-medium">{{ row.name }}</span>
|
||||
<Badge v-if="row.built_in" variant="outline" class="ml-1.5">Built-in</Badge>
|
||||
<template v-else>
|
||||
<span v-if="row.version" class="ml-1 text-caption text-fg-subtle">{{ row.version }}</span>
|
||||
<Badge v-if="row.scope" variant="outline" class="ml-1.5">{{ row.scope }}</Badge>
|
||||
</template>
|
||||
</template>
|
||||
<template #cell-mode="{ row }">
|
||||
<Badge :variant="row.advisory ? 'idle' : 'ok'" :title="row.latest?.advisory_reason || undefined">{{ row.advisory ? "Advisory" : "Enforcing" }}</Badge>
|
||||
</template>
|
||||
<template #cell-status="{ row }">
|
||||
<Badge v-if="row.built_in || row.state === 'running'" variant="ok">Running</Badge>
|
||||
<Badge v-else-if="row.state === 'failed' || row.error" variant="danger" :title="row.error || undefined">Failed</Badge>
|
||||
<Badge v-else variant="idle">{{ row.enabled === false ? "Disabled" : row.state || "Stopped" }}</Badge>
|
||||
</template>
|
||||
<template #cell-latest="{ row }">
|
||||
<span v-if="row.latest" class="text-caption">
|
||||
<Timestamp :at="row.latest.at" /><template v-if="row.latest.model"> · {{ row.latest.model }}</template><template v-if="row.latest.answer"> · {{ row.latest.answer }}</template>
|
||||
<Badge v-if="row.latest.trusted === false" variant="warn" class="ml-1">Not trusted</Badge>
|
||||
</span>
|
||||
</template>
|
||||
<template #actions="{ row }">
|
||||
<Button
|
||||
v-if="!row.built_in && row.installation_id"
|
||||
as-child
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
><RouterLink :to="{ path: '/settings/extensions', query: { tab: 'installations', configure: row.installation_id } }">Configure</RouterLink></Button>
|
||||
</template>
|
||||
<template #empty><Empty><EmptyHeader><EmptyTitle>No guards</EmptyTitle></EmptyHeader></Empty></template>
|
||||
</DataTable>
|
||||
<p class="mt-2 text-caption text-fg-muted"><RouterLink class="underline" :to="{ path: '/settings/extensions', query: { kind: 'guards' } }">Manage guards</RouterLink></p>
|
||||
<div class="mt-3 flex flex-wrap gap-4 text-caption text-fg-muted">
|
||||
<RouterLink class="underline" :to="{ path: '/settings/extensions', query: { tab: 'packages', kind: 'guards' } }">Manage guards</RouterLink>
|
||||
<RouterLink class="underline" :to="{ path: '/settings/extensions', query: { tab: 'marketplace', kind: 'guards' } }">Browse guard extensions</RouterLink>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<p v-if="resetError" role="alert" class="mb-2 text-caption text-danger">{{ resetError }}</p>
|
||||
|
||||
@@ -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();
|
||||
<h1 class="sr-only">Home</h1>
|
||||
<div class="mx-auto grid max-w-5xl min-w-0 gap-4">
|
||||
<HealthCard :health="health" :error="error" @retry="reload" />
|
||||
<SetupPanel :setup="health?.setup ? { steps: health.setup } : undefined" />
|
||||
<NeedsAttentionCard />
|
||||
<RecentRunsCard />
|
||||
</div>
|
||||
|
||||
@@ -33,6 +33,7 @@ const problems = computed<Problem[]>(() => {
|
||||
...(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));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -41,7 +42,11 @@ const problems = computed<Problem[]>(() => {
|
||||
<template #action>
|
||||
<Button variant="ghost" size="sm" as-child><RouterLink to="/settings/status">Status</RouterLink></Button>
|
||||
</template>
|
||||
<p v-if="!problems.length" class="flex items-center gap-2 text-label">
|
||||
<p v-if="!problems.length && setupIncomplete" class="flex items-center gap-2 text-label">
|
||||
<StatusDot tone="warn" />Service running · Setup incomplete
|
||||
<span class="font-mono text-caption text-fg-muted">{{ health.version }}</span>
|
||||
</p>
|
||||
<p v-else-if="!problems.length" class="flex items-center gap-2 text-label">
|
||||
<StatusDot tone="ok" />Everything is working
|
||||
<span class="font-mono text-caption text-fg-muted">{{ health.version }}</span>
|
||||
</p>
|
||||
|
||||
@@ -4,10 +4,12 @@ import { Check, Circle } from "@lucide/vue";
|
||||
import { computed, ref, watch } from "vue";
|
||||
|
||||
import { Section } from "@/components/ui/section";
|
||||
import { setupPanelState, type SetupPanelState } from "./setup-preference";
|
||||
import { setupPanelState, type Setup, type SetupPanelState } from "./setup-preference";
|
||||
import { useTasksStore } from "@/stores/tasks";
|
||||
|
||||
const { setup } = storeToRefs(useTasksStore());
|
||||
const props = defineProps<{ setup?: Setup | null }>();
|
||||
const { setup: taskSetup } = storeToRefs(useTasksStore());
|
||||
const activeSetup = computed(() => (props.setup?.steps?.length ? props.setup : taskSetup.value));
|
||||
|
||||
/**
|
||||
* The setup checklist, rendered only while there is setup work left.
|
||||
@@ -16,13 +18,13 @@ const { setup } = storeToRefs(useTasksStore());
|
||||
* the absence of a problem and hold a grid cell. Setup regressing to
|
||||
* incomplete brings the checklist back on its own.
|
||||
*/
|
||||
const panel = ref<SetupPanelState>(setupPanelState(setup.value));
|
||||
const panel = ref<SetupPanelState>(setupPanelState(activeSetup.value));
|
||||
|
||||
watch(setup, () => {
|
||||
panel.value = setupPanelState(setup.value);
|
||||
watch(activeSetup, () => {
|
||||
panel.value = setupPanelState(activeSetup.value);
|
||||
});
|
||||
|
||||
const steps = computed(() => setup.value?.steps ?? []);
|
||||
const steps = computed(() => activeSetup.value?.steps ?? []);
|
||||
const pct = computed(() => {
|
||||
const total = steps.value.length;
|
||||
if (!total) return 0;
|
||||
|
||||
@@ -1,21 +1,54 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted } from "vue";
|
||||
import { RouterLink } from "vue-router";
|
||||
import { computed, onMounted, ref } from "vue";
|
||||
import { RouterLink, useRouter } from "vue-router";
|
||||
|
||||
import CodeView from "@/base/CodeView.vue";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import { ReadError } from "@/components/ui/read-error";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { api } from "@/lib/api";
|
||||
import { errors } from "@/copy/errors";
|
||||
import { api, describeError, type EventGroup } from "@/lib/api";
|
||||
import { emptyValue } from "@/lib/format";
|
||||
import { useRead } from "@/lib/use-read";
|
||||
|
||||
/** One event's payload and the runs it started. */
|
||||
const props = defineProps<{ id: string }>();
|
||||
const router = useRouter();
|
||||
const { data, error, reload } = useRead(() => api.event(props.id));
|
||||
onMounted(reload);
|
||||
const groups = useRead(() => api.eventGroups());
|
||||
onMounted(() => {
|
||||
void reload();
|
||||
void groups.reload();
|
||||
});
|
||||
const body = computed(() => (emptyValue(data.value?.body) ? "" : JSON.stringify(data.value?.body, null, 2)));
|
||||
const started = computed(() => (data.value?.runs ?? []).filter((run) => run.run_id));
|
||||
const blocked = computed(() => (data.value?.runs ?? []).filter((run) => !run.run_id));
|
||||
const matchingGroup = computed<EventGroup | undefined>(() => {
|
||||
const d = data.value;
|
||||
if (!d || d.matched) return undefined;
|
||||
return (groups.data.value ?? []).find(
|
||||
(g) =>
|
||||
g.proposed.declared_event_type === d.declared_event_type &&
|
||||
(!d.source_id || g.proposed.source_id === d.source_id),
|
||||
);
|
||||
});
|
||||
|
||||
const proposing = ref(false);
|
||||
const proposeError = ref("");
|
||||
async function propose(): Promise<void> {
|
||||
if (!matchingGroup.value || proposing.value) return;
|
||||
proposing.value = true;
|
||||
proposeError.value = "";
|
||||
try {
|
||||
const proposal = await api.proposeForGroup(matchingGroup.value.id);
|
||||
await router.push(`/proposals/${proposal.id}`);
|
||||
} catch (cause) {
|
||||
proposeError.value = describeError(cause, errors.common.unknown);
|
||||
} finally {
|
||||
proposing.value = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -26,6 +59,18 @@ const started = computed(() => (data.value?.runs ?? []).filter((run) => run.run_
|
||||
Started
|
||||
<template v-for="(run, i) in started" :key="run.run_id"><template v-if="i">, </template><RouterLink class="underline" :to="`/runs/${run.run_id}`">a run</RouterLink> through {{ run.trigger }}</template>
|
||||
</p>
|
||||
<ul v-if="blocked.length" class="space-y-1 text-caption text-fg-muted">
|
||||
<li v-for="run in blocked" :key="run.trigger_id">
|
||||
Trigger <span class="font-medium">{{ run.trigger }}</span> did not start ({{ run.outcome }})<template v-if="run.reason?.detail">: {{ run.reason.detail }}</template>
|
||||
</li>
|
||||
</ul>
|
||||
<div v-else-if="!started.length && data.matched === false" class="flex flex-wrap items-center gap-2 text-caption text-fg-muted">
|
||||
<span>No triggers matched this event.</span>
|
||||
<Button v-if="matchingGroup" size="xs" variant="outline" :disabled="proposing" @click="propose">
|
||||
{{ proposing ? "Proposing…" : "Propose workflow" }}
|
||||
</Button>
|
||||
</div>
|
||||
<p v-if="proposeError" role="alert" class="text-caption text-danger">{{ proposeError }}</p>
|
||||
<CodeView v-if="body" :code="body" lang="json" />
|
||||
<Empty v-else><EmptyHeader><EmptyTitle>No payload</EmptyTitle></EmptyHeader></Empty>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { Plus } from "@lucide/vue";
|
||||
import { computed, onMounted, ref } from "vue";
|
||||
import { RouterLink } from "vue-router";
|
||||
|
||||
import CodeView from "@/base/CodeView.vue";
|
||||
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@/components/ui/alert-dialog";
|
||||
@@ -214,6 +215,9 @@ const connectorPlaceholder = computed(() => {
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</Field>
|
||||
<p v-if="!connectorNames.length && !connectors.loading.value && !connectors.error.value" class="col-span-2 text-caption text-fg-muted">
|
||||
<RouterLink class="underline" :to="{ path: '/settings/extensions', query: { tab: 'marketplace', kind: 'connectors' } }">Install a connector</RouterLink> first, then return here to add your source.
|
||||
</p>
|
||||
<Field>
|
||||
<FieldLabel for="source-verification">Verification</FieldLabel>
|
||||
<Select v-model="draft.verification">
|
||||
|
||||
+27
-2
@@ -217,6 +217,7 @@ export const api = {
|
||||
events: (params: { limit?: number; source_id?: string; declared_event_type?: string; matched?: string } = {}) =>
|
||||
request<EventRecord[]>("/api/events" + qs(params)),
|
||||
event: (id: string) => request<EventDetail>(`/api/events/${encodeURIComponent(id)}`),
|
||||
eventGroups: () => request<EventGroup[]>("/api/groups"),
|
||||
eventSources: () => request<EventSource_[]>("/api/sources"),
|
||||
createEventSource: (input: { label: string; scope?: SourceScope; connector: string } & Partial<SourceVerification>) =>
|
||||
request<SourceIssued>("/api/sources", { method: "POST", body: input }),
|
||||
@@ -850,6 +851,7 @@ export interface SystemHealth {
|
||||
runner: { healthy: boolean; workers: number; error?: string; error_at?: string };
|
||||
waiting?: { approvals: number; runs: RunCounts };
|
||||
last_failure?: { source: string; cause: string; at: string; run_id?: string };
|
||||
setup?: { title: string; detail?: string; done: boolean; path?: string }[];
|
||||
}
|
||||
|
||||
/** The values only the config file sets: GET /api/system/bootstrap. */
|
||||
@@ -952,7 +954,7 @@ interface Decision {
|
||||
change_request_rule?: string;
|
||||
at: string;
|
||||
action: { connector: string; name: string; target?: { Kind?: string; ID?: string; Environment?: string } };
|
||||
verdicts?: { guard: string; advisory: boolean; ceiling?: string; failed?: string }[];
|
||||
verdicts?: { guard: string; advisory: boolean; ceiling?: string; findings?: { text: string; evidence?: string; strength?: string }[]; failed?: string }[];
|
||||
}
|
||||
|
||||
export interface RunAction {
|
||||
@@ -1059,8 +1061,21 @@ export interface TriggerRun {
|
||||
}
|
||||
|
||||
export interface EventDetail {
|
||||
id?: string;
|
||||
source_id?: string;
|
||||
source?: string;
|
||||
declared_event_type?: string;
|
||||
matched?: boolean;
|
||||
body: unknown;
|
||||
runs?: { run_id?: string; trigger_id: string; trigger: string; outcome: string }[];
|
||||
runs?: TriggerRun[];
|
||||
}
|
||||
|
||||
export interface EventGroup {
|
||||
id: string;
|
||||
count: number;
|
||||
first_seen: string;
|
||||
last_seen: string;
|
||||
proposed: { source_id: string; source?: string; declared_event_type: string; filter?: unknown };
|
||||
}
|
||||
|
||||
// Named with a trailing underscore: EventSource is the browser's SSE class.
|
||||
@@ -1518,8 +1533,18 @@ export interface PolicyText {
|
||||
|
||||
export interface Judge {
|
||||
name: string;
|
||||
installation_id?: string;
|
||||
package?: string;
|
||||
scope?: string;
|
||||
built_in?: boolean;
|
||||
version?: string;
|
||||
digest?: string;
|
||||
advisory: boolean;
|
||||
enabled?: boolean;
|
||||
state?: string;
|
||||
error?: string;
|
||||
settings?: Record<string, string>;
|
||||
settings_schema?: SettingField[];
|
||||
latest?: { answer?: string; at?: string; model?: string; trusted?: boolean; advisory_reason?: string };
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import { Building2, LayoutDashboard, ListChecks, Server, Workflow, Zap, type LucideIcon } from "@lucide/vue";
|
||||
import { Building2, FileCheck2, LayoutDashboard, ListChecks, Play, Server, ShieldCheck, Workflow, Zap, type LucideIcon } from "@lucide/vue";
|
||||
|
||||
export const navIcons: Record<string, LucideIcon> = {
|
||||
"/": LayoutDashboard,
|
||||
"/tasks": ListChecks,
|
||||
"/runs": Play,
|
||||
"/proposals": FileCheck2,
|
||||
"/workflows": Workflow,
|
||||
"/events": Zap,
|
||||
"/controls": ShieldCheck,
|
||||
"/org": Building2,
|
||||
"/settings": Server,
|
||||
};
|
||||
+22
-10
@@ -12,17 +12,29 @@ export type { NavEntry, NavNode } from "./nav-tree";
|
||||
|
||||
const table = flattenRoutes(routes as NavRouteNode[]);
|
||||
|
||||
// Primary destinations: work, the organisation that owns it, and the instance
|
||||
// it runs on. Personal security and preferences live in the account menu.
|
||||
// Primary destinations grouped by operational role. Personal security and
|
||||
// preferences live in the account menu.
|
||||
const specs: NavSpec[] = [
|
||||
{ kind: "link", path: "/" },
|
||||
{ kind: "link", path: "/tasks" },
|
||||
{ kind: "link", path: "/runs" },
|
||||
{ kind: "link", path: "/workflows" },
|
||||
{ kind: "link", path: "/events" },
|
||||
{ kind: "link", path: "/controls" },
|
||||
{ kind: "link", path: "/org" },
|
||||
{ kind: "link", path: "/settings" },
|
||||
{
|
||||
kind: "group",
|
||||
label: "Operations",
|
||||
sections: [{ paths: ["/", "/tasks", "/runs", "/proposals"] }],
|
||||
},
|
||||
{
|
||||
kind: "group",
|
||||
label: "Automation",
|
||||
sections: [{ paths: ["/workflows", "/events"] }],
|
||||
},
|
||||
{
|
||||
kind: "group",
|
||||
label: "Governance",
|
||||
sections: [{ paths: ["/controls"] }],
|
||||
},
|
||||
{
|
||||
kind: "group",
|
||||
label: "Administration",
|
||||
sections: [{ paths: ["/org", "/settings"] }],
|
||||
},
|
||||
];
|
||||
|
||||
// The Organisation sidebar, grouped by what is being configured. Every page
|
||||
|
||||
@@ -26,7 +26,7 @@ onMounted(loadMappings);
|
||||
<Section>
|
||||
<template #action>
|
||||
<div class="flex flex-wrap items-center justify-end gap-2">
|
||||
<Button as-child size="sm" variant="outline"><RouterLink to="/org/playbooks">Installed playbooks</RouterLink></Button>
|
||||
<Button as-child size="sm" variant="outline"><RouterLink to="/workflows">Workflows</RouterLink></Button>
|
||||
<Button size="sm" @click="startCreate"><Plus data-icon="inline-start" />New mapping</Button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -34,17 +34,17 @@ import type { OrgEvent } from "./org";
|
||||
*/
|
||||
const allAreas = [
|
||||
{ title: "Execution identities", to: "/org/agents" },
|
||||
{ title: "Connections", to: "/org/connections" },
|
||||
{ title: "Extensions", to: "/settings/extensions" },
|
||||
{ title: "Workspaces", to: "/org/workspaces" },
|
||||
{ title: "Models", to: "/org/models" },
|
||||
{ title: "Schedules and playbooks", to: "/org/schedules" },
|
||||
{ title: "Models", to: "/settings/models" },
|
||||
{ title: "Triggers", to: "/events?tab=triggers" },
|
||||
{ title: "Members and access", to: "/org/members" },
|
||||
];
|
||||
const orgStore = useOrgStore();
|
||||
const session = useSessionStore();
|
||||
const areas = computed(() => {
|
||||
const hidden = hiddenPaths(session.sections);
|
||||
return allAreas.filter((area) => !hidden.includes(area.to));
|
||||
return allAreas.filter((area) => !hidden.includes(area.to.split("?")[0]!));
|
||||
});
|
||||
const org = computed(() => orgStore.org);
|
||||
// The single binary reports a revision with every org and serves the rename
|
||||
|
||||
@@ -20,7 +20,7 @@ const error = ref("");
|
||||
|
||||
// Policies and models act on the caller's own org server-side, so an instance
|
||||
// admin looking at another org is sent back rather than editing the wrong one.
|
||||
const OWN_ORG_ONLY = ["/org/audit", "/org/policies", "/org/models", "/org/connections", "/org/repositories", "/org/usage"];
|
||||
const OWN_ORG_ONLY = ["/org/audit", "/org/policies", "/org/repositories", "/org/usage"];
|
||||
const away = computed(() => !!org.value && org.value.id !== homeOrg.value);
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from "vue";
|
||||
import { computed, onMounted, ref, watch } from "vue";
|
||||
import { RouterLink, useRoute } from "vue-router";
|
||||
|
||||
import CodeView from "@/base/CodeView.vue";
|
||||
@@ -26,9 +26,10 @@ import { actionTone, approveProposal, kindLabel, proposalTone } from "./state";
|
||||
/** A proposal with its evidence, the actions it will take and how each was
|
||||
* judged, and the answer that approves or rejects it. */
|
||||
const route = useRoute();
|
||||
const id = String(route.params.id);
|
||||
const { data, error, reload } = useRead(() => api.proposal(id));
|
||||
const id = computed(() => String(route.params.id));
|
||||
const { data, error, reload } = useRead(() => api.proposal(id.value));
|
||||
onMounted(reload);
|
||||
watch(id, () => void reload());
|
||||
useLiveResource(null, () => void reload());
|
||||
usePoll(() => {
|
||||
if (data.value && (data.value.state === "pending" || data.value.state === "approved")) void reload();
|
||||
@@ -65,28 +66,30 @@ async function act(work: () => Promise<unknown>): Promise<void> {
|
||||
await reload();
|
||||
}
|
||||
}
|
||||
const approve = () => act(() => approveProposal(id));
|
||||
const dryRun = () => act(() => api.dryRunProposal(id));
|
||||
const approve = () => act(() => approveProposal(id.value));
|
||||
const dryRun = () => act(() => api.dryRunProposal(id.value));
|
||||
|
||||
const rejecting = ref(false);
|
||||
const reason = ref("");
|
||||
async function reject(): Promise<void> {
|
||||
await act(() => api.rejectProposal(id, reason.value.trim()));
|
||||
await act(() => api.rejectProposal(id.value, reason.value.trim()));
|
||||
if (!actionError.value) rejecting.value = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<p class="mb-2 text-caption text-fg-muted"><RouterLink class="underline" to="/proposals">Proposals</RouterLink></p>
|
||||
<PageHeader :title="data ? data.title : 'Proposal'">
|
||||
<Badge v-if="data" :variant="proposalTone(data.state)">{{ data.state }}</Badge>
|
||||
<span v-if="data" class="text-caption text-fg-muted">Proposed <Timestamp :at="data.created_at" /></span>
|
||||
<Button v-if="pending" variant="outline" size="sm" :disabled="busy" @click="rejecting = true">Reject</Button>
|
||||
<Button v-if="pending" size="sm" :disabled="busy" @click="approve">Approve</Button>
|
||||
</PageHeader>
|
||||
<ReadError v-if="error" :message="error" retry-label="Retry" @retry="reload" />
|
||||
<ReadError v-if="error && !data" :message="error" retry-label="Retry" @retry="reload" />
|
||||
<div v-else-if="!data" role="status" aria-label="Loading proposal" class="space-y-2"><Skeleton class="h-24 w-full" /><Skeleton class="h-48 w-full" /></div>
|
||||
<template v-else>
|
||||
<p v-if="error" role="alert" class="mb-2 text-caption text-danger">{{ error }}</p>
|
||||
<p v-if="actionError" role="alert" class="mb-2 text-caption text-danger">{{ actionError }}</p>
|
||||
<Section title="Summary">
|
||||
<p class="mb-3 text-label whitespace-pre-wrap">{{ data.summary }}</p>
|
||||
|
||||
@@ -152,7 +152,7 @@ export const routes: RouteRecordRaw[] = [
|
||||
name: "memory",
|
||||
component: MemoryPage,
|
||||
meta: {
|
||||
label: "Memory",
|
||||
label: "Personal memory",
|
||||
description: "What Archie remembers for you, and the notes shared with the organisation.",
|
||||
section: "memory",
|
||||
},
|
||||
@@ -164,7 +164,7 @@ export const routes: RouteRecordRaw[] = [
|
||||
meta: {
|
||||
navPath: "/settings",
|
||||
settings: true,
|
||||
label: "Memory",
|
||||
label: "Shared memory",
|
||||
description: "Notes shared with everyone, the proposals waiting for review, and their published versions.",
|
||||
section: "memory_admin",
|
||||
},
|
||||
|
||||
+20
-6
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from "vue";
|
||||
import { computed, onMounted, ref, watch } from "vue";
|
||||
import { RouterLink, useRoute } from "vue-router";
|
||||
|
||||
import CodeView from "@/base/CodeView.vue";
|
||||
@@ -26,9 +26,10 @@ import { ended, stateLabel, stateTone } from "./state";
|
||||
/** A run's decision trail: where it came from, each action it asked to take
|
||||
* and how that was judged, and the steps it recorded. */
|
||||
const route = useRoute();
|
||||
const id = String(route.params.id);
|
||||
const { data, error, reload } = useRead(() => api.run(id));
|
||||
const id = computed(() => String(route.params.id));
|
||||
const { data, error, reload } = useRead(() => api.run(id.value));
|
||||
onMounted(reload);
|
||||
watch(id, () => void reload());
|
||||
useLiveResource(null, () => void reload());
|
||||
const finished = computed(() => !!data.value?.run.finished_at);
|
||||
const cancellable = computed(() => (data.value ? !ended(data.value.run.state) : false));
|
||||
@@ -98,7 +99,7 @@ async function retry(): Promise<void> {
|
||||
retrying.value = true;
|
||||
retryError.value = "";
|
||||
try {
|
||||
await api.retryRun(id);
|
||||
await api.retryRun(id.value);
|
||||
await reload();
|
||||
} catch (cause) {
|
||||
retryError.value = describeError(cause, errors.common.unknown);
|
||||
@@ -112,7 +113,7 @@ async function cancel(): Promise<void> {
|
||||
cancelling.value = true;
|
||||
cancelError.value = "";
|
||||
try {
|
||||
await api.cancelRun(id);
|
||||
await api.cancelRun(id.value);
|
||||
await reload();
|
||||
} catch (cause) {
|
||||
cancelError.value = describeError(cause, errors.common.unknown);
|
||||
@@ -132,15 +133,17 @@ const result = computed(() => {
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<p class="mb-2 text-caption text-fg-muted"><RouterLink class="underline" to="/runs">Runs</RouterLink></p>
|
||||
<PageHeader :title="data ? data.run.workflow : 'Run'">
|
||||
<Badge v-if="data" :variant="stateTone(data.run.state)">{{ stateLabel(data.run.state) }}</Badge>
|
||||
<span v-if="data" class="text-caption text-fg-muted">Started <Timestamp :at="data.run.created_at" /></span>
|
||||
<Button v-if="data?.run.state === 'parked'" size="sm" :disabled="retrying" @click="retry">Retry</Button>
|
||||
<Button v-if="cancellable" variant="destructive" size="sm" :disabled="cancelling" @click="cancel">Cancel</Button>
|
||||
</PageHeader>
|
||||
<ReadError v-if="error" :message="error" retry-label="Retry" @retry="reload" />
|
||||
<ReadError v-if="error && !data" :message="error" retry-label="Retry" @retry="reload" />
|
||||
<div v-else-if="!data" role="status" aria-label="Loading run" class="space-y-2"><Skeleton class="h-24 w-full" /><Skeleton class="h-48 w-full" /></div>
|
||||
<template v-else>
|
||||
<p v-if="error" role="alert" class="mb-2 text-caption text-danger">{{ error }}</p>
|
||||
<p v-if="retryError" role="alert" class="mb-2 text-caption text-danger">{{ retryError }}</p>
|
||||
<p v-if="cancelError" role="alert" class="mb-2 text-caption text-danger">{{ cancelError }}</p>
|
||||
<ApprovalsSection :run="id" @answered="reload" />
|
||||
@@ -179,6 +182,17 @@ const result = computed(() => {
|
||||
<Timestamp class="ml-auto text-caption text-fg-subtle" :at="action.decision.at" />
|
||||
</div>
|
||||
<p v-if="action.decision.reason" class="text-caption text-fg-muted">{{ action.decision.reason }}</p>
|
||||
<div v-if="action.decision.verdicts?.length || action.decision.change_request" class="mt-1 space-y-0.5 border-l-2 border-border pl-3 text-caption text-fg-muted">
|
||||
<p class="font-medium text-foreground">Why this decision?</p>
|
||||
<p v-if="action.decision.change_request">
|
||||
Change request required<template v-if="action.decision.change_request_rule"> ({{ action.decision.change_request_rule }})</template>
|
||||
</p>
|
||||
<ul v-if="action.decision.verdicts?.length" class="space-y-0.5">
|
||||
<li v-for="v in action.decision.verdicts" :key="v.guard">
|
||||
<span class="font-mono">{{ v.guard }}</span>: {{ v.ceiling ? stateLabel(v.ceiling) : "no ceiling" }}<template v-if="v.advisory"> (advisory)</template><template v-if="v.findings?.length"> — {{ v.findings.map((f) => f.text).join("; ") }}</template><template v-if="v.failed">, failed: {{ v.failed }}</template>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<p v-if="action.approval?.answered_by" class="text-caption text-fg-muted">
|
||||
Answered by {{ action.approval.answered_by }}<template v-if="action.approval.answered_via"> via {{ action.approval.answered_via }}</template>
|
||||
</p>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { ReadError } from "@/components/ui/read-error";
|
||||
import { Item, ItemGroup } from "@/components/ui/item";
|
||||
import { Alert, AlertDescription } from "@/components/ui/alert";
|
||||
import { computed, onMounted, ref, watch } from "vue";
|
||||
import { RouterLink, useRoute, useRouter } from "vue-router";
|
||||
import { ChevronRight, Pencil, Plus, Settings2, Trash2 } from "@lucide/vue";
|
||||
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
@@ -43,12 +44,31 @@ import ExtensionsMarketplace from "./ExtensionsMarketplace.vue";
|
||||
import CatalogueInstallDialog from "./CatalogueInstallDialog.vue";
|
||||
import PackageVersionsDialog from "./PackageVersionsDialog.vue";
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const VALID_TABS = new Set(["installations", "packages", "marketplace"]);
|
||||
const activeTab = computed(() => {
|
||||
const t = String(route.query.tab ?? "");
|
||||
if (VALID_TABS.has(t)) return t;
|
||||
return route.query.kind ? "packages" : "installations";
|
||||
});
|
||||
function selectTab(next: unknown): void {
|
||||
const value = String(next);
|
||||
if (!VALID_TABS.has(value)) return;
|
||||
void router.replace({ query: { ...route.query, tab: value === "installations" ? undefined : value } });
|
||||
}
|
||||
|
||||
const store = useExtensionsStore();
|
||||
const org = useOrgStore();
|
||||
const loading = ref(true);
|
||||
onMounted(async () => {
|
||||
await Promise.all([store.load(), org.loadOrg()]);
|
||||
loading.value = false;
|
||||
const configureId = String(route.query.configure ?? "");
|
||||
if (configureId) {
|
||||
const target = store.extensions.find((ext) => ext.id === configureId);
|
||||
if (target?.editable) openSettings(target);
|
||||
}
|
||||
});
|
||||
|
||||
// A new installation may be owned by the instance when the caller administers
|
||||
@@ -168,7 +188,13 @@ const pathGroups = computed(() => {
|
||||
}
|
||||
return [...byGroup.values()];
|
||||
});
|
||||
const activeKind = ref("");
|
||||
const activeKind = ref(String(route.query.kind ?? ""));
|
||||
watch(
|
||||
() => route.query.kind,
|
||||
(kind) => {
|
||||
if (typeof kind === "string") activeKind.value = kind;
|
||||
},
|
||||
);
|
||||
const active = computed(() => (kinds.data.value ?? []).find((kind) => kind.kind === activeKind.value) ?? kinds.data.value?.[0]);
|
||||
</script>
|
||||
|
||||
@@ -178,7 +204,7 @@ const active = computed(() => (kinds.data.value ?? []).find((kind) => kind.kind
|
||||
|
||||
<Alert v-if="store.error" variant="destructive" class="mb-4"><AlertDescription>{{ store.error }}</AlertDescription></Alert>
|
||||
|
||||
<Tabs default-value="installations" class="space-y-4">
|
||||
<Tabs :model-value="activeTab" class="space-y-4" @update:model-value="selectTab">
|
||||
<TabsList>
|
||||
<TabsTrigger value="installations">Installations</TabsTrigger>
|
||||
<TabsTrigger value="packages">Packages</TabsTrigger>
|
||||
@@ -321,8 +347,10 @@ const active = computed(() => (kinds.data.value ?? []).find((kind) => kind.kind
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="marketplace">
|
||||
<Collapsible class="mb-3" default-open>
|
||||
<CollapsibleTrigger class="cursor-pointer text-caption text-fg-muted">Catalogue source</CollapsibleTrigger>
|
||||
<Collapsible class="mb-3" :default-open="!store.source.configured && !!store.catalogueError">
|
||||
<CollapsibleTrigger class="cursor-pointer text-caption text-fg-muted">
|
||||
Catalogue source<span v-if="store.source.source?.location" class="ml-1.5 font-mono text-fg-subtle">({{ store.source.source.location }})</span>
|
||||
</CollapsibleTrigger>
|
||||
<CollapsibleContent>
|
||||
<form class="mt-2 flex flex-wrap items-end gap-2" @submit.prevent="saveSource">
|
||||
<Input v-model="sourceLocation" class="max-w-96 font-mono" placeholder="https://… or /path/to/catalogue.json" aria-label="Catalogue location" />
|
||||
@@ -354,6 +382,9 @@ const active = computed(() => (kinds.data.value ?? []).find((kind) => kind.kind
|
||||
</SettingRow>
|
||||
<SettingRow label="Other settings" for="ext-settings" hint="key=value, one per line. A key ending in _ref takes engine:key.">
|
||||
<Textarea id="ext-settings" v-model="other" class="font-mono" rows="3" />
|
||||
<p class="mt-1 text-caption text-fg-muted">
|
||||
Manage <RouterLink to="/settings/secret-engines" class="underline">secret engines</RouterLink> or <RouterLink to="/settings/credentials" class="underline">credentials</RouterLink>.
|
||||
</p>
|
||||
</SettingRow>
|
||||
</form>
|
||||
<DialogFooter><Button type="submit" form="extension-settings" :disabled="!!store.busy">Save and restart</Button></DialogFooter>
|
||||
|
||||
@@ -18,7 +18,11 @@ useIntervalFn(store.load, 15_000);
|
||||
<PageHeader title="Secret engines">
|
||||
<Button variant="outline" size="sm" @click="store.load">Refresh</Button>
|
||||
</PageHeader>
|
||||
<p class="mb-4 text-label text-fg-muted">Extension engines: <RouterLink to="/settings/extensions" class="underline">Extensions</RouterLink></p>
|
||||
<p class="mb-4 text-label text-fg-muted">
|
||||
<RouterLink :to="{ path: '/settings/extensions', query: { tab: 'packages', kind: 'secret-engines' } }" class="underline">Manage secret engines</RouterLink>
|
||||
·
|
||||
<RouterLink :to="{ path: '/settings/extensions', query: { tab: 'marketplace', kind: 'secret-engines' } }" class="underline">Browse secret engines</RouterLink>
|
||||
</p>
|
||||
<Alert v-if="store.error" variant="destructive"><AlertDescription>{{ store.error }}</AlertDescription></Alert>
|
||||
<Empty v-else-if="store.engines && !store.engines.length"><EmptyHeader><EmptyTitle>No secret engines installed</EmptyTitle></EmptyHeader></Empty>
|
||||
<Table v-else-if="store.engines">
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import { computed } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
@@ -26,21 +25,14 @@ const items = computed(() =>
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex gap-8 @max-3xl:flex-col @max-3xl:gap-4">
|
||||
<div class="flex flex-col gap-4">
|
||||
<nav
|
||||
id="config-sidebar"
|
||||
:aria-label="props.scope === 'org' ? 'Organisation' : 'Instance'"
|
||||
class="shrink-0 @3xl:w-48 @max-3xl:-mx-4 @max-3xl:w-auto @max-3xl:scroll-fade-x @max-3xl:overflow-x-auto @max-3xl:[scrollbar-width:none] @max-3xl:border-b @max-3xl:px-4"
|
||||
class="-mx-4 scroll-fade-x overflow-x-auto border-b px-4 pb-2 [scrollbar-width:none]"
|
||||
>
|
||||
<ul class="flex flex-col gap-0.5 @3xl:sticky @3xl:top-20 @max-3xl:flex-row @max-3xl:gap-1">
|
||||
<li v-for="(item, index) in items" :key="item.path" class="contents">
|
||||
<Separator v-if="item.dividerBefore === ''" class="my-4 @max-3xl:hidden" />
|
||||
<p
|
||||
v-else-if="item.dividerBefore"
|
||||
:class="cn('mb-1 px-3 text-caption font-medium tracking-[0.06em] text-fg-subtle uppercase @max-3xl:hidden', index > 0 && 'mt-4')"
|
||||
>
|
||||
{{ item.dividerBefore }}
|
||||
</p>
|
||||
<ul class="flex flex-row flex-wrap gap-1">
|
||||
<li v-for="item in items" :key="item.path" class="contents">
|
||||
<RouterLink
|
||||
:to="item.path"
|
||||
:aria-current="route.path === item.path ? 'page' : undefined"
|
||||
|
||||
@@ -124,6 +124,7 @@ async function create(): Promise<void> {
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No workflows</EmptyTitle>
|
||||
</EmptyHeader>
|
||||
<Button size="sm" variant="outline" @click="creating = true"><Plus data-icon="inline-start" />New workflow</Button>
|
||||
</Empty>
|
||||
<p v-else-if="rows.length && !shown.length" class="text-label text-fg-muted">No workflow matches.</p>
|
||||
|
||||
|
||||
Reference in new issue
Block a user