refactor: format markdown files using prettier, fix spelling concerns, reduce Taskfile bloat
This commit is contained in:
608 files changed
+63317
-10219
No files matched your search
@@ -35,7 +35,9 @@ const labels: Record<ApplyState, string> = {
|
||||
<div class="flex items-center gap-2 text-xs">
|
||||
<Badge :variant="variants[row.state]">{{ labels[row.state] }}</Badge>
|
||||
<span class="font-mono">{{ row.process }}</span>
|
||||
<span v-if="row.state !== 'not-reporting'" class="text-muted-foreground">version {{ row.version }}</span>
|
||||
<span v-if="row.state !== 'not-reporting'" class="text-muted-foreground"
|
||||
>version {{ row.version }}</span
|
||||
>
|
||||
</div>
|
||||
<p v-if="row.error" class="text-xs text-destructive">{{ row.error }}</p>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
|
||||
/**
|
||||
* One titled card of the System surface. Every card on the six pages opens the
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="grid grid-cols-1 min-[701px]:supports-[grid-template-columns:subgrid]:grid-cols-[max-content_minmax(0,1fr)_auto]">
|
||||
<div
|
||||
class="grid grid-cols-1 min-[701px]:supports-[grid-template-columns:subgrid]:grid-cols-[max-content_minmax(0,1fr)_auto]"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
@@ -14,6 +14,9 @@ const lastError = computed(() => config.value?.reload?.last_error ?? "");
|
||||
|
||||
<template>
|
||||
<Alert v-if="lastError" class="mb-4">
|
||||
<AlertDescription>The last config reload failed; the running config is unchanged: {{ lastError }}</AlertDescription>
|
||||
<AlertDescription
|
||||
>The last config reload failed; the running config is unchanged:
|
||||
{{ lastError }}</AlertDescription
|
||||
>
|
||||
</Alert>
|
||||
</template>
|
||||
@@ -1,7 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
TooltipTrigger,
|
||||
} from "@/components/ui/tooltip";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { valueText } from "./config-field";
|
||||
import type { ConfigField } from "./types";
|
||||
@@ -46,9 +50,16 @@ const lockedReason = computed(() => props.field?.locked_reason ?? "");
|
||||
the tooltip content itself is out of the accessibility tree when the
|
||||
trigger is not hovered or focused.
|
||||
-->
|
||||
<span tabindex="0" :aria-label="`${label}: ${field.description}`" class="text-sm text-fg-muted">{{ label }}</span>
|
||||
<span
|
||||
tabindex="0"
|
||||
:aria-label="`${label}: ${field.description}`"
|
||||
class="text-sm text-fg-muted"
|
||||
>{{ label }}</span
|
||||
>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent :side-offset="8" class="max-w-80">{{ field.description }}</TooltipContent>
|
||||
<TooltipContent :side-offset="8" class="max-w-80">{{
|
||||
field.description
|
||||
}}</TooltipContent>
|
||||
</Tooltip>
|
||||
<span v-else class="text-sm text-fg-muted">{{ label }}</span>
|
||||
|
||||
@@ -57,11 +68,22 @@ const lockedReason = computed(() => props.field?.locked_reason ?? "");
|
||||
column and truncated them against the buttons. -->
|
||||
<slot name="value">
|
||||
<span
|
||||
:class="cn('min-w-0 break-words font-mono text-sm min-[701px]:truncate', text === '—' ? 'text-fg-subtle' : 'text-foreground', lockedReason && 'text-fg-muted')"
|
||||
:class="
|
||||
cn(
|
||||
'min-w-0 break-words font-mono text-sm min-[701px]:truncate',
|
||||
text === '—' ? 'text-fg-subtle' : 'text-foreground',
|
||||
lockedReason && 'text-fg-muted',
|
||||
)
|
||||
"
|
||||
:title="text"
|
||||
>{{ text }}</span>
|
||||
>{{ text }}</span
|
||||
>
|
||||
</slot>
|
||||
|
||||
<span v-if="lockedReason" class="col-span-full text-xs text-fg-subtle min-[701px]:col-span-2 min-[701px]:col-start-2">{{ lockedReason }}</span>
|
||||
<span
|
||||
v-if="lockedReason"
|
||||
class="col-span-full text-xs text-fg-subtle min-[701px]:col-span-2 min-[701px]:col-start-2"
|
||||
>{{ lockedReason }}</span
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
@@ -19,7 +19,11 @@ const sections = computed(() => sectionsFor(config.value?.schema, props.ids));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ConfigCard v-for="section in sections" :key="section.id" :title="section.label">
|
||||
<ConfigCard
|
||||
v-for="section in sections"
|
||||
:key="section.id"
|
||||
:title="section.label"
|
||||
>
|
||||
<ConfigList>
|
||||
<ConfigRow
|
||||
v-for="field in sectionRows(section)"
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import {
|
||||
Empty,
|
||||
EmptyDescription,
|
||||
EmptyHeader,
|
||||
EmptyTitle,
|
||||
} from "@/components/ui/empty";
|
||||
import { configError } from "./state";
|
||||
|
||||
/**
|
||||
@@ -16,8 +21,12 @@ import { configError } from "./state";
|
||||
<CardContent>
|
||||
<Empty>
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>{{ configError ? "Cannot reach archied" : "No configuration loaded" }}</EmptyTitle>
|
||||
<EmptyDescription v-if="configError">{{ configError }}</EmptyDescription>
|
||||
<EmptyTitle>{{
|
||||
configError ? "Cannot reach archied" : "No configuration loaded"
|
||||
}}</EmptyTitle>
|
||||
<EmptyDescription v-if="configError">{{
|
||||
configError
|
||||
}}</EmptyDescription>
|
||||
<EmptyDescription v-else>
|
||||
archied is running without a config file wired into the dashboard.
|
||||
</EmptyDescription>
|
||||
|
||||
@@ -3,7 +3,14 @@ import { ref } from "vue";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Field, FieldLabel } from "@/components/ui/field";
|
||||
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectGroup,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import { requestDangerous } from "./state";
|
||||
import type { DangerCheckpoint } from "./types";
|
||||
|
||||
@@ -18,8 +25,10 @@ const props = defineProps<{ checkpoints: DangerCheckpoint[] }>();
|
||||
|
||||
const checkpoint = ref("");
|
||||
|
||||
const number = (cp: DangerCheckpoint): number | undefined => cp.Number ?? cp.number;
|
||||
const label = (cp: DangerCheckpoint): string => cp.Label ?? cp.label ?? "checkpoint";
|
||||
const number = (cp: DangerCheckpoint): number | undefined =>
|
||||
cp.Number ?? cp.number;
|
||||
const label = (cp: DangerCheckpoint): string =>
|
||||
cp.Label ?? cp.label ?? "checkpoint";
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -31,13 +40,21 @@ const label = (cp: DangerCheckpoint): string => cp.Label ?? cp.label ?? "checkpo
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectItem v-for="cp in props.checkpoints" :key="String(number(cp))" :value="String(number(cp))">
|
||||
<SelectItem
|
||||
v-for="cp in props.checkpoints"
|
||||
:key="String(number(cp))"
|
||||
:value="String(number(cp))"
|
||||
>
|
||||
{{ number(cp) }} — {{ label(cp) }}
|
||||
</SelectItem>
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Button variant="outline" :disabled="!checkpoint" @click="requestDangerous('rollback', checkpoint)">
|
||||
<Button
|
||||
variant="outline"
|
||||
:disabled="!checkpoint"
|
||||
@click="requestDangerous('rollback', checkpoint)"
|
||||
>
|
||||
Request rollback
|
||||
</Button>
|
||||
</Field>
|
||||
|
||||
@@ -16,7 +16,9 @@ const requested = computed(() => spec.value.trim().length > 0);
|
||||
|
||||
<template>
|
||||
<Field orientation="horizontal">
|
||||
<FieldLabel class="sr-only" for="danger-stop">Process name or id</FieldLabel>
|
||||
<FieldLabel class="sr-only" for="danger-stop"
|
||||
>Process name or id</FieldLabel
|
||||
>
|
||||
<Input
|
||||
id="danger-stop"
|
||||
v-model="spec"
|
||||
@@ -24,6 +26,11 @@ const requested = computed(() => spec.value.trim().length > 0);
|
||||
autocomplete="off"
|
||||
class="w-full min-[701px]:max-w-80"
|
||||
/>
|
||||
<Button variant="outline" :disabled="!requested" @click="requestDangerous('stop', spec)">Request stop</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
:disabled="!requested"
|
||||
@click="requestDangerous('stop', spec)"
|
||||
>Request stop</Button
|
||||
>
|
||||
</Field>
|
||||
</template>
|
||||
@@ -43,11 +43,17 @@ function onConfirmationOpen(open: boolean): void {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex flex-wrap items-center justify-between gap-3 border-t border-hairline py-3">
|
||||
<div
|
||||
class="flex flex-wrap items-center justify-between gap-3 border-t border-hairline py-3"
|
||||
>
|
||||
<span class="text-sm">{{ props.action.description }}</span>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<Button variant="destructive" @click="confirming = 'approve'">Approve</Button>
|
||||
<Button variant="destructive" @click="confirming = 'permanent'">Approve for 24h</Button>
|
||||
<Button variant="destructive" @click="confirming = 'approve'"
|
||||
>Approve</Button
|
||||
>
|
||||
<Button variant="destructive" @click="confirming = 'permanent'"
|
||||
>Approve for 24h</Button
|
||||
>
|
||||
<Button variant="default" @click="decide('deny')">Deny</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -56,16 +62,19 @@ function onConfirmationOpen(open: boolean): void {
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>
|
||||
{{ confirming === 'permanent' ? 'Approve for 24 hours?' : 'Approve this action?' }}
|
||||
{{
|
||||
confirming === "permanent"
|
||||
? "Approve for 24 hours?"
|
||||
: "Approve this action?"
|
||||
}}
|
||||
</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
<template v-if="confirming === 'permanent'">
|
||||
This runs "{{ description }}" now, and approves its action family for 24 hours — further
|
||||
requests of the same kind run without asking again.
|
||||
</template>
|
||||
<template v-else>
|
||||
This runs "{{ description }}" once, now.
|
||||
This runs "{{ description }}" now, and approves its action family
|
||||
for 24 hours — further requests of the same kind run without asking
|
||||
again.
|
||||
</template>
|
||||
<template v-else> This runs "{{ description }}" once, now. </template>
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
@@ -74,7 +83,7 @@ function onConfirmationOpen(open: boolean): void {
|
||||
variant="destructive"
|
||||
@click="confirming && decide(confirming)"
|
||||
>
|
||||
{{ confirming === 'permanent' ? 'Approve for 24h' : 'Approve' }}
|
||||
{{ confirming === "permanent" ? "Approve for 24h" : "Approve" }}
|
||||
</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
|
||||
@@ -43,9 +43,15 @@ const error = computed(() => dangerous.value?.error ?? "");
|
||||
<DangerRollbackRequest :checkpoints="checkpoints" />
|
||||
<DangerStopRequest />
|
||||
</div>
|
||||
<p v-if="!pending.length" class="mt-3 text-sm text-fg-muted">No pending dangerous actions.</p>
|
||||
<p v-if="!pending.length" class="mt-3 text-sm text-fg-muted">
|
||||
No pending dangerous actions.
|
||||
</p>
|
||||
<div v-else class="mt-3">
|
||||
<DangerousActionRow v-for="action in pending" :key="action.id" :action="action" />
|
||||
<DangerousActionRow
|
||||
v-for="action in pending"
|
||||
:key="action.id"
|
||||
:action="action"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</ConfigCard>
|
||||
|
||||
@@ -25,8 +25,10 @@ const error = ref<string | null>(null);
|
||||
const { streamState } = storeToRefs(useLiveUpdatesStore());
|
||||
|
||||
const liveState = computed(() => {
|
||||
if (streamState.value === "live") return { label: "Connected", kind: "ok" as const };
|
||||
if (streamState.value === "unavailable") return { label: "Unavailable", kind: "danger" as const };
|
||||
if (streamState.value === "live")
|
||||
return { label: "Connected", kind: "ok" as const };
|
||||
if (streamState.value === "unavailable")
|
||||
return { label: "Unavailable", kind: "danger" as const };
|
||||
return { label: "Connecting", kind: "warn" as const };
|
||||
});
|
||||
|
||||
@@ -37,7 +39,10 @@ const names: Record<string, string> = {
|
||||
};
|
||||
|
||||
function componentName(name: string): string {
|
||||
return names[name] ?? name.replaceAll("_", " ").replace(/^./, (letter) => letter.toUpperCase());
|
||||
return (
|
||||
names[name] ??
|
||||
name.replaceAll("_", " ").replace(/^./, (letter) => letter.toUpperCase())
|
||||
);
|
||||
}
|
||||
|
||||
async function load(): Promise<void> {
|
||||
@@ -68,10 +73,19 @@ onMounted(load);
|
||||
<Badge :variant="liveState.kind">{{ liveState.label }}</Badge>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow v-for="component in report?.components ?? []" :key="component.name">
|
||||
<TableRow
|
||||
v-for="component in report?.components ?? []"
|
||||
:key="component.name"
|
||||
>
|
||||
<TableCell>
|
||||
<span class="font-medium">{{ componentName(component.name) }}</span>
|
||||
<span v-if="component.detail" class="ml-2 text-sm text-fg-muted">{{ component.detail }}</span>
|
||||
<span class="font-medium">{{
|
||||
componentName(component.name)
|
||||
}}</span>
|
||||
<span
|
||||
v-if="component.detail"
|
||||
class="ml-2 text-sm text-fg-muted"
|
||||
>{{ component.detail }}</span
|
||||
>
|
||||
</TableCell>
|
||||
<TableCell class="w-px text-right">
|
||||
<Badge :variant="component.ready ? 'ok' : 'danger'">
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
|
||||
import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import {
|
||||
Empty,
|
||||
EmptyDescription,
|
||||
EmptyHeader,
|
||||
EmptyTitle,
|
||||
} from "@/components/ui/empty";
|
||||
import ConfigList from "./ConfigList.vue";
|
||||
import ConfigRow from "./ConfigRow.vue";
|
||||
import { config } from "./state";
|
||||
@@ -19,14 +24,24 @@ function roleLabel(role: string): string {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h3 class="mt-5 mb-2 text-sm font-semibold text-fg-muted first:mt-0">Model roles</h3>
|
||||
<h3 class="mt-5 mb-2 text-sm font-semibold text-fg-muted first:mt-0">
|
||||
Model roles
|
||||
</h3>
|
||||
<Empty v-if="!entries.length">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No model roles configured</EmptyTitle>
|
||||
<EmptyDescription>Assign a model to at least one role (e.g. "builder") in [models].</EmptyDescription>
|
||||
<EmptyDescription
|
||||
>Assign a model to at least one role (e.g. "builder") in
|
||||
[models].</EmptyDescription
|
||||
>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
<ConfigList v-else>
|
||||
<ConfigRow v-for="[role, model] in entries" :key="role" :label="roleLabel(role)" :value="model" />
|
||||
<ConfigRow
|
||||
v-for="[role, model] in entries"
|
||||
:key="role"
|
||||
:label="roleLabel(role)"
|
||||
:value="model"
|
||||
/>
|
||||
</ConfigList>
|
||||
</template>
|
||||
@@ -11,9 +11,7 @@ import ProviderTable from "./ProviderTable.vue";
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ConfigCard
|
||||
title="Models & providers"
|
||||
>
|
||||
<ConfigCard title="Models & providers">
|
||||
<ModelRoleList />
|
||||
<ProviderTable />
|
||||
</ConfigCard>
|
||||
|
||||
@@ -2,8 +2,20 @@
|
||||
import { computed } from "vue";
|
||||
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
||||
import {
|
||||
Empty,
|
||||
EmptyDescription,
|
||||
EmptyHeader,
|
||||
EmptyTitle,
|
||||
} from "@/components/ui/empty";
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@/components/ui/table";
|
||||
import { config } from "./state";
|
||||
|
||||
/**
|
||||
@@ -20,7 +32,10 @@ const providers = computed(() => Object.entries(config.value?.providers ?? {}));
|
||||
<Empty v-if="!providers.length">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No providers configured</EmptyTitle>
|
||||
<EmptyDescription>Add a [providers.<name>] entry so a model role above has something to run on.</EmptyDescription>
|
||||
<EmptyDescription
|
||||
>Add a [providers.<name>] entry so a model role above has
|
||||
something to run on.</EmptyDescription
|
||||
>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
<Table v-else>
|
||||
@@ -37,8 +52,12 @@ const providers = computed(() => Object.entries(config.value?.providers ?? {}));
|
||||
<TableRow v-for="[name, provider] in providers" :key="name">
|
||||
<TableCell class="font-medium">{{ name }}</TableCell>
|
||||
<TableCell>{{ provider.class }}</TableCell>
|
||||
<TableCell class="font-mono">{{ provider.base_url || "default" }}</TableCell>
|
||||
<TableCell class="font-mono">{{ provider.api_key_env || "—" }}</TableCell>
|
||||
<TableCell class="font-mono">{{
|
||||
provider.base_url || "default"
|
||||
}}</TableCell>
|
||||
<TableCell class="font-mono">{{
|
||||
provider.api_key_env || "—"
|
||||
}}</TableCell>
|
||||
<TableCell>
|
||||
<Badge v-if="provider.configured" variant="ok">configured</Badge>
|
||||
<Badge v-else variant="warn">missing credentials</Badge>
|
||||
|
||||
@@ -1,8 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
|
||||
import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
||||
import {
|
||||
Empty,
|
||||
EmptyDescription,
|
||||
EmptyHeader,
|
||||
EmptyTitle,
|
||||
} from "@/components/ui/empty";
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@/components/ui/table";
|
||||
import ConfigCard from "./ConfigCard.vue";
|
||||
import { config } from "./state";
|
||||
|
||||
@@ -29,7 +41,10 @@ function gateSummary(gate?: string[][]): string {
|
||||
<Empty>
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No repositories configured</EmptyTitle>
|
||||
<EmptyDescription>Add a [[repos]] entry in config.toml so Archie has somewhere to work.</EmptyDescription>
|
||||
<EmptyDescription
|
||||
>Add a [[repos]] entry in config.toml so Archie has somewhere to
|
||||
work.</EmptyDescription
|
||||
>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
</ConfigCard>
|
||||
@@ -49,11 +64,15 @@ function gateSummary(gate?: string[][]): string {
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
<TableRow v-for="(repo, index) in repos" :key="index">
|
||||
<TableCell class="font-medium">{{ repo.owner }}/{{ repo.name }}</TableCell>
|
||||
<TableCell class="font-medium"
|
||||
>{{ repo.owner }}/{{ repo.name }}</TableCell
|
||||
>
|
||||
<TableCell class="font-mono">{{ repo.base }}</TableCell>
|
||||
<TableCell>{{ repo.ecosystem || "go" }}</TableCell>
|
||||
<TableCell class="font-mono">{{ gateSummary(repo.gate) }}</TableCell>
|
||||
<TableCell class="font-mono">{{ repo.protect?.length ? repo.protect.join(", ") : "—" }}</TableCell>
|
||||
<TableCell class="font-mono">{{
|
||||
repo.protect?.length ? repo.protect.join(", ") : "—"
|
||||
}}</TableCell>
|
||||
<TableCell>{{ repo.allow_concurrent ? "yes" : "no" }}</TableCell>
|
||||
<TableCell class="font-mono">{{ repo.max_retries ?? 0 }}</TableCell>
|
||||
<TableCell>{{ repo.review_enabled ? "yes" : "no" }}</TableCell>
|
||||
|
||||
@@ -6,7 +6,10 @@ import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Spinner } from "@/components/ui/spinner";
|
||||
import { ago } from "@/lib/format";
|
||||
import { useControlPlaneStore, type ResourceRevision } from "@/stores/control-plane";
|
||||
import {
|
||||
useControlPlaneStore,
|
||||
type ResourceRevision,
|
||||
} from "@/stores/control-plane";
|
||||
|
||||
/**
|
||||
* A resource's audit trail, and the way back to any earlier value.
|
||||
@@ -57,20 +60,35 @@ async function restore(revision: ResourceRevision): Promise<void> {
|
||||
{{ open ? "Hide history" : "History" }}
|
||||
</Button>
|
||||
|
||||
<p v-if="error" class="mt-2 text-sm text-destructive" role="alert">{{ error }}</p>
|
||||
<p v-if="error" class="mt-2 text-sm text-destructive" role="alert">
|
||||
{{ error }}
|
||||
</p>
|
||||
|
||||
<div v-else-if="open && !loading" class="mt-3">
|
||||
<p v-if="!revisions.length" class="text-sm text-muted-foreground">No changes recorded yet.</p>
|
||||
<p v-if="!revisions.length" class="text-sm text-muted-foreground">
|
||||
No changes recorded yet.
|
||||
</p>
|
||||
<ul v-else class="space-y-1">
|
||||
<li
|
||||
v-for="revision in revisions"
|
||||
:key="revision.version"
|
||||
class="grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-3 border-t border-border py-2 first:border-t-0"
|
||||
>
|
||||
<Badge :variant="revision.version === state.resource?.version ? 'ok' : 'idle'">v{{ revision.version }}</Badge>
|
||||
<span class="min-w-0 truncate text-sm text-fg-muted" :title="`${revision.actor} via ${revision.source}`">
|
||||
{{ revision.actor }} <span class="text-fg-subtle">via {{ revision.source }}</span>
|
||||
<span v-if="revision.at" class="text-fg-subtle"> · {{ ago(revision.at) }}</span>
|
||||
<Badge
|
||||
:variant="
|
||||
revision.version === state.resource?.version ? 'ok' : 'idle'
|
||||
"
|
||||
>v{{ revision.version }}</Badge
|
||||
>
|
||||
<span
|
||||
class="min-w-0 truncate text-sm text-fg-muted"
|
||||
:title="`${revision.actor} via ${revision.source}`"
|
||||
>
|
||||
{{ revision.actor }}
|
||||
<span class="text-fg-subtle">via {{ revision.source }}</span>
|
||||
<span v-if="revision.at" class="text-fg-subtle">
|
||||
· {{ ago(revision.at) }}</span
|
||||
>
|
||||
</span>
|
||||
<Button
|
||||
v-if="revision.version !== state.resource?.version"
|
||||
|
||||
@@ -4,13 +4,20 @@ import { computed, ref, watch } from "vue";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Spinner } from "@/components/ui/spinner";
|
||||
import { cloneControlPlaneValue, useControlPlaneStore, type ResourceDescriptor } from "@/stores/control-plane";
|
||||
import {
|
||||
cloneControlPlaneValue,
|
||||
useControlPlaneStore,
|
||||
type ResourceDescriptor,
|
||||
} from "@/stores/control-plane";
|
||||
import ConfigCard from "./ConfigCard.vue";
|
||||
import ResourceHistory from "./ResourceHistory.vue";
|
||||
import StructuredValueEditor from "./StructuredValueEditor.vue";
|
||||
import { parseSchema } from "./resource-schema";
|
||||
|
||||
const props = defineProps<{ descriptor: ResourceDescriptor; rootPath?: string }>();
|
||||
const props = defineProps<{
|
||||
descriptor: ResourceDescriptor;
|
||||
rootPath?: string;
|
||||
}>();
|
||||
const store = useControlPlaneStore();
|
||||
const state = computed(() => store.stateFor(props.descriptor.kind));
|
||||
const draft = ref<unknown>({});
|
||||
@@ -21,12 +28,19 @@ const draft = ref<unknown>({});
|
||||
// rendering the value alone.
|
||||
const schema = computed(() => parseSchema(props.descriptor.schema_json));
|
||||
|
||||
watch(() => state.value.resource, (resource) => {
|
||||
if (resource) draft.value = cloneControlPlaneValue(resource.value);
|
||||
}, { immediate: true });
|
||||
watch(
|
||||
() => state.value.resource,
|
||||
(resource) => {
|
||||
if (resource) draft.value = cloneControlPlaneValue(resource.value);
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
async function save(): Promise<void> {
|
||||
await store.replace(props.descriptor.kind, cloneControlPlaneValue(draft.value));
|
||||
await store.replace(
|
||||
props.descriptor.kind,
|
||||
cloneControlPlaneValue(draft.value),
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -39,12 +53,22 @@ async function save(): Promise<void> {
|
||||
:root-path="rootPath ?? descriptor.kind"
|
||||
:schema="schema"
|
||||
/>
|
||||
<p v-if="state.error" class="text-sm text-destructive" role="alert">{{ state.error }}</p>
|
||||
<p v-if="state.error" class="text-sm text-destructive" role="alert">
|
||||
{{ state.error }}
|
||||
</p>
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<div class="flex items-center gap-2">
|
||||
<Badge :variant="state.stream === 'live' ? 'ok' : 'warn'">{{ state.stream === 'live' ? 'Live' : 'Connecting' }}</Badge>
|
||||
<Badge v-if="descriptor.apply_mode === 'restart-required'" variant="warn">Restart required</Badge>
|
||||
<span v-if="state.resource" class="text-xs text-muted-foreground">Version {{ state.resource.version }}</span>
|
||||
<Badge :variant="state.stream === 'live' ? 'ok' : 'warn'">{{
|
||||
state.stream === "live" ? "Live" : "Connecting"
|
||||
}}</Badge>
|
||||
<Badge
|
||||
v-if="descriptor.apply_mode === 'restart-required'"
|
||||
variant="warn"
|
||||
>Restart required</Badge
|
||||
>
|
||||
<span v-if="state.resource" class="text-xs text-muted-foreground"
|
||||
>Version {{ state.resource.version }}</span
|
||||
>
|
||||
</div>
|
||||
<Button type="submit" :disabled="state.saving || state.loading">
|
||||
<Spinner v-if="state.saving" data-icon="inline-start" /> Save changes
|
||||
|
||||
@@ -7,7 +7,14 @@ import { Checkbox } from "@/components/ui/checkbox";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { blankFromSchema, fieldHint, fieldPlaceholder, fieldTitle, schemaAt, type SchemaProperty } from "./resource-schema";
|
||||
import {
|
||||
blankFromSchema,
|
||||
fieldHint,
|
||||
fieldPlaceholder,
|
||||
fieldTitle,
|
||||
schemaAt,
|
||||
type SchemaProperty,
|
||||
} from "./resource-schema";
|
||||
|
||||
/**
|
||||
* The document editor, driven by the value it was given and annotated by the
|
||||
@@ -20,32 +27,55 @@ import { blankFromSchema, fieldHint, fieldPlaceholder, fieldTitle, schemaAt, typ
|
||||
* descriptor with no schema, or one describing nothing, renders exactly as it
|
||||
* did before there was a reader.
|
||||
*/
|
||||
const props = withDefaults(defineProps<{
|
||||
modelValue: unknown;
|
||||
path?: string;
|
||||
rootPath?: string;
|
||||
schema?: SchemaProperty | null;
|
||||
locked?: boolean;
|
||||
}>(), { path: "value", rootPath: "", schema: null, locked: false });
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
modelValue: unknown;
|
||||
path?: string;
|
||||
rootPath?: string;
|
||||
schema?: SchemaProperty | null;
|
||||
locked?: boolean;
|
||||
}>(),
|
||||
{ path: "value", rootPath: "", schema: null, locked: false },
|
||||
);
|
||||
const emit = defineEmits<{ "update:modelValue": [value: unknown] }>();
|
||||
|
||||
const isArray = computed(() => Array.isArray(props.modelValue));
|
||||
const isObject = computed(() => props.modelValue !== null && typeof props.modelValue === "object" && !isArray.value);
|
||||
const entries = computed(() => Object.entries((props.modelValue ?? {}) as Record<string, unknown>));
|
||||
const readOnly = computed(() => props.locked || /(^|\.)(has_credential|credential_configured|headers_configured)$/.test(props.path));
|
||||
const isObject = computed(
|
||||
() =>
|
||||
props.modelValue !== null &&
|
||||
typeof props.modelValue === "object" &&
|
||||
!isArray.value,
|
||||
);
|
||||
const entries = computed(() =>
|
||||
Object.entries((props.modelValue ?? {}) as Record<string, unknown>),
|
||||
);
|
||||
const readOnly = computed(
|
||||
() =>
|
||||
props.locked ||
|
||||
/(^|\.)(has_credential|credential_configured|headers_configured)$/.test(
|
||||
props.path,
|
||||
),
|
||||
);
|
||||
|
||||
/** The schema node for this editor, and for one of its keys. */
|
||||
const property = computed(() => schemaAt(props.schema, props.path, props.rootPath));
|
||||
const property = computed(() =>
|
||||
schemaAt(props.schema, props.path, props.rootPath),
|
||||
);
|
||||
function propertyFor(key: string): SchemaProperty | null {
|
||||
return schemaAt(props.schema, `${props.path}.${key}`, props.rootPath);
|
||||
}
|
||||
|
||||
function label(value: string): string {
|
||||
return value.replaceAll("_", " ").replace(/^./, (character) => character.toUpperCase());
|
||||
return value
|
||||
.replaceAll("_", " ")
|
||||
.replace(/^./, (character) => character.toUpperCase());
|
||||
}
|
||||
|
||||
function setObject(key: string, value: unknown): void {
|
||||
emit("update:modelValue", { ...(props.modelValue as Record<string, unknown>), [key]: value });
|
||||
emit("update:modelValue", {
|
||||
...(props.modelValue as Record<string, unknown>),
|
||||
[key]: value,
|
||||
});
|
||||
}
|
||||
|
||||
function renameObject(oldKey: string, newKey: string): void {
|
||||
@@ -81,21 +111,36 @@ function setArray(index: number, value: unknown): void {
|
||||
// about fields it did not know.
|
||||
function addArray(): void {
|
||||
const current = props.modelValue as unknown[];
|
||||
emit("update:modelValue", [...current, blankFromSchema(property.value?.items)]);
|
||||
emit("update:modelValue", [
|
||||
...current,
|
||||
blankFromSchema(property.value?.items),
|
||||
]);
|
||||
}
|
||||
|
||||
function removeArray(index: number): void {
|
||||
emit("update:modelValue", (props.modelValue as unknown[]).filter((_, itemIndex) => itemIndex !== index));
|
||||
emit(
|
||||
"update:modelValue",
|
||||
(props.modelValue as unknown[]).filter(
|
||||
(_, itemIndex) => itemIndex !== index,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
function scalar(value: string | number): void {
|
||||
emit("update:modelValue", typeof props.modelValue === "number" ? Number(value) : value);
|
||||
emit(
|
||||
"update:modelValue",
|
||||
typeof props.modelValue === "number" ? Number(value) : value,
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="isArray" class="space-y-2 rounded-lg border border-border/70 p-3">
|
||||
<div v-for="(item, index) in modelValue as unknown[]" :key="index" class="flex items-start gap-2">
|
||||
<div
|
||||
v-for="(item, index) in modelValue as unknown[]"
|
||||
:key="index"
|
||||
class="flex items-start gap-2"
|
||||
>
|
||||
<div class="min-w-0 flex-1">
|
||||
<StructuredValueEditor
|
||||
:model-value="item"
|
||||
@@ -105,23 +150,59 @@ function scalar(value: string | number): void {
|
||||
@update:model-value="setArray(index, $event)"
|
||||
/>
|
||||
</div>
|
||||
<Button type="button" variant="ghost" size="icon-sm" :aria-label="`Remove ${label(path)} row ${index + 1}`" @click="removeArray(index)">
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
:aria-label="`Remove ${label(path)} row ${index + 1}`"
|
||||
@click="removeArray(index)"
|
||||
>
|
||||
<Trash2 />
|
||||
</Button>
|
||||
</div>
|
||||
<Button type="button" variant="outline" size="sm" @click="addArray"><Plus /> Add row</Button>
|
||||
<Button type="button" variant="outline" size="sm" @click="addArray"
|
||||
><Plus /> Add row</Button
|
||||
>
|
||||
</div>
|
||||
|
||||
<fieldset v-else-if="isObject" class="space-y-4 rounded-lg border border-border/70 p-3">
|
||||
<fieldset
|
||||
v-else-if="isObject"
|
||||
class="space-y-4 rounded-lg border border-border/70 p-3"
|
||||
>
|
||||
<div v-for="[key, value] in entries" :key="key" class="space-y-1.5">
|
||||
<div class="flex items-center gap-2">
|
||||
<Label :for="`${path}.${key}`" class="flex-1">{{ fieldTitle(key, propertyFor(key)) }}</Label>
|
||||
<template v-if="path.endsWith('_map') || path.endsWith('labels') || path === 'providers' || path === 'roles'">
|
||||
<Input class="h-7 max-w-48" :model-value="key" aria-label="Entry key" @change="renameObject(key, ($event.target as HTMLInputElement).value)" />
|
||||
<Button type="button" variant="ghost" size="icon-sm" :aria-label="`Remove ${key}`" @click="removeObject(key)"><Trash2 /></Button>
|
||||
<Label :for="`${path}.${key}`" class="flex-1">{{
|
||||
fieldTitle(key, propertyFor(key))
|
||||
}}</Label>
|
||||
<template
|
||||
v-if="
|
||||
path.endsWith('_map') ||
|
||||
path.endsWith('labels') ||
|
||||
path === 'providers' ||
|
||||
path === 'roles'
|
||||
"
|
||||
>
|
||||
<Input
|
||||
class="h-7 max-w-48"
|
||||
:model-value="key"
|
||||
aria-label="Entry key"
|
||||
@change="
|
||||
renameObject(key, ($event.target as HTMLInputElement).value)
|
||||
"
|
||||
/>
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
:aria-label="`Remove ${key}`"
|
||||
@click="removeObject(key)"
|
||||
><Trash2
|
||||
/></Button>
|
||||
</template>
|
||||
</div>
|
||||
<p v-if="fieldHint(propertyFor(key))" class="text-xs text-fg-subtle">{{ fieldHint(propertyFor(key)) }}</p>
|
||||
<p v-if="fieldHint(propertyFor(key))" class="text-xs text-fg-subtle">
|
||||
{{ fieldHint(propertyFor(key)) }}
|
||||
</p>
|
||||
<StructuredValueEditor
|
||||
:id="`${path}.${key}`"
|
||||
:model-value="value"
|
||||
@@ -131,14 +212,43 @@ function scalar(value: string | number): void {
|
||||
@update:model-value="setObject(key, $event)"
|
||||
/>
|
||||
</div>
|
||||
<Button v-if="path.endsWith('_map') || path.endsWith('labels') || path === 'providers' || path === 'roles'" type="button" variant="outline" size="sm" @click="addObject"><Plus /> Add entry</Button>
|
||||
<Button
|
||||
v-if="
|
||||
path.endsWith('_map') ||
|
||||
path.endsWith('labels') ||
|
||||
path === 'providers' ||
|
||||
path === 'roles'
|
||||
"
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
@click="addObject"
|
||||
><Plus /> Add entry</Button
|
||||
>
|
||||
</fieldset>
|
||||
|
||||
<div v-else-if="typeof modelValue === 'boolean'" class="flex min-h-9 items-center gap-2">
|
||||
<Checkbox :id="path" :model-value="modelValue" :disabled="readOnly" @update:model-value="emit('update:modelValue', $event === true)" />
|
||||
<span v-if="readOnly" class="text-xs text-muted-foreground">Reported by Archie</span>
|
||||
<div
|
||||
v-else-if="typeof modelValue === 'boolean'"
|
||||
class="flex min-h-9 items-center gap-2"
|
||||
>
|
||||
<Checkbox
|
||||
:id="path"
|
||||
:model-value="modelValue"
|
||||
:disabled="readOnly"
|
||||
@update:model-value="emit('update:modelValue', $event === true)"
|
||||
/>
|
||||
<span v-if="readOnly" class="text-xs text-muted-foreground"
|
||||
>Reported by Archie</span
|
||||
>
|
||||
</div>
|
||||
<Textarea v-else-if="path.endsWith('.prompt')" :id="path" :model-value="modelValue as string" :readonly="readOnly" autocomplete="off" @update:model-value="scalar" />
|
||||
<Textarea
|
||||
v-else-if="path.endsWith('.prompt')"
|
||||
:id="path"
|
||||
:model-value="modelValue as string"
|
||||
:readonly="readOnly"
|
||||
autocomplete="off"
|
||||
@update:model-value="scalar"
|
||||
/>
|
||||
<div v-else class="space-y-1">
|
||||
<Input
|
||||
:id="path"
|
||||
@@ -149,6 +259,8 @@ function scalar(value: string | number): void {
|
||||
autocomplete="off"
|
||||
@update:model-value="scalar"
|
||||
/>
|
||||
<p v-if="fieldHint(property)" class="text-xs text-fg-subtle">{{ fieldHint(property) }}</p>
|
||||
<p v-if="fieldHint(property)" class="text-xs text-fg-subtle">
|
||||
{{ fieldHint(property) }}
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
@@ -24,13 +24,31 @@ onMounted(load);
|
||||
<div>
|
||||
<PageHeader title="Advanced" />
|
||||
|
||||
<p v-if="catalogError" class="text-sm text-destructive" role="alert">{{ catalogError }}</p>
|
||||
<StructuredResourceCard v-for="descriptor in resources" :key="descriptor.kind" :descriptor="descriptor" />
|
||||
<p v-if="catalogError" class="text-sm text-destructive" role="alert">
|
||||
{{ catalogError }}
|
||||
</p>
|
||||
<StructuredResourceCard
|
||||
v-for="descriptor in resources"
|
||||
:key="descriptor.kind"
|
||||
:descriptor="descriptor"
|
||||
/>
|
||||
<ConfigCard title="Managed elsewhere">
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<Button as-child variant="outline"><RouterLink :to="'/events?tab=inspector'">Captured events</RouterLink></Button>
|
||||
<Button as-child variant="outline"><RouterLink :to="'/events?tab=mappings'">Capture mappings</RouterLink></Button>
|
||||
<Button as-child variant="outline"><RouterLink :to="'/events?tab=bindings'">Capture bindings</RouterLink></Button>
|
||||
<Button as-child variant="outline"
|
||||
><RouterLink :to="'/events?tab=inspector'"
|
||||
>Captured events</RouterLink
|
||||
></Button
|
||||
>
|
||||
<Button as-child variant="outline"
|
||||
><RouterLink :to="'/events?tab=mappings'"
|
||||
>Capture mappings</RouterLink
|
||||
></Button
|
||||
>
|
||||
<Button as-child variant="outline"
|
||||
><RouterLink :to="'/events?tab=bindings'"
|
||||
>Capture bindings</RouterLink
|
||||
></Button
|
||||
>
|
||||
</div>
|
||||
</ConfigCard>
|
||||
<DangerousActionsCard />
|
||||
|
||||
@@ -24,11 +24,13 @@ const { setDensity, setMotion, setTheme, setTooltips } = appearance;
|
||||
* of making the operator scan opposite edges of several full-width cards.
|
||||
*/
|
||||
function chooseTheme(value: unknown): void {
|
||||
if (value === "system" || value === "light" || value === "dark") setTheme(value as Theme);
|
||||
if (value === "system" || value === "light" || value === "dark")
|
||||
setTheme(value as Theme);
|
||||
}
|
||||
|
||||
function chooseDensity(value: unknown): void {
|
||||
if (value === "comfortable" || value === "compact") setDensity(value as Density);
|
||||
if (value === "comfortable" || value === "compact")
|
||||
setDensity(value as Density);
|
||||
}
|
||||
|
||||
function chooseMotion(value: unknown): void {
|
||||
@@ -40,12 +42,17 @@ function chooseMotion(value: unknown): void {
|
||||
<div>
|
||||
<PageHeader title="Appearance" />
|
||||
|
||||
<ConfigCard title="Dashboard preferences" description="Saved only in this browser and applied immediately.">
|
||||
<ConfigCard
|
||||
title="Dashboard preferences"
|
||||
description="Saved only in this browser and applied immediately."
|
||||
>
|
||||
<div class="grid gap-8 min-[700px]:grid-cols-2 min-[1100px]:grid-cols-4">
|
||||
<section class="flex min-w-0 flex-col items-start">
|
||||
<div>
|
||||
<h2 id="appearance-theme" class="text-sm font-medium">Theme</h2>
|
||||
<p class="mt-1 text-sm text-muted-foreground">Follow your device, or keep Archie light or dark.</p>
|
||||
<p class="mt-1 text-sm text-muted-foreground">
|
||||
Follow your device, or keep Archie light or dark.
|
||||
</p>
|
||||
</div>
|
||||
<ToggleGroup
|
||||
type="single"
|
||||
@@ -64,7 +71,9 @@ function chooseMotion(value: unknown): void {
|
||||
<section class="flex min-w-0 flex-col items-start">
|
||||
<div>
|
||||
<h2 id="appearance-density" class="text-sm font-medium">Density</h2>
|
||||
<p class="mt-1 text-sm text-muted-foreground">Use relaxed spacing, or fit more work on screen.</p>
|
||||
<p class="mt-1 text-sm text-muted-foreground">
|
||||
Use relaxed spacing, or fit more work on screen.
|
||||
</p>
|
||||
</div>
|
||||
<ToggleGroup
|
||||
type="single"
|
||||
@@ -82,7 +91,9 @@ function chooseMotion(value: unknown): void {
|
||||
<section class="flex min-w-0 flex-col items-start">
|
||||
<div>
|
||||
<h2 id="appearance-motion" class="text-sm font-medium">Motion</h2>
|
||||
<p class="mt-1 text-sm text-muted-foreground">Follow your device, or reduce interface animation here.</p>
|
||||
<p class="mt-1 text-sm text-muted-foreground">
|
||||
Follow your device, or reduce interface animation here.
|
||||
</p>
|
||||
</div>
|
||||
<ToggleGroup
|
||||
type="single"
|
||||
@@ -99,8 +110,12 @@ function chooseMotion(value: unknown): void {
|
||||
|
||||
<section class="flex min-w-0 flex-col items-start">
|
||||
<div>
|
||||
<h2 id="appearance-tooltips" class="text-sm font-medium">Tooltips</h2>
|
||||
<p class="mt-1 text-sm text-muted-foreground">Show extra context when controls are hovered or focused.</p>
|
||||
<h2 id="appearance-tooltips" class="text-sm font-medium">
|
||||
Tooltips
|
||||
</h2>
|
||||
<p class="mt-1 text-sm text-muted-foreground">
|
||||
Show extra context when controls are hovered or focused.
|
||||
</p>
|
||||
</div>
|
||||
<Switch
|
||||
:model-value="tooltipsEnabled"
|
||||
|
||||
@@ -8,9 +8,18 @@ const name = ref("");
|
||||
const kind = ref<Identity["kind"]>("bot");
|
||||
store.watch();
|
||||
|
||||
async function create(): Promise<void> { if (await store.create(name.value, kind.value)) name.value = ""; }
|
||||
async function rename(value: Identity): Promise<void> { const next = window.prompt("Display name", value.display_name); if (next && next !== value.display_name) await store.command(value, "rename", next); }
|
||||
async function retire(value: Identity): Promise<void> { if (window.confirm(`Retire ${value.display_name}? This cannot be undone.`)) await store.command(value, "retire"); }
|
||||
async function create(): Promise<void> {
|
||||
if (await store.create(name.value, kind.value)) name.value = "";
|
||||
}
|
||||
async function rename(value: Identity): Promise<void> {
|
||||
const next = window.prompt("Display name", value.display_name);
|
||||
if (next && next !== value.display_name)
|
||||
await store.command(value, "rename", next);
|
||||
}
|
||||
async function retire(value: Identity): Promise<void> {
|
||||
if (window.confirm(`Retire ${value.display_name}? This cannot be undone.`))
|
||||
await store.command(value, "retire");
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -18,18 +27,59 @@ async function retire(value: Identity): Promise<void> { if (window.confirm(`Reti
|
||||
<PageHeader title="Identities" />
|
||||
<p v-if="store.error" role="alert" class="error">{{ store.error }}</p>
|
||||
<form class="identity-create" @submit.prevent="create">
|
||||
<input v-model.trim="name" required aria-label="Display name" placeholder="Display name">
|
||||
<select v-model="kind" aria-label="Kind"><option value="bot">Bot</option><option value="service_account">Service account</option><option value="user">User</option></select>
|
||||
<input
|
||||
v-model.trim="name"
|
||||
required
|
||||
aria-label="Display name"
|
||||
placeholder="Display name"
|
||||
/>
|
||||
<select v-model="kind" aria-label="Kind">
|
||||
<option value="bot">Bot</option>
|
||||
<option value="service_account">Service account</option>
|
||||
<option value="user">User</option>
|
||||
</select>
|
||||
<button type="submit" :disabled="!name || !!store.busy">Create</button>
|
||||
</form>
|
||||
<section aria-label="Identity list" class="identity-list">
|
||||
<article v-for="value in store.identities" :key="value.id" class="identity-row">
|
||||
<div><strong>{{ value.display_name }}</strong><span>{{ value.kind.replace('_', ' ') }} · {{ value.lifecycle }}</span></div>
|
||||
<article
|
||||
v-for="value in store.identities"
|
||||
:key="value.id"
|
||||
class="identity-row"
|
||||
>
|
||||
<div>
|
||||
<strong>{{ value.display_name }}</strong
|
||||
><span
|
||||
>{{ value.kind.replace("_", " ") }} · {{ value.lifecycle }}</span
|
||||
>
|
||||
</div>
|
||||
<div v-if="value.kind !== 'system'" class="actions">
|
||||
<button :disabled="!!store.busy || value.lifecycle === 'retired'" @click="rename(value)">Rename</button>
|
||||
<button v-if="value.lifecycle === 'active'" :disabled="!!store.busy" @click="store.command(value, 'suspend')">Suspend</button>
|
||||
<button v-if="value.lifecycle === 'suspended'" :disabled="!!store.busy" @click="store.command(value, 'reactivate')">Reactivate</button>
|
||||
<button class="danger" :disabled="!!store.busy || value.lifecycle === 'retired'" @click="retire(value)">Retire</button>
|
||||
<button
|
||||
:disabled="!!store.busy || value.lifecycle === 'retired'"
|
||||
@click="rename(value)"
|
||||
>
|
||||
Rename
|
||||
</button>
|
||||
<button
|
||||
v-if="value.lifecycle === 'active'"
|
||||
:disabled="!!store.busy"
|
||||
@click="store.command(value, 'suspend')"
|
||||
>
|
||||
Suspend
|
||||
</button>
|
||||
<button
|
||||
v-if="value.lifecycle === 'suspended'"
|
||||
:disabled="!!store.busy"
|
||||
@click="store.command(value, 'reactivate')"
|
||||
>
|
||||
Reactivate
|
||||
</button>
|
||||
<button
|
||||
class="danger"
|
||||
:disabled="!!store.busy || value.lifecycle === 'retired'"
|
||||
@click="retire(value)"
|
||||
>
|
||||
Retire
|
||||
</button>
|
||||
</div>
|
||||
</article>
|
||||
</section>
|
||||
@@ -37,5 +87,53 @@ async function retire(value: Identity): Promise<void> { if (window.confirm(`Reti
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.identities-page{max-width:960px}.identity-create{display:flex;gap:.75rem;margin:1.5rem 0}.identity-create input{flex:1}.identity-create input,.identity-create select,.identity-create button,.actions button{border:1px solid var(--border);border-radius:.5rem;background:var(--surface);color:inherit;padding:.6rem .8rem}.identity-list{border-top:1px solid var(--border)}.identity-row{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:1rem 0;border-bottom:1px solid var(--border)}.identity-row span{display:block;color:var(--muted-foreground);font-size:.85rem;margin-top:.2rem;text-transform:capitalize}.actions{display:flex;gap:.5rem}.actions .danger{color:var(--destructive)}.error{color:var(--destructive)}
|
||||
.identities-page {
|
||||
max-width: 960px;
|
||||
}
|
||||
.identity-create {
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
margin: 1.5rem 0;
|
||||
}
|
||||
.identity-create input {
|
||||
flex: 1;
|
||||
}
|
||||
.identity-create input,
|
||||
.identity-create select,
|
||||
.identity-create button,
|
||||
.actions button {
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 0.5rem;
|
||||
background: var(--surface);
|
||||
color: inherit;
|
||||
padding: 0.6rem 0.8rem;
|
||||
}
|
||||
.identity-list {
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
.identity-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 1rem;
|
||||
padding: 1rem 0;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
.identity-row span {
|
||||
display: block;
|
||||
color: var(--muted-foreground);
|
||||
font-size: 0.85rem;
|
||||
margin-top: 0.2rem;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
.actions {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
.actions .danger {
|
||||
color: var(--destructive);
|
||||
}
|
||||
.error {
|
||||
color: var(--destructive);
|
||||
}
|
||||
</style>
|
||||
@@ -16,12 +16,16 @@ onMounted(controlPlane.load);
|
||||
<div>
|
||||
<PageHeader title="Models" />
|
||||
|
||||
<p v-if="catalogError" class="text-sm text-destructive" role="alert">{{ catalogError }}</p>
|
||||
<p v-if="catalogError" class="text-sm text-destructive" role="alert">
|
||||
{{ catalogError }}
|
||||
</p>
|
||||
<StructuredResourceCard
|
||||
v-for="descriptor in resources"
|
||||
:key="descriptor.kind"
|
||||
:descriptor="descriptor"
|
||||
:root-path="descriptor.kind === 'provider-settings' ? 'providers' : 'roles'"
|
||||
:root-path="
|
||||
descriptor.kind === 'provider-settings' ? 'providers' : 'roles'
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -8,7 +8,9 @@ import StructuredResourceCard from "./StructuredResourceCard.vue";
|
||||
|
||||
const controlPlane = useControlPlaneStore();
|
||||
const { catalog, catalogError } = storeToRefs(controlPlane);
|
||||
const resources = computed(() => resourcesForPage(catalog.value, "repositories"));
|
||||
const resources = computed(() =>
|
||||
resourcesForPage(catalog.value, "repositories"),
|
||||
);
|
||||
onMounted(controlPlane.load);
|
||||
</script>
|
||||
|
||||
@@ -16,7 +18,14 @@ onMounted(controlPlane.load);
|
||||
<div>
|
||||
<PageHeader title="Repositories" />
|
||||
|
||||
<p v-if="catalogError" class="text-sm text-destructive" role="alert">{{ catalogError }}</p>
|
||||
<StructuredResourceCard v-for="descriptor in resources" :key="descriptor.kind" :descriptor="descriptor" root-path="repositories" />
|
||||
<p v-if="catalogError" class="text-sm text-destructive" role="alert">
|
||||
{{ catalogError }}
|
||||
</p>
|
||||
<StructuredResourceCard
|
||||
v-for="descriptor in resources"
|
||||
:key="descriptor.kind"
|
||||
:descriptor="descriptor"
|
||||
root-path="repositories"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -17,7 +17,9 @@ onMounted(controlPlane.load);
|
||||
<div>
|
||||
<PageHeader title="Task settings" />
|
||||
|
||||
<p v-if="catalogError" class="text-sm text-destructive" role="alert">{{ catalogError }}</p>
|
||||
<p v-if="catalogError" class="text-sm text-destructive" role="alert">
|
||||
{{ catalogError }}
|
||||
</p>
|
||||
<StructuredResourceCard
|
||||
v-for="descriptor in resources"
|
||||
:key="descriptor.kind"
|
||||
|
||||
@@ -58,9 +58,14 @@ const installProgress = ref<string[]>([]);
|
||||
const installResult = ref<string | null>(null);
|
||||
const installError = ref<string | null>(null);
|
||||
|
||||
const updateable = computed(() => components.value.filter((c) => c.status === "update_available"));
|
||||
const updateable = computed(() =>
|
||||
components.value.filter((c) => c.status === "update_available"),
|
||||
);
|
||||
|
||||
const statusKind: Record<ComponentVersion["status"], "ok" | "warn" | "danger" | "idle"> = {
|
||||
const statusKind: Record<
|
||||
ComponentVersion["status"],
|
||||
"ok" | "warn" | "danger" | "idle"
|
||||
> = {
|
||||
ok: "ok",
|
||||
update_available: "warn",
|
||||
drift: "danger",
|
||||
@@ -80,13 +85,15 @@ async function load(): Promise<void> {
|
||||
try {
|
||||
const [report, update] = await Promise.all([
|
||||
api.version<{ components: ComponentVersion[] }>(),
|
||||
api.updateSnapshot<{ snapshot: UpdateSnapshot; can_install: boolean }>().catch((err) => {
|
||||
if (err instanceof ApiError && err.status === 501) {
|
||||
notConfigured.value = true;
|
||||
return null;
|
||||
}
|
||||
throw err;
|
||||
}),
|
||||
api
|
||||
.updateSnapshot<{ snapshot: UpdateSnapshot; can_install: boolean }>()
|
||||
.catch((err) => {
|
||||
if (err instanceof ApiError && err.status === 501) {
|
||||
notConfigured.value = true;
|
||||
return null;
|
||||
}
|
||||
throw err;
|
||||
}),
|
||||
]);
|
||||
components.value = report.components;
|
||||
if (update) {
|
||||
@@ -104,7 +111,11 @@ async function load(): Promise<void> {
|
||||
// the endpoint re-checks freshness and answers 409 when releases moved.
|
||||
function installableSnapshot(): UpdateSnapshot | null {
|
||||
if (!snapshot.value) return null;
|
||||
if (snapshot.value.components?.some((c) => c.available && c.available !== c.installed)) {
|
||||
if (
|
||||
snapshot.value.components?.some(
|
||||
(c) => c.available && c.available !== c.installed,
|
||||
)
|
||||
) {
|
||||
return snapshot.value;
|
||||
}
|
||||
return null;
|
||||
@@ -118,7 +129,10 @@ async function install(): Promise<void> {
|
||||
installProgress.value = [];
|
||||
installResult.value = null;
|
||||
try {
|
||||
const result = await api.updateInstall<{ progress?: string[]; result?: { installed?: Record<string, string> } }>(snap);
|
||||
const result = await api.updateInstall<{
|
||||
progress?: string[];
|
||||
result?: { installed?: Record<string, string> };
|
||||
}>(snap);
|
||||
installProgress.value = result.progress ?? [];
|
||||
const installed = result.result?.installed;
|
||||
installResult.value = installed
|
||||
@@ -138,7 +152,9 @@ onMounted(load);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<p v-if="notConfigured" class="text-sm text-fg-muted">Update checks not configured.</p>
|
||||
<p v-if="notConfigured" class="text-sm text-fg-muted">
|
||||
Update checks not configured.
|
||||
</p>
|
||||
<Card v-else>
|
||||
<CardHeader>
|
||||
<CardTitle>Versions</CardTitle>
|
||||
@@ -158,31 +174,54 @@ onMounted(load);
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
<TableRow v-for="component in components" :key="component.id">
|
||||
<TableCell class="font-medium">{{ component.label || component.id }}</TableCell>
|
||||
<TableCell class="font-mono text-fg-muted">{{ component.running_version || component.installed_claim || "—" }}</TableCell>
|
||||
<TableCell class="font-mono text-fg-muted">{{ component.latest_available || "—" }}</TableCell>
|
||||
<TableCell class="font-medium">{{
|
||||
component.label || component.id
|
||||
}}</TableCell>
|
||||
<TableCell class="font-mono text-fg-muted">{{
|
||||
component.running_version || component.installed_claim || "—"
|
||||
}}</TableCell>
|
||||
<TableCell class="font-mono text-fg-muted">{{
|
||||
component.latest_available || "—"
|
||||
}}</TableCell>
|
||||
<TableCell>
|
||||
<Badge :variant="statusKind[component.status]">{{ statusLabel[component.status] }}</Badge>
|
||||
<Badge :variant="statusKind[component.status]">{{
|
||||
statusLabel[component.status]
|
||||
}}</Badge>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
|
||||
<div v-if="canInstall && updateable.length" class="mt-4 flex flex-col gap-2">
|
||||
<div
|
||||
v-if="canInstall && updateable.length"
|
||||
class="mt-4 flex flex-col gap-2"
|
||||
>
|
||||
<Button :disabled="installing" @click="install">
|
||||
{{ installing ? "Installing…" : `Install ${updateable.map((c) => c.label || c.id).join(", ")}` }}
|
||||
{{
|
||||
installing
|
||||
? "Installing…"
|
||||
: `Install ${updateable.map((c) => c.label || c.id).join(", ")}`
|
||||
}}
|
||||
</Button>
|
||||
<p v-if="installing" class="text-xs text-fg-muted">
|
||||
The build runs on this host and the restart is verified out of band; the page can be left.
|
||||
The build runs on this host and the restart is verified out of band;
|
||||
the page can be left.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div v-if="installProgress.length" class="mt-3 rounded-sm border border-border bg-muted p-3 font-mono text-xs">
|
||||
<div
|
||||
v-if="installProgress.length"
|
||||
class="mt-3 rounded-sm border border-border bg-muted p-3 font-mono text-xs"
|
||||
>
|
||||
<p v-for="(line, i) in installProgress" :key="i">{{ line }}</p>
|
||||
</div>
|
||||
<p v-if="installResult" class="mt-2 text-sm text-ok">{{ installResult }}</p>
|
||||
<p v-if="installError" class="mt-2 text-sm text-danger">{{ installError }}</p>
|
||||
<p v-if="installResult" class="mt-2 text-sm text-ok">
|
||||
{{ installResult }}
|
||||
</p>
|
||||
<p v-if="installError" class="mt-2 text-sm text-danger">
|
||||
{{ installError }}
|
||||
</p>
|
||||
</template>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</template>
|
||||
</template>
|
||||
@@ -4,4 +4,3 @@ export function valueText(value: unknown): string {
|
||||
if (value === null || value === undefined || value === "") return "—";
|
||||
return String(value);
|
||||
}
|
||||
|
||||
@@ -29,11 +29,14 @@ export interface SchemaProperty {
|
||||
* or carries one this reader cannot parse, reports null: an unreadable schema
|
||||
* costs a placeholder, never a field.
|
||||
*/
|
||||
export function parseSchema(json: string | null | undefined): SchemaProperty | null {
|
||||
export function parseSchema(
|
||||
json: string | null | undefined,
|
||||
): SchemaProperty | null {
|
||||
if (!json) return null;
|
||||
try {
|
||||
const parsed: unknown = JSON.parse(json);
|
||||
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
||||
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
|
||||
return null;
|
||||
return parsed as SchemaProperty;
|
||||
} catch {
|
||||
return null;
|
||||
@@ -41,7 +44,11 @@ export function parseSchema(json: string | null | undefined): SchemaProperty | n
|
||||
}
|
||||
|
||||
function isKeyed(property: SchemaProperty): boolean {
|
||||
return property.type === "object" && !property.properties && typeof property.additionalProperties === "object";
|
||||
return (
|
||||
property.type === "object" &&
|
||||
!property.properties &&
|
||||
typeof property.additionalProperties === "object"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,7 +67,10 @@ export function schemaAt(
|
||||
if (!schema) return null;
|
||||
const root = rootPath.split(".").filter(Boolean);
|
||||
let segments = path.split(".").filter(Boolean);
|
||||
if (root.length && root.every((segment, index) => segments[index] === segment)) {
|
||||
if (
|
||||
root.length &&
|
||||
root.every((segment, index) => segments[index] === segment)
|
||||
) {
|
||||
segments = segments.slice(root.length);
|
||||
}
|
||||
|
||||
@@ -78,16 +88,24 @@ export function schemaAt(
|
||||
}
|
||||
// A keyed collection's keys belong to the operator, so the value's
|
||||
// schema describes whatever key they typed.
|
||||
current = typeof current.additionalProperties === "object" ? current.additionalProperties : null;
|
||||
current =
|
||||
typeof current.additionalProperties === "object"
|
||||
? current.additionalProperties
|
||||
: null;
|
||||
}
|
||||
return current;
|
||||
}
|
||||
|
||||
/** fieldTitle is the schema's own label for a key, or the dashed-key fallback
|
||||
* the editor has always used. */
|
||||
export function fieldTitle(key: string, property: SchemaProperty | null | undefined): string {
|
||||
export function fieldTitle(
|
||||
key: string,
|
||||
property: SchemaProperty | null | undefined,
|
||||
): string {
|
||||
if (property?.title) return property.title;
|
||||
return key.replaceAll("_", " ").replace(/^./, (character) => character.toUpperCase());
|
||||
return key
|
||||
.replaceAll("_", " ")
|
||||
.replace(/^./, (character) => character.toUpperCase());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,7 +113,9 @@ export function fieldTitle(key: string, property: SchemaProperty | null | undefi
|
||||
* the field's value must match. A duration column is a string to the document
|
||||
* and a duration to the operator, and the example is what says so.
|
||||
*/
|
||||
export function fieldPlaceholder(property: SchemaProperty | null | undefined): string | undefined {
|
||||
export function fieldPlaceholder(
|
||||
property: SchemaProperty | null | undefined,
|
||||
): string | undefined {
|
||||
if (property?.format === "duration") return "1m0s";
|
||||
if (property?.format === "date-time") return "2026-01-01T00:00:00Z";
|
||||
return undefined;
|
||||
@@ -108,7 +128,9 @@ export function fieldHint(property: SchemaProperty | null | undefined): string {
|
||||
|
||||
/** isKeyedCollection reports a document whose keys are the operator's: a map
|
||||
* with no fixed properties, which the schema marks with additionalProperties. */
|
||||
export function isKeyedCollection(property: SchemaProperty | null | undefined): boolean {
|
||||
export function isKeyedCollection(
|
||||
property: SchemaProperty | null | undefined,
|
||||
): boolean {
|
||||
return Boolean(property) && isKeyed(property as SchemaProperty);
|
||||
}
|
||||
|
||||
@@ -124,7 +146,9 @@ export function isKeyedCollection(property: SchemaProperty | null | undefined):
|
||||
* a schema that wants those emits a default, which is the same single source of
|
||||
* truth this reader exists to honour.
|
||||
*/
|
||||
export function blankFromSchema(property: SchemaProperty | null | undefined): unknown {
|
||||
export function blankFromSchema(
|
||||
property: SchemaProperty | null | undefined,
|
||||
): unknown {
|
||||
if (!property) return "";
|
||||
if (property.type === "object") {
|
||||
const blank: Record<string, unknown> = {};
|
||||
|
||||
@@ -20,6 +20,11 @@ export function sectionRows(section: ConfigSection): ConfigField[] {
|
||||
}
|
||||
|
||||
/** sectionsFor returns the sections this page renders, in catalog order. */
|
||||
export function sectionsFor(schema: ConfigSection[] | undefined, ids: string[]): ConfigSection[] {
|
||||
return (schema ?? []).filter((s) => ids.includes(s.id) && sectionRows(s).length > 0);
|
||||
export function sectionsFor(
|
||||
schema: ConfigSection[] | undefined,
|
||||
ids: string[],
|
||||
): ConfigSection[] {
|
||||
return (schema ?? []).filter(
|
||||
(s) => ids.includes(s.id) && sectionRows(s).length > 0,
|
||||
);
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
import { computed, ref } from "vue";
|
||||
|
||||
import { ApiError, api } from "@/lib/api";
|
||||
import type {
|
||||
ConfigView,
|
||||
DangerousActions,
|
||||
} from "./types";
|
||||
import type { ConfigView, DangerousActions } from "./types";
|
||||
|
||||
/**
|
||||
* The System pages' shared state.
|
||||
@@ -32,11 +29,11 @@ function isMissing(err: unknown): boolean {
|
||||
export const config = ref<ConfigView | null>(null);
|
||||
export const configError = ref<string | null>(null);
|
||||
|
||||
|
||||
/** Nothing to render: either the read failed, or archied is running without a
|
||||
* config file wired into the dashboard. */
|
||||
export const configUnavailable = computed(
|
||||
() => Boolean(configError.value) || Object.keys(config.value ?? {}).length === 0,
|
||||
() =>
|
||||
Boolean(configError.value) || Object.keys(config.value ?? {}).length === 0,
|
||||
);
|
||||
|
||||
export async function loadConfig(): Promise<void> {
|
||||
@@ -60,12 +57,18 @@ export async function loadDangerous(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
export async function requestDangerous(kind: string, spec: unknown): Promise<void> {
|
||||
export async function requestDangerous(
|
||||
kind: string,
|
||||
spec: unknown,
|
||||
): Promise<void> {
|
||||
await api.chatDangerousRequest(kind, spec);
|
||||
await loadDangerous();
|
||||
}
|
||||
|
||||
export async function decideDangerous(id: string, decision: string): Promise<void> {
|
||||
export async function decideDangerous(
|
||||
id: string,
|
||||
decision: string,
|
||||
): Promise<void> {
|
||||
await api.chatDangerousDecision(id, decision);
|
||||
await loadDangerous();
|
||||
}
|
||||
@@ -11,7 +11,8 @@
|
||||
/** How the generic renderer decides what control a field gets. A structured
|
||||
* field (repositories, models, providers) is owned by its own editor and
|
||||
* never appears in a generic row. */
|
||||
export type ConfigFieldType = "string" | "int" | "bool" | "duration" | "enum" | "structured";
|
||||
export type ConfigFieldType =
|
||||
"string" | "int" | "bool" | "duration" | "enum" | "structured";
|
||||
|
||||
export interface ConfigField {
|
||||
/** The dotted path this value lives at in the running config. */
|
||||
|
||||
Reference in new issue
Block a user