feat(webui): task detail with a parked banner and a right rail

Header: breadcrumb, title, status pill, workflow and forge links, with
Start a new run as the page's one action; a parked task opens with its
park reason in an amber banner. The log/changes/configuration/debug tabs
take the main column; a right rail lists every attempt with its outcome
(replacing the pager inside the stage rail), the selected attempt's
stages, and the task's details.
This commit is contained in:
sam committed 2026-09-25 16:28:38 +10:00
1 parent 84e84cac5f
commit 5418fc6512
11 files changed
+179 -207

No files matched your search

-77
View File
@@ -1,77 +0,0 @@
<script setup lang="ts">
import { computed } from "vue";
import {
Pagination,
PaginationContent,
PaginationEllipsis,
PaginationItem,
PaginationNext,
PaginationPrevious,
} from "@/components/ui/pagination";
import { useTaskRun } from "./use-task-run";
/**
* The attempts of this task as a pager, sitting above the tab card: chevrons
* walk run history, the numbers land on an attempt directly, and the attempt
* on screen reads as the active page. Selection is the page's, and the stage
* rail reads the same response, so the two views of the same task's attempts
* can never disagree about which one is on screen.
*
* Hidden for zero or one attempt: a one-page pager is the text fact wearing
* extra chrome. The URL names the attempt either way, and the panels show
* which attempt is on screen.
*/
const run = useTaskRun();
const attempts = computed(() => run.attempts?.attempts ?? []);
const selected = computed(() =>
attempts.value.findIndex(
(a) => Number(a.attempt) === Number(run.attemptNumber),
),
);
const loaded = computed(() => attempts.value.length > 1);
const total = computed(() => attempts.value.length);
// reka's pagination counts pages over items; one attempt per page makes the
// page number an index into the run history. The controlled page keeps the
// URL (`?attempt=N`) the single source of truth.
const page = computed(() => (selected.value >= 0 ? selected.value + 1 : 1));
function select(p: number): void {
const attempt = attempts.value[p - 1];
if (attempt) run.selectAttempt(Number(attempt.attempt));
}
</script>
<template>
<Pagination
v-if="loaded"
:items-per-page="1"
:total="total"
:page="page"
:sibling-count="1"
aria-label="Attempts of this task"
class="mx-0 w-auto"
@update:page="select"
>
<PaginationContent v-slot="{ items }">
<PaginationPrevious size="icon-sm" class="border-transparent" />
<template v-for="(item, i) in items" :key="i">
<PaginationEllipsis v-if="item.type === 'ellipsis'" :index="i" />
<PaginationItem
v-else
:value="item.value"
:is-active="item.value === page"
size="icon-sm"
:title="`Attempt ${attempts[item.value - 1]?.attempt}`"
>
{{ item.value }}
</PaginationItem>
</template>
<PaginationNext size="icon-sm" class="border-transparent" />
</PaginationContent>
</Pagination>
</template>
-5
View File
@@ -10,7 +10,6 @@ import {
} from "@/components/ui/empty";
import { Badge } from "@/components/ui/badge";
import AttemptSelector from "./AttemptSelector.vue";
import PanelError from "./PanelError.vue";
import PanelLoading from "./PanelLoading.vue";
import StageRow from "./StageRow.vue";
@@ -122,10 +121,6 @@ const startedAt = computed(() => {
<div v-else>
<div class="mb-4 flex flex-wrap items-center gap-3">
<template v-if="attempts.length > 1">
<span class="text-sm text-fg-muted">Attempt</span>
<AttemptSelector />
</template>
<Badge :variant="meta.kind">{{ meta.label }}</Badge>
<span class="text-xs text-fg-muted">{{ startedAt }}</span>
<span v-if="timeLimit" class="text-xs text-fg-muted">{{
+4 -16
View File
@@ -8,10 +8,9 @@ import { Tabs } from "@/components/ui/tabs";
import TabBar from "./TabBar.vue";
import TaskDetailNotice from "./TaskDetailNotice.vue";
import TaskHeader from "./TaskHeader.vue";
import TaskMetaBar from "./TaskMetaBar.vue";
import TaskNotes from "./TaskNotes.vue";
import TaskRunPanels from "./TaskRunPanels.vue";
import StageRail from "./StageRail.vue";
import TaskRail from "./TaskRail.vue";
import { parseTaskId } from "./task-run";
import { provideTaskRun } from "./use-task-run";
@@ -48,22 +47,10 @@ const run = provideTaskRun(taskId);
<TaskDetailNotice v-else-if="run.missing" kind="missing" :raw="rawId" />
<div v-else>
<TaskHeader :id="rawId" />
<TaskMetaBar />
<TaskNotes :id="rawId" />
<div
class="grid items-start gap-4 lg:grid-cols-[20rem_minmax(0,1fr)]"
>
<!--
The master pane: the attempt's stage rail, always on screen. It owns
its own loading, failure and empty states, so the inspector never has
to speak for it.
-->
<aside aria-label="Run stages">
<StageRail :state="run.attempts" />
</aside>
<Card>
<div class="grid items-start gap-6 lg:grid-cols-[minmax(0,1fr)_20rem]">
<Card class="min-w-0">
<CardContent>
<Tabs
class="gap-4"
@@ -75,6 +62,7 @@ const run = provideTaskRun(taskId);
</Tabs>
</CardContent>
</Card>
<TaskRail />
</div>
</div>
</template>
+62 -53
View File
@@ -1,72 +1,81 @@
<script setup lang="ts">
import { ArrowLeft } from "@lucide/vue";
import { computed } from "vue";
import { RouterLink } from "vue-router";
import { Button } from "@/components/ui/button";
import { ArrowUpRight, CircleAlert } from "@lucide/vue";
import {
Breadcrumb,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbList,
BreadcrumbPage,
BreadcrumbSeparator,
} from "@/components/ui/breadcrumb";
import { StatusPill } from "@/components/ui/status-pill";
import { statusKind, statusLabel } from "@/lib/task-meta";
import StartNewRun from "./StartNewRun.vue";
import { pillFor } from "./status-pill";
import { useTaskRun } from "./use-task-run";
/**
* The run page's head, one strip: the task, its workflow line, and the
* actions. Back is page chrome; Start a new run lives here too,
* since a restart is the page's one decision. The commit-discard consequence
* is stated in the confirm dialog, not beside the button. The forge
* coordinates (repo, issue, PR) sit at the row's far end: context, not
* action, but read left-to-right as where this work lives.
* The task's head: where it sits, what it is, its state and forge links, and
* the page's one decision, starting a new run. A parked task opens with the
* reason it stopped.
*/
const props = defineProps<{ id: string }>();
const run = useTaskRun();
const title = computed(() => run.task?.title || `Task #${props.id}`);
const workflow = computed(() =>
run.task?.workflow ? `${run.task.workflow} workflow` : "",
);
const status = computed(() => run.task?.status ?? "");
const pill = computed(() => pillFor(statusKind(status.value)));
const parked = computed(() => status.value === "parked" && !!run.task?.park_reason);
</script>
<template>
<div class="mb-4 flex flex-wrap items-start justify-between gap-x-5 gap-y-2">
<div class="min-w-0">
<h1 class="text-2xl font-semibold tracking-[-0.02em]">{{ title }}</h1>
<p v-if="workflow" class="mt-1 text-sm text-fg-muted">{{ workflow }}</p>
<div class="mb-6">
<Breadcrumb class="mb-2">
<BreadcrumbList>
<BreadcrumbItem><BreadcrumbLink as-child><RouterLink to="/tasks">Tasks</RouterLink></BreadcrumbLink></BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem><BreadcrumbPage class="font-mono">#{{ id }}</BreadcrumbPage></BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>
<div class="flex flex-wrap items-start justify-between gap-4">
<div class="min-w-0">
<h1 class="text-2xl font-semibold">{{ title }}</h1>
<div class="mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm">
<StatusPill v-if="status" :tone="pill.tone" :dot="pill.dot">{{ statusLabel(status) }}</StatusPill>
<span v-if="run.task?.workflow" class="font-mono text-xs text-fg-muted">{{ run.task.workflow }}</span>
<a
v-if="run.task?.issue_url && run.task?.issue_number"
class="inline-flex items-center gap-0.5 font-mono text-xs text-fg-muted hover:text-foreground"
:href="run.task.issue_url"
target="_blank"
rel="noreferrer"
>{{ run.task.owner }}/{{ run.task.repo }} #{{ run.task.issue_number }}<ArrowUpRight class="size-3" aria-hidden="true"
/></a>
<a
v-if="run.task?.pr_url && run.task?.pr_number"
class="inline-flex items-center gap-0.5 font-mono text-xs text-fg-muted hover:text-foreground"
:href="run.task.pr_url"
target="_blank"
rel="noreferrer"
>PR #{{ run.task.pr_number }}<ArrowUpRight class="size-3" aria-hidden="true"
/></a>
</div>
</div>
<StartNewRun compact :id="id" />
</div>
<div class="flex w-full flex-wrap items-center gap-2">
<Button variant="outline" as-child>
<RouterLink to="/tasks">
<ArrowLeft data-icon="inline-start" />
Back to tasks
</RouterLink>
</Button>
<StartNewRun compact :id="id" class="mr-auto" />
<a
v-if="run.task?.repo_url"
class="text-link hover:underline"
:href="run.task.repo_url"
target="_blank"
rel="noreferrer"
>
{{ run.task.owner }}/{{ run.task.repo }}
</a>
<a
v-if="run.task?.issue_url && run.task?.issue_number"
class="text-link hover:underline"
:href="run.task.issue_url"
target="_blank"
rel="noreferrer"
>
Issue #{{ run.task.issue_number }}
</a>
<a
v-if="run.task?.pr_url && run.task?.pr_number"
class="text-link hover:underline"
:href="run.task.pr_url"
target="_blank"
rel="noreferrer"
>
PR #{{ run.task.pr_number }}
</a>
<div
v-if="parked"
role="status"
class="mt-4 flex items-start gap-3 rounded-md border border-warn/40 bg-warn-soft px-4 py-3"
>
<CircleAlert class="mt-0.5 size-4 shrink-0 text-warn" aria-hidden="true" />
<div class="min-w-0">
<p class="text-sm font-medium text-warn">Parked</p>
<p class="mt-0.5 font-mono text-xs break-words text-fg-muted">{{ run.task?.park_reason }}</p>
</div>
</div>
</div>
</template>
-42
View File
@@ -1,42 +0,0 @@
<script setup lang="ts">
import { computed } from "vue";
import { Badge } from "@/components/ui/badge";
import type { StatusKind } from "@/lib/status";
import { statusKind, statusLabel } from "@/lib/task-meta";
import { useTaskRun } from "./use-task-run";
/**
* The task's lifecycle status and, when parked, why. Everything comes from reads
* the page already holds, so the bar costs no request of its own.
*
* "Not read" and "loading" are kept apart from "no status": the task list is
* a list of the 100 most recently updated, so a task outside it is a fact
* about the read, not a fact about the task.
*/
const run = useTaskRun();
// The server owns the status vocabulary and answers with the same five kinds
// the Badge draws, which is what makes the cast honest rather than a guess.
const taskKind = computed<StatusKind>(
() => statusKind(run.task?.status ?? "") as StatusKind,
);
const taskStatusLabel = computed(() => statusLabel(run.task?.status ?? ""));
</script>
<template>
<div class="mb-4 flex flex-wrap items-center gap-3 text-sm">
<span v-if="run.taskList === undefined" class="text-fg-muted"
>loading…</span
>
<template v-else-if="run.task">
<Badge :variant="taskKind">{{ taskStatusLabel }}</Badge>
<span
v-if="run.task.status === 'parked' && run.task.park_reason"
class="min-w-0 break-words text-fg-muted"
>{{ run.task.park_reason }}</span
>
</template>
</div>
</template>
+86
View File
@@ -0,0 +1,86 @@
<script setup lang="ts">
import { computed } from "vue";
import { ArrowUpRight } from "@lucide/vue";
import { ago, compact } from "@/lib/format";
import { cn } from "@/lib/utils";
import { statusKind, statusLabel } from "@/lib/task-meta";
import StageRail from "./StageRail.vue";
import { pillFor } from "./status-pill";
import { useTaskRun } from "./use-task-run";
import { duration } from "./timeline-event";
/** The task's right rail: every attempt with its outcome, the selected
* attempt's stages, and the task's details. */
const run = useTaskRun();
const attempts = computed(() => [...(run.attempts?.attempts ?? [])].reverse());
const dot = (status?: string) => {
const d = pillFor(statusKind(status ?? "")).dot;
return { live: "bg-primary", warn: "bg-warn", danger: "bg-danger", idle: "bg-idle" }[d];
};
const heading = "mb-2 text-[11px] font-medium tracking-[0.06em] text-fg-subtle uppercase";
</script>
<template>
<aside class="grid gap-6" aria-label="Task details">
<section v-if="attempts.length" aria-labelledby="rail-attempts">
<h2 id="rail-attempts" :class="heading">Attempts</h2>
<ul class="flex flex-col gap-0.5">
<li v-for="a in attempts" :key="a.attempt">
<button
type="button"
:aria-current="Number(a.attempt) === Number(run.attemptNumber) ? 'true' : undefined"
:class="
cn(
'flex w-full items-center gap-2.5 rounded-md px-3 py-2 text-left text-sm transition-colors hover:bg-secondary',
Number(a.attempt) === Number(run.attemptNumber) && 'bg-secondary font-medium',
)
"
@click="run.selectAttempt(Number(a.attempt))"
>
<span class="size-2 shrink-0 rounded-full" :class="dot(a.status)" aria-hidden="true" />
<span class="flex-1">Attempt {{ a.attempt }}</span>
<span class="text-xs text-fg-subtle">{{ a.status ? statusLabel(a.status) : "" }}</span>
</button>
<p v-if="a.started_at" class="px-3 pb-1 pl-7 text-xs text-fg-subtle">
{{ ago(a.started_at) }}<template v-if="a.duration_ms"> · {{ duration(a.duration_ms) }}</template>
</p>
</li>
</ul>
</section>
<section aria-labelledby="rail-stages">
<h2 id="rail-stages" :class="heading">Stages</h2>
<StageRail :state="run.attempts" />
</section>
<section v-if="run.task" aria-labelledby="rail-details">
<h2 id="rail-details" :class="heading">Details</h2>
<dl class="grid grid-cols-[6.5rem_1fr] gap-x-3 gap-y-2 text-sm">
<dt class="text-fg-subtle">Workflow</dt>
<dd class="truncate font-mono text-xs leading-5">{{ run.task.workflow || "none" }}</dd>
<template v-if="run.task.repo">
<dt class="text-fg-subtle">Repository</dt>
<dd class="truncate font-mono text-xs leading-5">
<a v-if="run.task.repo_url" :href="run.task.repo_url" target="_blank" rel="noreferrer" class="hover:underline"
>{{ run.task.owner }}/{{ run.task.repo }}</a
><template v-else>{{ run.task.owner }}/{{ run.task.repo }}</template>
</dd>
</template>
<template v-if="run.task.issue_url && run.task.issue_number">
<dt class="text-fg-subtle">Issue</dt>
<dd class="font-mono text-xs leading-5">
<a :href="run.task.issue_url" target="_blank" rel="noreferrer" class="inline-flex items-center gap-0.5 hover:underline"
>#{{ run.task.issue_number }}<ArrowUpRight class="size-3" aria-hidden="true"
/></a>
</dd>
</template>
<template v-if="run.task.tokens_used">
<dt class="text-fg-subtle">Tokens</dt>
<dd class="font-mono text-xs leading-5">{{ compact(run.task.tokens_used) }}</dd>
</template>
</dl>
</section>
</aside>
</template>
+2
View File
@@ -16,6 +16,8 @@ export interface Task {
source?: string;
status?: string;
park_class?: string;
park_reason?: string;
tokens_used?: number;
workflow?: string;
stage?: string;
attempt?: number;
+10
View File
@@ -0,0 +1,10 @@
/** How a lifecycle status kind (from task-meta) reads as a status pill. */
export function pillFor(kind: string): {
tone: "neutral" | "warn" | "danger";
dot: "live" | "warn" | "danger" | "idle";
} {
if (kind === "danger") return { tone: "danger", dot: "danger" };
if (kind === "warn") return { tone: "warn", dot: "warn" };
if (kind === "ok" || kind === "info") return { tone: "neutral", dot: "live" };
return { tone: "neutral", dot: "idle" };
}
+1
View File
@@ -52,6 +52,7 @@ export interface TaskRecord {
pr_number?: number;
pr_url?: string;
park_reason?: string;
tokens_used?: number;
actions?: string[];
}