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-10-04 21:55:54 +03:00
|
|
|
import { ProblemCard, ConcludeCard } from "@/components/practice-cards";
|
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
|
2026-10-02 18:03:47 +03:00
|
|
|
* (the chat view's jobs feed reads GET /api/jobs?chatId=…; on completion call
|
2026-08-22 09:06:24 +03:00
|
|
|
* 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-10-04 21:55:54 +03:00
|
|
|
// The practice pair (2026-10-04): the pose renders the statement ONLY
|
|
|
|
|
// (the commitment lives in the call's arguments and never renders);
|
|
|
|
|
// the conclusion carries the outcome + verdict + the reveal.
|
|
|
|
|
problem: ProblemCard,
|
|
|
|
|
conclude: ConcludeCard,
|
2026-09-23 16:16:51 +03:00
|
|
|
// The prober's graph tools (wave 7): same quiet expandable card —
|
|
|
|
|
// collapsed one-liner (tool name + the session id for
|
|
|
|
|
// list_propositions), the tool's own compact row-per-line output
|
|
|
|
|
// (name / level / date) verbatim on expand, exactly the read/ls
|
|
|
|
|
// discipline (their results are pre-formatted strings too).
|
|
|
|
|
list_sessions: ToolCallCard,
|
|
|
|
|
list_propositions: ToolCallCard,
|
2026-08-22 09:06:24 +03:00
|
|
|
};
|