Merge branch 'worktree-agent-a3fd604fba0fb36cc'

This commit is contained in:
sam committed 2026-11-21 13:55:00 +11:00
commit 3513dad609
14 files changed
+542 -75

No files matched your search

+5
View File
@@ -187,6 +187,9 @@ export const api = {
// The archie binary's module API; the wire types are below the object.
runs: (limit = 200) => request<Run[]>("/api/runs" + qs({ limit })),
run: (id: string) => request<RunTrail>(`/api/runs/${encodeURIComponent(id)}`),
/** Queues a parked run again from the step that parked it, or from `from`. */
retryRun: (id: string, from?: string) =>
request<Run>(`/api/runs/${encodeURIComponent(id)}/retry`, { method: "POST", body: from ? { from } : {} }),
approvals: () => request<Approval[]>("/api/approvals"),
answerApproval: (id: string, approved: boolean) =>
request<Approval>(`/api/approvals/${encodeURIComponent(id)}/answer`, { method: "POST", body: { approved } }),
@@ -662,6 +665,8 @@ export interface Run {
state: string;
attempts: number;
error?: string;
/** What the run's ending says: a finish step's detail, or why a step parked it. */
detail?: string;
created_at: string;
finished_at?: string;
result?: unknown;
+21 -2
View File
@@ -1,17 +1,19 @@
<script setup lang="ts">
import { computed, onMounted } from "vue";
import { computed, onMounted, ref } from "vue";
import { RouterLink, useRoute } from "vue-router";
import CodeView from "@/base/CodeView.vue";
import PageHeader from "@/base/PageHeader.vue";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
import { MetadataList } from "@/components/ui/metadata-list";
import { ReadError } from "@/components/ui/read-error";
import { Section } from "@/components/ui/section";
import { Skeleton } from "@/components/ui/skeleton";
import { Timestamp } from "@/components/ui/timestamp";
import { api, type RunAction } from "@/lib/api";
import { errors } from "@/copy/errors";
import { api, describeError, type RunAction } from "@/lib/api";
import { usePoll, useRead } from "@/lib/use-read";
import { useLiveResource } from "@/stores/session";
import ApprovalsSection from "./ApprovalsSection.vue";
@@ -37,8 +39,23 @@ const details = computed(() => {
{ label: "Attempts", value: String(run.attempts) },
{ label: "Run", value: run.id, mono: true },
...(run.error ? [{ label: "Error", value: run.error }] : []),
...(run.detail ? [{ label: "Detail", value: run.detail }] : []),
];
});
const retrying = ref(false);
const retryError = ref("");
async function retry(): Promise<void> {
retrying.value = true;
retryError.value = "";
try {
await api.retryRun(id);
await reload();
} catch (cause) {
retryError.value = describeError(cause, errors.common.unknown);
} finally {
retrying.value = false;
}
}
const origin = computed(() => {
const o = data.value?.origin;
if (!o) return [];
@@ -64,10 +81,12 @@ const result = computed(() =>
<PageHeader :title="data ? data.run.workflow : 'Run'">
<Badge v-if="data" :variant="stateTone(data.run.state)">{{ data.run.state }}</Badge>
<span v-if="data" class="text-caption text-fg-muted">Started <Timestamp :at="data.run.created_at" /></span>
<Button v-if="data?.run.state === 'parked'" size="sm" :disabled="retrying" @click="retry">Retry</Button>
</PageHeader>
<ReadError v-if="error" :message="error" retry-label="Retry" @retry="reload" />
<div v-else-if="!data" role="status" aria-label="Loading run" class="space-y-2"><Skeleton class="h-24 w-full" /><Skeleton class="h-48 w-full" /></div>
<template v-else>
<p v-if="retryError" role="alert" class="mb-2 text-caption text-danger">{{ retryError }}</p>
<ApprovalsSection :run="id" @answered="reload" />
<div class="grid gap-x-4 lg:grid-cols-2">
<Section title="Run"><MetadataList :rows="details" /></Section>
+2
View File
@@ -7,6 +7,8 @@ export function stateTone(state: string): "ok" | "warn" | "danger" | "info" | "i
case "done":
return "ok";
case "waiting":
case "waiting_approval":
case "parked":
case "pending":
case "unknown":
return "warn";