fix(web): offer media card follow-ups on any settled job

Failed or cancelled jobs can still carry finished outputs, so the card asks
for the space's capabilities whenever a settled job shows video or audio.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MRtGG9ARfqqhma3t85Ro2u
This commit is contained in:
Claude 2026-10-03 14:08:37 +00:00
parent e66ce42d73
commit 74c3685397
No known key found for this signature in database

View File

@ -41,6 +41,8 @@ export interface MediaCardAvailability {
transcribe: boolean;
}
const NOTHING_AVAILABLE: MediaCardAvailability = { export: false, transcribe: false };
const OPERATION_ICONS: Record<MediaOperation, LucideIcon> = {
generate_image: Sparkles,
generate_video: Sparkles,
@ -171,7 +173,7 @@ function OutputActions({
export function MediaCardView({
block,
target,
available = { export: false, transcribe: false },
available = NOTHING_AVAILABLE,
onAction,
}: {
block: MediaJobBlock;
@ -304,7 +306,6 @@ export function MediaCardView({
);
}
const NOTHING_AVAILABLE: MediaCardAvailability = { export: false, transcribe: false };
const CAPABILITIES_TTL_MS = 60_000;
let capabilities:
| { spaceId: string | null; at: number; value: Promise<MediaCardAvailability> }
@ -359,9 +360,9 @@ export function MediaCard({
/** The message carrying the card; a follow-up job is posted by the same bot. */
messageId: string;
}) {
// Follow-ups apply to finished video and audio only; other cards never ask.
// Follow-ups apply to video and audio of a settled job only; other cards never ask.
const available = useAvailability(
block.status === "done" &&
!isActiveMediaStatus(block.status) &&
block.outputs.some((output) => output.kind === "video" || output.kind === "audio"),
);
const onAction = async (action: MediaCardAction) => {