feat(ao): W4-E3 manual organize guard, series completion, engine retry, v0.1.0

- POST /organization-records: sourcePaths must resolve (realpath) under a
  registered library_root or downloader path-mapping host path; `..` and
  symlink escapes rejected (400), dryRun included. Move requires an admin
  session, or an API key with an automation_grant covering the entity or a
  matching one-time approval (consumed on use), else 403. Manual Move from a
  managed download_task with unsatisfied H&R returns 409 and opens a
  decision; never silently downgraded to Copy.
- Series slot completion: total episode count is unknown while units are
  provisional, so the slot is not satisfied and the subscription keeps
  tracking; coverage is registered per actual file (creating provisional
  episode units), and already_in_library files count as verified presence.
- POST /engine/runs/{id}/retry (admin): re-enqueue by original task name and
  raw input with idempotency key retry:<id>:<n>, audited; retry button on
  the run detail page.
- E7 regular series e2e, E8 AT24 tag removal / task disappearance e2e.
- All workspace members and root set to version 0.1.0; CHANGELOG.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-09-27 22:47:11 +08:00
1 parent 591cc78c7d
commit ceff9cf51f
25 files changed
+1566 -57

No files matched your search

+13
View File
@@ -48,3 +48,16 @@ export function useCancelEngineRun() {
onSettled: () => qc.invalidateQueries({ queryKey: qk.all("engine") }),
});
}
/** 重跑已结束的 run:服务端按原任务名与原始输入重新入队,返回新 runId */
export function useRetryEngineRun() {
const qc = useQueryClient();
return useMutation({
mutationFn: ({ id }: { id: string }) =>
apiData<{ runId: string; retryOf: string; attempt: number }>("/engine/runs/{id}/retry", {
method: "POST",
pathParams: { id },
}),
onSettled: () => qc.invalidateQueries({ queryKey: qk.all("engine") }),
});
}
+29 -4
View File
@@ -1,8 +1,8 @@
import type { EngineStepAttempt } from "@umt/contracts";
import { ArrowLeft, Ban, RotateCw } from "lucide-react";
import { Link, useParams } from "react-router";
import { ArrowLeft, Ban, Repeat, RotateCw } from "lucide-react";
import { Link, useNavigate, useParams } from "react-router";
import { toast } from "sonner";
import { ENGINE_TERMINAL, useCancelEngineRun, useEngineRun } from "~/api/engine.ts";
import { ENGINE_TERMINAL, useCancelEngineRun, useEngineRun, useRetryEngineRun } from "~/api/engine.ts";
import { ConfirmDialog } from "~/components/console/confirm-dialog.tsx";
import { DetailSection } from "~/components/console/detail-sheet.tsx";
import { EmptyState, ErrorState, LoadingState } from "~/components/console/empty-state.tsx";
@@ -93,6 +93,8 @@ export default function EngineRunPage() {
const { runId } = useParams();
const q = useEngineRun(runId);
const cancel = useCancelEngineRun();
const retry = useRetryEngineRun();
const navigate = useNavigate();
const back = (
<Link
@@ -167,7 +169,30 @@ export default function EngineRunPage() {
}
}}
/>
) : null}
) : (
<ConfirmDialog
trigger={
<Button variant="outline" size="sm" disabled={retry.isPending}>
<Repeat />
重跑
</Button>
}
title="重跑这个 run?"
description="按原任务名和原始输入新建一个 run(新的幂等键),原 run 保持不变。已完成的文件操作由任务自己的操作账本去重。"
confirmLabel="重跑"
cancelLabel="不重跑"
onConfirm={async () => {
try {
const res = await retry.mutateAsync({ id: r.id });
toast.success(`已重新入队(第 ${res.attempt} 次重跑)`);
navigate(consolePath("engine", res.runId));
} catch (err) {
toast.error(errorMessage(err, "重跑失败"));
throw err;
}
}}
/>
)}
</>
}
/>