fix(pdf): render the pdf dispatch card (live browser-smoke gap)

The browser e2e check on the live dispatch session found the tool-pdf
part rendered NO card: the artifact renderer registry had no pdf entry
(the doc comment literally says "add your renderer here"), and the typed
TeacherUITools union + the chat.tsx job-part enumerations (poll cadence,
dispatch nudge, settle-sync) all missed the new tool kind.

- PdfJobCard in job-card.tsx: the research JobCard idiom, kind pdf —
  registered in artifacts/index.ts.
- ui-message.ts: pdf entry in TeacherUITools (fire-and-forget ack output).
- chat.tsx: two mechanical "tool-pdf" additions to the research/demo/visual
  enumerations — UI-stream file, flagged for review at merge (same
  treatment as the activity-dock type-forced entries).
- demos.test.tsx: live/settled dispatch-card renders + registry pin.
This commit is contained in:
amosblomqvist
2026-09-19 16:27:11 +03:00
parent 2780166904
commit dfe1a21989
5 changed files with 74 additions and 4 deletions
+45 -1
View File
@@ -40,7 +40,7 @@ import {
import { sanitizeSvg, VisualCard } from "../components/artifacts/visual-card.tsx";
import { SubagentSteerCard } from "../components/artifacts/steer-card.tsx";
import { DispatchCard } from "../components/artifacts/dispatch-card.tsx";
import { JobCard } from "../components/artifacts/job-card.tsx";
import { JobCard, PdfJobCard } from "../components/artifacts/job-card.tsx";
import { JobsContext } from "../components/jobs-context.ts";
import { demoInputSchema, jobTools, pdfInputSchema, visualInputSchema } from "../src/agent/tools/jobs.ts";
import { runDemoBuilder } from "../src/agent/subagents/demo-builder.ts";
@@ -289,6 +289,48 @@ describe("dispatch card rendering (the tool-call ack box)", () => {
);
assert.equal(html, "");
});
// sources v0 — the live browser smoke (2026-09-19) caught the pdf dispatch
// part rendering nothing: PdfJobCard is the fix.
it("pdf dispatch renders the live PDF-reader card while the job runs", () => {
const pdfJob: JobRecord = ({
id: "jp1",
kind: "pdf",
chatId: "c",
toolCallId: "call-1",
status: "running",
activity: 'pdf_render: 42-44 @150dpi',
createdAt: new Date(Date.now() - 5000).toISOString(),
updatedAt: new Date().toISOString(),
}) as JobRecord;
const html = renderToStaticMarkup(
<JobsContext.Provider value={[pdfJob]}>
<PdfJobCard part={ackPart as never} />
</JobsContext.Provider>,
);
assert.match(html, /PDF reader/);
assert.match(html, /pdf_render/);
});
it("pdf dispatch settles to the delivered one-liner", () => {
const pdfJob: JobRecord = ({
id: "jp1",
kind: "pdf",
chatId: "c",
toolCallId: "call-1",
status: "done",
activity: "delivered",
createdAt: new Date(Date.now() - 5000).toISOString(),
updatedAt: new Date().toISOString(),
}) as JobRecord;
const html = renderToStaticMarkup(
<JobsContext.Provider value={[pdfJob]}>
<PdfJobCard part={ackPart as never} />
</JobsContext.Provider>,
);
assert.match(html, /PDF reader/);
assert.match(html, /delivered/);
});
});
describe("steer card rendering (the delivered artifact)", () => {
@@ -802,5 +844,7 @@ describe("tool + renderer registry wiring", () => {
it("the artifact renderer registry maps demo/visual to the W6 cards", () => {
assert.equal(artifactRenderers.demo, DemoCard);
assert.equal(artifactRenderers.visual, VisualCard);
// sources v0 — pdf maps to its dispatch card (the live-smoke gap)
assert.equal(artifactRenderers.pdf, PdfJobCard);
});
});