Files
learnharness/components/artifacts/index.ts
T
amosblomqvist 7479dce8ef Wave 7 interlude: prober tool-call chrome + live rename cluster labels
Graph tool-call visibility — the prober's list_sessions /
list_propositions rendered like nothing happened in the transcript
(the registry default is silence for unregistered tools). They now join
the EXACT read/ls/find/grep discipline: artifactRenderers maps both to
the ToolCallCard — collapsed one-liner, expandable Input/Output card.
The results ride the card's string path verbatim (the tools' own
compact name/level/date line format), exactly how read results render.

- list_propositions gets a headline arg: the session id is the call's
  subject — the collapsed line reads "list_propositions chat_…".
  Shown as given, never resolved (the same no-resolution rule as
  read's path). list_sessions carries no arg (empty input — the
  ls-with-no-path discipline).
- No bespoke row-layout card: the outputs are pre-formatted strings
  (the model-facing format IS the learner-facing format here), and
  the dispatch's "SAME look" directive settles the shape question.

Live rename labels — renaming a session anywhere (sidebar inline row,
chat header) already announces lh:chat-renamed {id, title}; the graph
view now listens. The birth-session partition means the title IS the
cluster label, so the patch is targeted and in-place, no refetch: the
snapshot's sessions map (the detail card's provenance line) and the
one matching cluster. The new snapshot object flows the existing
setData → geoVersion → rebuild chain, so the wrapped label (wave 7's
wrapRegionLabel) re-wraps for the new text. Unlabeled clusters keep
their hull-only silence — a null label is a GONE record, the guard
holds the line.

Tests: registry pins for both tools + the prober-card render (collapsed
headline, verbatim rows, no-arg discipline). 855/855; live-verified on
:3001 with fillText instrumentation: both cards render collapsed and
expandable in the transcript, and a sidebar rename flipped the canvas
cluster label old→new with the old label's draws stopping cold.
2026-09-23 16:16:51 +03:00

48 lines
2.2 KiB
TypeScript

import type { ComponentType } from "react";
import type { ArtifactPartProps } from "@/src/core";
import { DemoCard } from "@/components/artifacts/demo-card";
import { JobCard, PdfJobCard } from "@/components/artifacts/job-card";
import { VisualCard } from "@/components/artifacts/visual-card";
import { ProbeDoneCard } from "@/components/artifacts/probe-done-card";
import { ToolCallCard } from "@/components/artifacts/tool-call-card";
/**
* 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>> = {
research: JobCard,
pdf: PdfJobCard, // sources v0 — live smoke 2026-09-19 caught the gap: without this the tool-pdf dispatch part rendered nothing
// 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).
// Artifacts (W6 fills in the components):
demo: DemoCard,
visual: VisualCard,
// 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,
// 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,
// 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,
};