User pivot (2026-09-19): no attachments UI at all. Pasting paths is native for technical users and alien for everyone else - so the agent gets the tools to find what the learner merely NAMES. The learner communicates in messages; the agent locates and reads. Zero cross-stream seams: paths already live in tool parts, so the sources "list" is the transcript. - ls/find/grep: pi-verbatim schemas, descriptions, and output formats (fd's glob semantics, rg's path:line: match format, pi's truncation notices), ported to pure Node - no binaries, no shell-out, read-only by construction. Deltas from pi: home-anchored resolution (the harness has no cwd), .gitignore replaced by hard noise exclusions (node_modules/.git/Library/.Trash), 10s walk timeout with partial results. - read: description swapped to pi-verbatim (doctrine moved to the prompt); relative paths now resolve against the learner's home like the rest. - prompts/shared/05-learner-files.md: one minimal doctrine fragment composed into BOTH agents (composeInstructions grew a shared/ dir, before the agent's own fragments). teacher/30-jobs.md keeps only the pdf-dispatch addendum. - ToolCallCard: the generic quiet tool-call card the user specced - collapsed one-liner (tool name + headline argument), expandable to full input/output, errors red, image payloads never render. Registered for read/ls/find/grep. - ui-message.ts: TeacherUITools entries for the four tools (mechanical). - tests: fs-tools suite (glob semantics, pi formats, exclusions, limits), registry/card renders, shared-fragment composition pins, tool-registry key updates, read re-anchor.
41 lines
1.9 KiB
TypeScript
41 lines
1.9 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,
|
|
};
|