"use client";
import { DispatchCard } from "@/components/artifacts/dispatch-card";
import { MessageResponse } from "@/components/ai-elements/message";
import type { ArtifactPartProps, PdfResult, ResearchResult } from "@/src/core";
/**
* The research tool-call box (contracts.ts "THE ASYNC PROTOCOL" ยง4).
*
* The part's output is the fire-and-forget dispatch ACK โ the box itself is
* the DispatchCard (live status via the central jobs poll; quiet one-liner
* once delivered). The research brief itself no longer renders from the
* tool part at all: it rides the steer message (the user-role delivery
* injected after the wake turn) and renders there via ResearchBriefCard.
*/
export function JobCard({ part }: ArtifactPartProps) {
if (part.state !== "output-available") return null;
return ;
}
/**
* The PDF reading brief (sources v0) โ markdown body + the consulted-pages
* line. Exported: the steer card renders it under the PDF-complete badge,
* the same expand-on-demand idiom as research.
*/
export function PdfBriefCard({ output }: { output: unknown }) {
const result = output as PdfResult | undefined;
if (!result || typeof result.brief !== "string") {
return (
PDF reading completed, but the result could not be displayed.
);
}
const failed = result.brief.startsWith("PDF failed");
return (
PDF brief
{failed && failed}
{result.brief}
{!failed && result.pagesConsulted && result.pagesConsulted.length > 0 && (
Pages consulted: {result.pagesConsulted.join(", ")}
)}
);
}
/**
* The research brief โ markdown body + a small source link list. Exported:
* the steer card (sub-agent result delivery) renders the same artifact.
*/
export function ResearchBriefCard({ output }: { output: unknown }) {
const result = output as ResearchResult | undefined;
if (!result || typeof result.brief !== "string") {
return (
Research completed, but the result could not be displayed.
);
}
const failed = result.brief.startsWith("Research failed");
return (
Research brief
{failed && failed}
{result.brief}
{result.sources.length > 0 && (
)}
);
}