2026-08-22 09:06:24 +03:00
|
|
|
import type { ComponentType } from "react";
|
2026-08-31 19:51:17 +03:00
|
|
|
import type { ArtifactPartProps } from "@/src/core";
|
2026-08-22 10:03:20 +03:00
|
|
|
import { DemoCard } from "@/components/artifacts/demo-card";
|
2026-09-19 16:27:11 +03:00
|
|
|
import { JobCard, PdfJobCard } from "@/components/artifacts/job-card";
|
2026-08-22 10:03:20 +03:00
|
|
|
import { VisualCard } from "@/components/artifacts/visual-card";
|
2026-09-11 06:44:20 +03:00
|
|
|
import { ProbeDoneCard } from "@/components/artifacts/probe-done-card";
|
2026-09-19 16:50:20 +03:00
|
|
|
import { ToolCallCard } from "@/components/artifacts/tool-call-card";
|
2026-08-22 09:06:24 +03:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Artifact renderer registry — the extension point for tool-part UI.
|
|
|
|
|
*
|
|
|
|
|
* chat.tsx renders any tool part it doesn't specially handle (i.e. not
|
|
|
|
|
* quiz/ask) by looking the tool name up here. Add your renderer — do NOT
|
|
|
|
|
* edit chat.tsx (see docs/plan.md file-ownership rules).
|
|
|
|
|
*
|
|
|
|
|
* Typical shape: while the part is input-available render an activity card
|
|
|
|
|
* (poll GET /api/jobs?chatId=…; on completion call
|
|
|
|
|
* ChatActionsContext.syncFromServer()); when output-available render the
|
|
|
|
|
* artifact itself from part.output.
|
|
|
|
|
*/
|
|
|
|
|
export const artifactRenderers: Record<string, ComponentType<ArtifactPartProps>> = {
|
2026-08-22 09:36:15 +03:00
|
|
|
research: JobCard,
|
2026-09-19 16:27:11 +03:00
|
|
|
pdf: PdfJobCard, // sources v0 — live smoke 2026-09-19 caught the gap: without this the tool-pdf dispatch part rendered nothing
|
2026-09-01 18:31:01 +03:00
|
|
|
// plan_* parts render nothing inline by design: the phase seam is a
|
|
|
|
|
// message-level boundary, drawn by PhaseDivider in chat.tsx (the old
|
|
|
|
|
// part-level plan_init divider retired with it).
|
2026-08-22 10:03:20 +03:00
|
|
|
// Artifacts (W6 fills in the components):
|
|
|
|
|
demo: DemoCard,
|
|
|
|
|
visual: VisualCard,
|
2026-09-11 06:44:20 +03:00
|
|
|
// The probe conclusion: the assessment belongs to the learner as much as
|
|
|
|
|
// to the transcript (docs/probe-teach-split.md §2). Plain v1 card.
|
|
|
|
|
probe_done: ProbeDoneCard,
|
2026-09-19 16:50:20 +03:00
|
|
|
// The learner-filesystem set (sources v1): one quiet expandable
|
|
|
|
|
// tool-call card each — collapsed one-liner (tool name + headline
|
|
|
|
|
// argument), full input/output on expand.
|
|
|
|
|
read: ToolCallCard,
|
|
|
|
|
ls: ToolCallCard,
|
|
|
|
|
find: ToolCallCard,
|
|
|
|
|
grep: ToolCallCard,
|
2026-08-22 09:06:24 +03:00
|
|
|
};
|