Merge branch 'main' into pg/foundation
This commit is contained in:
12 files changed
+344
-75
No files matched your search
@@ -0,0 +1,62 @@
|
||||
// The freeze-dried /api/task-meta catalog the dashboard renders before the
|
||||
// served one arrives, or when archied is unreachable. It has no imports so the
|
||||
// node test runner can compare it against the Go handler's committed fixture
|
||||
// (internal/webui/testdata/task_meta.json); task-meta.ts replaces it with the
|
||||
// live catalog.
|
||||
|
||||
/** A lifecycle status as the server describes it. */
|
||||
export interface StatusMeta {
|
||||
id: string;
|
||||
label: string;
|
||||
kind: string;
|
||||
needs_you?: boolean;
|
||||
}
|
||||
|
||||
/** An operator control as the server describes it. */
|
||||
export interface ActionMeta {
|
||||
id: string;
|
||||
label: string;
|
||||
kind: string;
|
||||
confirm?: string;
|
||||
}
|
||||
|
||||
/** A changes_captured file status as the server describes it. */
|
||||
export interface ChangeStatusMeta {
|
||||
id: string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
export const DEFAULT_STATUSES: StatusMeta[] = [
|
||||
{ id: "queued", label: "Queued", kind: "idle" },
|
||||
{ id: "running", label: "Working", kind: "info" },
|
||||
{ id: "waiting_human", label: "Waiting for you", kind: "warn", needs_you: true },
|
||||
{ id: "pr_open", label: "In review", kind: "ok" },
|
||||
{ id: "merged", label: "Merged", kind: "ok" },
|
||||
{ id: "completed", label: "Done", kind: "ok" },
|
||||
{ id: "parked", label: "Parked", kind: "warn", needs_you: true },
|
||||
{ id: "dead", label: "Stopped (too many retries)", kind: "danger" },
|
||||
{ id: "rejected", label: "Rejected", kind: "danger" },
|
||||
{ id: "closed_wont_do", label: "Won't do", kind: "idle" },
|
||||
];
|
||||
|
||||
export const DEFAULT_ACTIONS: ActionMeta[] = [
|
||||
{ id: "cancel", label: "Cancel", kind: "quiet", confirm: `Cancel "{title}"? This closes the forge issue.` },
|
||||
{ id: "stop", label: "Stop", kind: "primary", confirm: `Stop "{title}"? Recoverable work will remain parked.` },
|
||||
{ id: "approve", label: "Approve", kind: "primary" },
|
||||
{ id: "reject", label: "Reject", kind: "quiet", confirm: `Reject "{title}"? This closes the forge issue.` },
|
||||
{ id: "retry", label: "Retry", kind: "primary" },
|
||||
{ id: "abandon", label: "Abandon", kind: "quiet", confirm: `Abandon "{title}"? This closes the forge issue.` },
|
||||
{ id: "archive", label: "Archive", kind: "quiet", confirm: `Archive the local record for "{title}"?` },
|
||||
{ id: "open_pr", label: "Open PR", kind: "link" },
|
||||
{ id: "open_issue", label: "Open issue", kind: "link" },
|
||||
];
|
||||
|
||||
export const DEFAULT_CHANGE_STATUSES: ChangeStatusMeta[] = [
|
||||
{ id: "added", label: "Added" },
|
||||
{ id: "modified", label: "Modified" },
|
||||
{ id: "deleted", label: "Deleted" },
|
||||
{ id: "renamed", label: "Renamed" },
|
||||
{ id: "typechange", label: "Type changed" },
|
||||
];
|
||||
|
||||
export const DEFAULT_CONFIG_SCHEMA = "archie/task-config@1";
|
||||
+34
-40
@@ -22,60 +22,41 @@ import { computed, shallowRef } from "vue";
|
||||
|
||||
import { api } from "./api";
|
||||
|
||||
/** A lifecycle status as the server describes it. */
|
||||
export interface StatusMeta {
|
||||
id: string;
|
||||
label: string;
|
||||
kind: string;
|
||||
needs_you?: boolean;
|
||||
}
|
||||
import {
|
||||
type ActionMeta,
|
||||
type ChangeStatusMeta,
|
||||
DEFAULT_ACTIONS,
|
||||
DEFAULT_CHANGE_STATUSES,
|
||||
DEFAULT_CONFIG_SCHEMA,
|
||||
DEFAULT_STATUSES,
|
||||
type StatusMeta,
|
||||
} from "./task-meta-snapshot";
|
||||
|
||||
/** An operator control as the server describes it. */
|
||||
export interface ActionMeta {
|
||||
id: string;
|
||||
label: string;
|
||||
kind: string;
|
||||
confirm?: string;
|
||||
}
|
||||
|
||||
const DEFAULT_STATUSES: StatusMeta[] = [
|
||||
{ id: "queued", label: "Queued", kind: "idle" },
|
||||
{ id: "running", label: "Working", kind: "info" },
|
||||
{ id: "waiting_human", label: "Waiting for you", kind: "warn", needs_you: true },
|
||||
{ id: "pr_open", label: "In review", kind: "ok" },
|
||||
{ id: "merged", label: "Merged", kind: "ok" },
|
||||
{ id: "completed", label: "Done", kind: "ok" },
|
||||
{ id: "parked", label: "Parked", kind: "warn", needs_you: true },
|
||||
{ id: "dead", label: "Stopped (too many retries)", kind: "danger" },
|
||||
{ id: "rejected", label: "Rejected", kind: "danger" },
|
||||
{ id: "closed_wont_do", label: "Won't do", kind: "idle" },
|
||||
];
|
||||
|
||||
const DEFAULT_ACTIONS: ActionMeta[] = [
|
||||
{ id: "cancel", label: "Cancel", kind: "quiet", confirm: `Cancel "{title}"? This closes the forge issue.` },
|
||||
{ id: "stop", label: "Stop", kind: "primary", confirm: `Stop "{title}"? Recoverable work will remain parked.` },
|
||||
{ id: "approve", label: "Approve", kind: "primary" },
|
||||
{ id: "reject", label: "Reject", kind: "quiet", confirm: `Reject "{title}"? This closes the forge issue.` },
|
||||
{ id: "retry", label: "Retry", kind: "primary" },
|
||||
{ id: "abandon", label: "Abandon", kind: "quiet", confirm: `Abandon "{title}"? This closes the forge issue.` },
|
||||
{ id: "archive", label: "Archive", kind: "quiet", confirm: `Archive the local record for "{title}"?` },
|
||||
{ id: "open_pr", label: "Open PR", kind: "link" },
|
||||
{ id: "open_issue", label: "Open issue", kind: "link" },
|
||||
];
|
||||
export type { ActionMeta, ChangeStatusMeta, StatusMeta };
|
||||
|
||||
const statuses = shallowRef<StatusMeta[]>([...DEFAULT_STATUSES]);
|
||||
const actions = shallowRef<ActionMeta[]>([...DEFAULT_ACTIONS]);
|
||||
const changeStatuses = shallowRef<ChangeStatusMeta[]>([...DEFAULT_CHANGE_STATUSES]);
|
||||
const configSchemaRef = shallowRef<string>(DEFAULT_CONFIG_SCHEMA);
|
||||
|
||||
const statusById = computed(() => new Map(statuses.value.map((s) => [s.id, s])));
|
||||
const actionById = computed(() => new Map(actions.value.map((a) => [a.id, a])));
|
||||
const changeStatusById = computed(() => new Map(changeStatuses.value.map((c) => [c.id, c])));
|
||||
|
||||
// loadTaskMeta upgrades the dashboard from the server catalog. It never throws:
|
||||
// a failed fetch keeps the defaults so the UI still renders.
|
||||
export async function loadTaskMeta(): Promise<void> {
|
||||
try {
|
||||
const data = await api.taskMeta<{ statuses?: StatusMeta[]; actions?: ActionMeta[] } | null>();
|
||||
const data = await api.taskMeta<{
|
||||
statuses?: StatusMeta[];
|
||||
actions?: ActionMeta[];
|
||||
change_statuses?: ChangeStatusMeta[];
|
||||
config_schema?: string;
|
||||
} | null>();
|
||||
if (Array.isArray(data?.statuses)) statuses.value = data.statuses;
|
||||
if (Array.isArray(data?.actions)) actions.value = data.actions;
|
||||
if (Array.isArray(data?.change_statuses)) changeStatuses.value = data.change_statuses;
|
||||
if (data?.config_schema) configSchemaRef.value = data.config_schema;
|
||||
} catch {
|
||||
// archied unreachable or not yet serving this route; keep the defaults.
|
||||
}
|
||||
@@ -116,3 +97,16 @@ export function attentionStatusIds(): Set<string> {
|
||||
export function actionFor(id: string): ActionMeta | null {
|
||||
return actionById.value.get(id) || null;
|
||||
}
|
||||
|
||||
/**
|
||||
* changeStatusLabel names a changes_captured file status. An id the catalog
|
||||
* does not know renders as itself rather than breaking the row.
|
||||
*/
|
||||
export function changeStatusLabel(id: string | undefined): string {
|
||||
return (id && changeStatusById.value.get(id)?.label) || id || "unknown";
|
||||
}
|
||||
|
||||
/** configSchema is the schema stamp a recognised config_captured payload carries. */
|
||||
export function configSchema(): string {
|
||||
return configSchemaRef.value;
|
||||
}
|
||||
@@ -2,11 +2,12 @@
|
||||
import { computed } from "vue";
|
||||
|
||||
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import { configSchema } from "@/lib/task-meta";
|
||||
|
||||
import JsonBlock from "./JsonBlock.vue";
|
||||
import PanelError from "./PanelError.vue";
|
||||
import PanelLoading from "./PanelLoading.vue";
|
||||
import { CONFIG_SCHEMA, selectConfigEvent } from "./attempt-config";
|
||||
import { selectConfigEvent } from "./attempt-config";
|
||||
import type { TaskEvent } from "./task-run";
|
||||
|
||||
/**
|
||||
@@ -28,7 +29,7 @@ const schema = computed(() => {
|
||||
return typeof data.schema === "string" ? data.schema : "";
|
||||
});
|
||||
const document = computed(() => event.value?.data?.document ?? {});
|
||||
const recognised = computed(() => schema.value === CONFIG_SCHEMA);
|
||||
const recognised = computed(() => schema.value === configSchema());
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -12,12 +12,6 @@
|
||||
*/
|
||||
import type { TaskEvent } from "./task-run";
|
||||
|
||||
// The schema name is owned by the daemon (events.ConfigCapturedSchema in
|
||||
// internal/events/events.go). A payload in an unrecognised schema is shown
|
||||
// verbatim with a note rather than reinterpreted, so a server-side bump
|
||||
// degrades to the raw view instead of rendering something wrong.
|
||||
export const CONFIG_SCHEMA = "archie/task-config@1";
|
||||
|
||||
export function selectConfigEvent(
|
||||
events: TaskEvent[] | null | undefined,
|
||||
attempt: number | null,
|
||||
|
||||
@@ -9,22 +9,9 @@
|
||||
*/
|
||||
import type { Capture, CaptureTotals, TaskRecord } from "./task-run";
|
||||
|
||||
// The change-status ids are a wire vocabulary owned by the daemon
|
||||
// (internal/domain/workflow/task/changes.go). Only the words are the
|
||||
// dashboard's: an id added on the server renders as its raw id rather than
|
||||
// breaking the row. The old test suite pinned the id set on both sides so a
|
||||
// one-sided rename failed instead of drifting.
|
||||
const FILE_STATUS: Record<string, string> = {
|
||||
added: "Added",
|
||||
modified: "Modified",
|
||||
deleted: "Deleted",
|
||||
renamed: "Renamed",
|
||||
typechange: "Type changed",
|
||||
};
|
||||
|
||||
export function fileStatusLabel(status: string | undefined): string {
|
||||
return (status && FILE_STATUS[status]) || status || "unknown";
|
||||
}
|
||||
// The change-status labels are served with the rest of the task vocabulary
|
||||
// (/api/task-meta), keyed by the daemon's own Change* constants.
|
||||
export { changeStatusLabel as fileStatusLabel } from "@/lib/task-meta";
|
||||
|
||||
/**
|
||||
* The forge links come from the same projection the task list uses: the task's
|
||||
|
||||
Reference in new issue
Block a user