feat(controlplane): runtime administration over the State Store's gRPC server
The Web UI and messaging channels now read and write Archie's runtime settings through one versioned, audited control-plane API hosted on the State Store's existing gRPC server: catalog, query, command, watch. Each feature owns its resource, validation and commands; storage only writes versions and audit records. Workflows move with it. Definitions become portable YAML compiled through a closed, typed step registry and stored as a control-plane resource, so the yaegi interpretation paths (internal/gate, wfeval, wfextract, gateeval, gateextract, skillbuild) are deleted rather than carried. The UI process reads definitions as data: the JSON projection lives in internal/domain/workflow/task so a dashboard decodes the stored collection without linking the workflow engine, which cmd/archie-ui's deletion gate forbids. Shipped definitions ride the catalog descriptor rather than a bespoke REST route, keeping the API to its four operations. archie-messaging gains -state-store-target/-state-store-token and reads channel settings from the database, failing closed when the State Store is unreachable: the database is authoritative for those settings.
This commit is contained in:
131 files changed
+8510
-3371
No files matched your search
@@ -12,20 +12,13 @@ export interface Channel {
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { RefreshCw } from "@lucide/vue";
|
||||
import { computed, ref } from "vue";
|
||||
import { computed } from "vue";
|
||||
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import type { StatusKind } from "@/lib/status";
|
||||
|
||||
const props = defineProps<{ channel: Channel }>();
|
||||
const emit = defineEmits<{ reload: [id: string] }>();
|
||||
|
||||
// In-flight state rather than mutating the button's disabled attribute: the
|
||||
// element is re-rendered by Vue, so a DOM write would be discarded.
|
||||
const reloading = ref(false);
|
||||
|
||||
function tone(state: string | undefined, configured: boolean | undefined): StatusKind {
|
||||
if (state === "running") return "ok";
|
||||
@@ -34,15 +27,6 @@ function tone(state: string | undefined, configured: boolean | undefined): Statu
|
||||
}
|
||||
|
||||
const label = computed(() => props.channel.state || (props.channel.configured ? "configured" : "stopped"));
|
||||
|
||||
async function reload() {
|
||||
reloading.value = true;
|
||||
try {
|
||||
emit("reload", props.channel.id || props.channel.name.toLowerCase());
|
||||
} finally {
|
||||
reloading.value = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -53,12 +37,7 @@ async function reload() {
|
||||
<Badge :variant="tone(props.channel.state, props.channel.configured)">{{ label }}</Badge>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p v-if="props.channel.detail" class="mb-3 text-sm text-fg-muted">{{ props.channel.detail }}</p>
|
||||
<Button v-if="props.channel.reload_supported" variant="outline" :disabled="reloading" @click="reload">
|
||||
<RefreshCw data-icon="inline-start" />
|
||||
Reload
|
||||
</Button>
|
||||
<p v-else class="text-sm text-fg-subtle">Reload requires a daemon restart for this adapter.</p>
|
||||
<p v-if="props.channel.detail" class="text-sm text-fg-muted">{{ props.channel.detail }}</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</template>
|
||||
@@ -1,9 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from "vue";
|
||||
import { computed, onMounted, ref } from "vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import { api } from "@/lib/api";
|
||||
import StructuredResourceCard from "@/settings/StructuredResourceCard.vue";
|
||||
import { resourcesForPage, useControlPlaneStore } from "@/stores/control-plane";
|
||||
import { useLiveResource } from "@/stores/live-updates";
|
||||
import ChannelCard, { type Channel } from "./ChannelCard.vue";
|
||||
|
||||
@@ -11,6 +14,9 @@ import ChannelCard, { type Channel } from "./ChannelCard.vue";
|
||||
|
||||
const channels = ref<Channel[]>([]);
|
||||
const error = ref<string | null>(null);
|
||||
const controlPlane = useControlPlaneStore();
|
||||
const { catalog } = storeToRefs(controlPlane);
|
||||
const settings = computed(() => resourcesForPage(catalog.value, "channels"));
|
||||
|
||||
async function load() {
|
||||
try {
|
||||
@@ -22,19 +28,8 @@ async function load() {
|
||||
}
|
||||
}
|
||||
|
||||
/** Reload, then re-read: the adapter's new state is what the card shows, so a
|
||||
* failed reload surfaces as the state it failed to leave. */
|
||||
async function reload(id: string) {
|
||||
try {
|
||||
await api.channelReload(id);
|
||||
} catch {
|
||||
// Reported by the refreshed state below.
|
||||
}
|
||||
await load();
|
||||
}
|
||||
|
||||
useLiveResource(null, () => void load());
|
||||
onMounted(load);
|
||||
onMounted(() => Promise.all([load(), controlPlane.load()]));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -51,12 +46,11 @@ onMounted(load);
|
||||
<Empty v-else-if="!channels.length">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No channels configured</EmptyTitle>
|
||||
<EmptyDescription>
|
||||
Configure [chat.telegram] or [chat.webhook_addr] in config.toml to talk to Archie outside the dashboard.
|
||||
</EmptyDescription>
|
||||
<EmptyDescription>Add one below.</EmptyDescription>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
<ChannelCard v-for="channel in channels" v-else :key="channel.id || channel.name" :channel="channel" @reload="reload" />
|
||||
<ChannelCard v-for="channel in channels" v-else :key="channel.id || channel.name" :channel="channel" />
|
||||
</div>
|
||||
<StructuredResourceCard v-for="descriptor in settings" :key="descriptor.kind" :descriptor="descriptor" />
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user