* feat(state): durable operator alerts owned by the State Store Alerts dedup on org+kind+subject, resolve themselves when a condition clears, and are raised, resolved, dismissed and listed through the state contract. Task transitions raise needs-human and failed alerts in the same transaction; the store checks service health and prunes closed alerts. Each raise and resolve queues a webhook delivery whose attempts are kept. * feat(notify): deliver operator alerts to the webhook; raise config and release alerts notify.webhook now receives raised and resolved alerts above a severity threshold with HMAC-signed payloads, bounded retry and every attempt recorded on the alert. archied raises model alias, provider and credential-binding alerts from the effective configuration, an update alert from the release channel, and a credential-rejected alert from the egress resolver. The dashboard API lists and dismisses the caller's org's alerts. * feat(ui): alert bell in the top bar and webhook alert settings The bell lists the org's open alerts by severity with dismiss and a link per alert, and refreshes from the event stream. The task settings page gains the webhook severity threshold and signing secret. ui/dist rebuilt.
132 lines
6.4 KiB
Vue
132 lines
6.4 KiB
Vue
<script setup lang="ts">
|
|
import ApplyStatusRows from "./ApplyStatusRows.vue";
|
|
import { computed, onMounted } from "vue";
|
|
import { storeToRefs } from "pinia";
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
import {Input} from "@/components/ui/input";
|
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
|
import PageHeader from "@/base/PageHeader.vue";
|
|
import { DurationInput, formatGoDuration, parseGoDuration } from "@/components/ui/duration-input";
|
|
import {
|
|
NumberField,
|
|
NumberFieldContent,
|
|
NumberFieldDecrement,
|
|
NumberFieldIncrement,
|
|
NumberFieldInput,
|
|
} from "@/components/ui/number-field";
|
|
import { SettingRow } from "@/components/ui/setting-row";
|
|
import { resourcesForPage, useControlPlaneStore } from "@/stores/control-plane";
|
|
import DraftHint from "./DraftHint.vue";
|
|
import HistoryLink from "./HistoryLink.vue";
|
|
import SecretRefField from "./SecretRefField.vue";
|
|
|
|
const POLICY="task-policy";
|
|
const KIND = "workflow-execution-settings";
|
|
|
|
interface ExecutionSettings {
|
|
max_model_tool_steps: number;
|
|
max_runtime_seconds: number;
|
|
max_consecutive_gate_failures: number;
|
|
max_task_runtime_seconds: number | null;
|
|
}
|
|
|
|
const store = useControlPlaneStore();
|
|
const { catalog, catalogError } = storeToRefs(store);
|
|
onMounted(store.load);
|
|
|
|
const resources = computed(() => resourcesForPage(catalog.value, "tasks"));
|
|
const policy=computed(()=>store.drafts[POLICY]?.value as {diff_cap_lines:number;notify_webhook:string;notify_min_severity:string;notify_secret:{engine:string;key:string}}|undefined);
|
|
const limits = computed(() => store.drafts[KIND]?.value as ExecutionSettings | undefined);
|
|
const error = computed(() => store.pageErrorFor(KIND));
|
|
|
|
// The document counts seconds; the input speaks durations.
|
|
function seconds(key: "max_runtime_seconds" | "max_task_runtime_seconds") {
|
|
return computed({
|
|
get: () => formatGoDuration((limits.value?.[key] ?? 0) * 1000),
|
|
set: (text: string) => {
|
|
const ms = parseGoDuration(text);
|
|
if (limits.value && ms !== null) limits.value[key] = Math.round(ms / 1000);
|
|
},
|
|
});
|
|
}
|
|
const callRuntime = seconds("max_runtime_seconds");
|
|
const taskRuntime = seconds("max_task_runtime_seconds");
|
|
</script>
|
|
|
|
<template>
|
|
<div>
|
|
<PageHeader title="Task execution">
|
|
<HistoryLink :kinds="resources.map((r) => r.kind)" />
|
|
</PageHeader>
|
|
<ApplyStatusRows v-for="resource in resources" :key="resource.kind" :kind="resource.kind" class="mb-4" />
|
|
|
|
<p v-if="catalogError || error || store.pageErrorFor(POLICY)" class="mb-4 text-sm text-danger" role="alert">
|
|
{{ catalogError || error || store.pageErrorFor(POLICY) }}
|
|
</p>
|
|
|
|
<template v-if="policy">
|
|
<SettingRow label="Maximum changed lines" hint="Applied to new tasks. 0 disables the limit." for="task-diff-cap">
|
|
<div class="flex flex-wrap items-center gap-3"><Input id="task-diff-cap" v-model.number="policy.diff_cap_lines" type="number" min="0" class="max-w-40" /><DraftHint :kind="POLICY" path="diff_cap_lines" /></div>
|
|
</SettingRow>
|
|
<SettingRow label="Alert webhook" hint="Receives each raised and resolved alert. Empty disables." for="task-notify">
|
|
<div class="flex flex-wrap items-center gap-3"><Input id="task-notify" v-model="policy.notify_webhook" type="url" class="max-w-md" /><DraftHint :kind="POLICY" path="notify_webhook" /></div>
|
|
</SettingRow>
|
|
<SettingRow label="Webhook severity" hint="The lowest severity delivered.">
|
|
<div class="flex flex-wrap items-center gap-3">
|
|
<Select :model-value="policy.notify_min_severity || 'warning'" @update:model-value="policy.notify_min_severity = String($event)">
|
|
<SelectTrigger class="w-40" aria-label="Webhook severity"><SelectValue /></SelectTrigger>
|
|
<SelectContent>
|
|
<SelectItem value="info">Info</SelectItem>
|
|
<SelectItem value="warning">Warning</SelectItem>
|
|
<SelectItem value="action">Needs you</SelectItem>
|
|
</SelectContent>
|
|
</Select>
|
|
<DraftHint :kind="POLICY" path="notify_min_severity" />
|
|
</div>
|
|
</SettingRow>
|
|
<SettingRow label="Webhook signing secret" hint="Signs each payload in X-Archie-Signature. Not set sends unsigned.">
|
|
<div class="flex flex-wrap items-center gap-3"><SecretRefField v-if="policy.notify_secret" v-model="policy.notify_secret" id-prefix="task-notify-secret" /><Button v-else variant="outline" size="sm" @click="policy.notify_secret = { engine: '', key: '' }">Set reference</Button><DraftHint :kind="POLICY" path="notify_secret" /></div>
|
|
</SettingRow>
|
|
</template>
|
|
<template v-if="limits">
|
|
<SettingRow label="Task time limit" for="te-task" hint="Parked after this. 0 disables.">
|
|
<div class="flex flex-wrap items-center gap-3">
|
|
<DurationInput id="te-task" v-model="taskRuntime" :units="['m', 'h']" />
|
|
<DraftHint :kind="KIND" path="max_task_runtime_seconds" />
|
|
</div>
|
|
</SettingRow>
|
|
<SettingRow label="Agent call time limit" for="te-call" hint="0 disables.">
|
|
<div class="flex flex-wrap items-center gap-3">
|
|
<DurationInput id="te-call" v-model="callRuntime" :units="['s', 'm', 'h']" />
|
|
<DraftHint :kind="KIND" path="max_runtime_seconds" />
|
|
</div>
|
|
</SettingRow>
|
|
<SettingRow label="Model tool steps" hint="Per agent call. 0 disables.">
|
|
<div class="flex flex-wrap items-center gap-3">
|
|
<NumberField v-model="limits.max_model_tool_steps" :min="0" class="w-32">
|
|
<NumberFieldContent>
|
|
<NumberFieldDecrement />
|
|
<NumberFieldInput class="font-mono" aria-label="Model tool steps" />
|
|
<NumberFieldIncrement />
|
|
</NumberFieldContent>
|
|
</NumberField>
|
|
<DraftHint :kind="KIND" path="max_model_tool_steps" />
|
|
</div>
|
|
</SettingRow>
|
|
<SettingRow label="Gate failures in a row" hint="In a row, then parked.">
|
|
<div class="flex flex-wrap items-center gap-3">
|
|
<NumberField v-model="limits.max_consecutive_gate_failures" :min="0" class="w-32">
|
|
<NumberFieldContent>
|
|
<NumberFieldDecrement />
|
|
<NumberFieldInput class="font-mono" aria-label="Gate failures in a row" />
|
|
<NumberFieldIncrement />
|
|
</NumberFieldContent>
|
|
</NumberField>
|
|
<DraftHint :kind="KIND" path="max_consecutive_gate_failures" />
|
|
</div>
|
|
</SettingRow>
|
|
</template>
|
|
</div>
|
|
</template>
|