feat: probe/teach agent split — explicit phase markers, position-only plan map
Diagnosis (2026-09-11 user testing, minimal-effort GLM): sessions stuck on 'plan' forever. Two causes: (1) the three-phase view read the stored tree's currentNodeId, which nothing ever writes post author-once (2026-09-03) — a structural dead seam; (2) the teacher stochastically left quiz.nodeId untagged, and done-by-quiz-result semantics would have falsely completed nodes anyway. The redesign (docs/probe-teach-split.md) abolishes derived occupancy in favor of explicit events: - Two agents over one transcript: createProberAgent (quiz without a nodeId field, ask, probe_done) and createTeacherAgent (full toolset, plan_init onward). The chat-handler construction branch keys on a probe_done part in the transcript. MODELS.prober added. - probe_done: server-side seam tool — carries the learner assessment (strands + free-form edge read), refuses while a question is open or the probe is already concluded, and queues a handoff steer through the generalized wake pipeline (steers now dedupe by id, not jobId; job finalization only for job steers). The teacher auto-wakes and authors the plan; the learner sees the assessment via the probe-done card. - phases: probe ends at a concluded probe_done, plan ends at a successful plan_init — strictly sequential, no skipping, no legacy compatibility (data wiped at the pivot per doctrine). - Plan map = position, not completion: derivePlanStatuses reads only tagged quiz CALLS (state/outcome feed nothing); current = latest tagged node with consecutive duplicates collapsed, visited = earlier distinct stays (a revisit stays in both — current wins at render). PlanTree is structure-only; currentNodeId/doneNodeIds and the dead mutation helpers are gone. No fallback current. - Prompts split per agent (prompts/prober/, prompts/teacher/ over the trimmed shared base); graph-context injection removed entirely (shelved, docs/probe-teach-split.md §5); knowledge-graph context no longer reaches either agent. - Plan blocks are full-only snapshots at plan_init (neighborhood machinery retired; the persistent DAG window is the future UI wave); usage capture unchanged. Gates: tsc clean, 294/294 tests (phases/plan-tree/plan-blocks/question- tools rewritten to the new semantics; probe-done + handoff-wake tests added), lint, build. Live GLM smoke PASS: prober concluded with an honest assessment, teacher auto-woke, authored a 10-node plan with the block attached, then tagged checks on slope-instinct → secant derived current/ visited exactly as designed; grading honest both ways (driver off-by-one proved a wrong answer grades false).
This commit is contained in:
@@ -3,6 +3,7 @@ import type { ArtifactPartProps } from "@/src/core";
|
||||
import { DemoCard } from "@/components/artifacts/demo-card";
|
||||
import { JobCard } from "@/components/artifacts/job-card";
|
||||
import { VisualCard } from "@/components/artifacts/visual-card";
|
||||
import { ProbeDoneCard } from "@/components/artifacts/probe-done-card";
|
||||
|
||||
/**
|
||||
* Artifact renderer registry — the extension point for tool-part UI.
|
||||
@@ -24,4 +25,7 @@ export const artifactRenderers: Record<string, ComponentType<ArtifactPartProps>>
|
||||
// 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,
|
||||
};
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
"use client";
|
||||
|
||||
import { ClipboardCheckIcon } from "lucide-react";
|
||||
import type { ProbeDoneResult, ProbeDoneInput } from "@/src/core";
|
||||
|
||||
/**
|
||||
* The probe conclusion card (docs/probe-teach-split.md §2): renders the
|
||||
* prober's probe_done call. The INPUT is the learner assessment — strand by
|
||||
* strand, where his edge sits — and it belongs to the learner as much as to
|
||||
* the transcript: it streams live while the prober writes it and stays as
|
||||
* the handoff artifact. The OUTPUT is the seam's ack (ok) or the refusal
|
||||
* the prober retried on (rendered quiet and small — it is model-facing
|
||||
* bookkeeping, kept only for transcript honesty).
|
||||
*
|
||||
* Deliberately plain v1: the proper assessment viewer design is deferred to
|
||||
* the UI wave; this card just guarantees the data is never invisible.
|
||||
*/
|
||||
export function ProbeDoneCard({ part }: { part: { input?: unknown; output?: unknown } }) {
|
||||
const input = part.input as ProbeDoneInput | undefined;
|
||||
const output = part.output as ProbeDoneResult | undefined;
|
||||
const assessment = output?.ok ? output.assessment : (input?.assessment ?? null);
|
||||
|
||||
return (
|
||||
<div data-testid="probe-done-card" className="my-3 rounded-xl border bg-card/60 p-3">
|
||||
<div className="mb-2 flex items-center gap-2 text-xs font-medium uppercase tracking-wide text-muted-foreground">
|
||||
<ClipboardCheckIcon className="size-3.5 text-primary" />
|
||||
Probe concluded — your assessment
|
||||
</div>
|
||||
{output && !output.ok ? (
|
||||
<p className="text-sm text-muted-foreground">The prober retried: {output.error}</p>
|
||||
) : assessment ? (
|
||||
<div className="space-y-2">
|
||||
{assessment.strands.map((s, i) => (
|
||||
<div key={i} className="rounded-lg bg-background/60 px-3 py-2">
|
||||
<div className="text-sm font-medium">{s.strand}</div>
|
||||
<div className="mt-0.5 text-sm text-muted-foreground">{s.assessment}</div>
|
||||
</div>
|
||||
))}
|
||||
{assessment.summary && (
|
||||
<p className="px-1 text-sm text-muted-foreground">{assessment.summary}</p>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-sm text-muted-foreground">Writing the assessment…</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user