feat: custom message types for system turns — wake and verdict messages
The custom-message scheme (user-decided 2026-09-12): system-authored
user-role messages are NOT human messages — they carry marker data parts
only, the adapter owns their model-facing wording, and the UI renders
them under control. Nothing fake is ever persisted as human speech.
The inventory (all migrated):
- probe→teacher handoff wake: was a text-bearing user message rendering
as a fake user bubble; now data-probe-handoff marker-only — the
adapter flattens it to HANDOFF_TEXT (core/contracts/chat.ts), the UI
renders a quiet 'Preparing your plan…' system line.
- plan accept/decline: was boilerplate text ('The plan is accepted…',
'I'd like the plan revised…') masquerading as learner speech — the
decline wasn't even marked; now data-verdict {accepted, at} on its own
message, adapter flattens to verdictText(), UI renders the quiet
verdict marker ('✓ Plan accepted' / '↻ Plan revision requested').
sendVerdict sends TWO REAL MESSAGES when the learner typed a note
(the note as a genuine user message, then the verdict) in ONE turn
via setMessages + sendMessage() — no 409 dance, no double teacher turn.
- sub-agent steers: the abort steer gains its data-subagent-aborted
marker part; the UI keys steer rendering off PARTS (artifact/aborted),
not metadata — metadata stays as pump mechanics only.
- record-adapter: systemTextOf() flattens marker-only messages; steers
keep their text (payload — briefs are content, not boilerplate).
phases.ts: plan→teach advances on data-verdict{accepted:true} only;
learner text alone can never sanction teaching (pinned). data-plan-
accepted retired, no back-compat (user-decided: wiped-data doctrine).
Pinned: record-adapter.test.ts (verdict/handoff flattening, note+verdict
order, steer payload kept, UI-only parts skipped), phases.test.ts
(verdict marker semantics, out-of-order, text-never-fakes), jobs.test.ts
(abort marker part), demos.test.tsx (badge renders off the part, not
metadata).
Live GLM smoke (disposable driver, deleted): probe→conclude→wake→plan→
decline-with-note (revised, still plan)→accept-with-note (teach) — ALL
CHECKS PASS, including marker-only handoff/verdict on the wire and zero
fake human speech in the transcript.
Gates: tsc, lint, build, 335/335.
This commit is contained in:
@@ -123,16 +123,39 @@ export interface TurnUsage {
|
||||
* block renders current node + direct parents + direct children in its own
|
||||
* small container, the current node glowing — clearly a fragment, not the
|
||||
* whole plan. Clicking either opens the full plan in a popup. */
|
||||
/** The learner's plan-acceptance marker (docs/probe-teach-split.md §4): a
|
||||
* data part riding the accept-click user message. It is THE plan→teach
|
||||
* phase seam — phaseAt3 reads it from the transcript;
|
||||
* convertToModelMessages drops data parts, so the teacher only sees the
|
||||
* message's text; the marker is for derivation and the UI. */
|
||||
export interface PlanAcceptedData {
|
||||
/** ISO timestamp of the accept click. */
|
||||
/** The learner's plan verdict (docs/probe-teach-split.md §4): a data part
|
||||
* riding its own user message — the ONLY thing on that message. It is THE
|
||||
* plan→teach phase seam (phaseAt3 reads accepted from the transcript), and
|
||||
* both verdicts are real transcript events: accept sanctions teaching,
|
||||
* decline asks for revision. The part is the message TYPE (the "custom
|
||||
* message" scheme, 2026-09-12): the message carries no human-authored text,
|
||||
* the model-facing wording is owned by the adapter (record-adapter.ts
|
||||
* flattens it to VERDICT_TEXT below), and the UI renders the verdict
|
||||
* marker — never a user bubble. A learner who also typed a note sends the
|
||||
* note as its own real user message first; the verdict message follows. */
|
||||
export interface PlanVerdictData {
|
||||
/** true = accept (sanction to teach); false = decline (revise the plan). */
|
||||
accepted: boolean;
|
||||
/** ISO timestamp of the click. */
|
||||
at: string;
|
||||
}
|
||||
|
||||
/** The model-facing text of a verdict message — single-sourced here so the
|
||||
* adapter, the tests, and reality can't drift apart. */
|
||||
export function verdictText(accepted: boolean): string {
|
||||
return accepted
|
||||
? "The learner accepted the plan — begin teaching."
|
||||
: "The learner would like the plan revised before teaching begins.";
|
||||
}
|
||||
|
||||
/** The model-facing text of the probe→teach handoff wake (the custom-message
|
||||
* scheme): the wake message carries only the data-probe-handoff part, and
|
||||
* the adapter flattens it to THIS. Single-sourced so the prober's seam, the
|
||||
* tests, and reality can't drift apart. */
|
||||
export const HANDOFF_TEXT =
|
||||
"The probe is concluded — the learner assessment is recorded. " +
|
||||
"Author the session's plan map now (call plan_init) and present it, then begin teaching.";
|
||||
|
||||
export interface PlanBlockData {
|
||||
/** Only "full" survives (the 2026-09-11 pivot): the plan renders IN
|
||||
* FLOW once, at authoring. The neighborhood fragments are retired —
|
||||
|
||||
Reference in New Issue
Block a user