2026-08-22 02:18:27 +03:00
|
|
|
import type { UIMessage } from "ai";
|
2026-09-11 06:44:20 +03:00
|
|
|
import type {
|
|
|
|
|
DemoToolInput,
|
2026-09-12 05:14:40 +03:00
|
|
|
PlanVerdictData,
|
2026-09-11 06:44:20 +03:00
|
|
|
PlanBlockData,
|
|
|
|
|
ProbeDoneInput,
|
|
|
|
|
ProbeDoneResult,
|
|
|
|
|
ResearchToolInput,
|
|
|
|
|
SubagentArtifactData,
|
2026-09-12 05:14:40 +03:00
|
|
|
SubagentResultMeta,
|
2026-09-11 06:44:20 +03:00
|
|
|
VisualToolInput,
|
|
|
|
|
} from "./contracts.ts";
|
2026-08-31 19:51:17 +03:00
|
|
|
import type { AskToolInput, QuestionAnswerData, QuizToolInput } from "./question-core.ts";
|
2026-08-22 02:18:27 +03:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The typed UI message for the teacher chat — gives the frontend typed tool
|
2026-09-01 19:15:43 +03:00
|
|
|
* parts ("tool-quiz" / "tool-ask_user_question" / "tool-research" / …) without
|
|
|
|
|
* importing the server-side agent into the client bundle.
|
2026-08-22 02:18:27 +03:00
|
|
|
*
|
2026-09-01 19:15:43 +03:00
|
|
|
* Question tools are CLIENT-SIDE (no execute): their OUTPUT type is the
|
|
|
|
|
* structured answer record the client builds and sends via addToolOutput.
|
|
|
|
|
* Job tools are SERVER-EXECUTED: their output is the plain-string dispatch
|
|
|
|
|
* acknowledgement (the result later arrives as a steer message — see
|
|
|
|
|
* SubagentSteerMessage in contracts.ts, whose artifact rides the
|
|
|
|
|
* data-subagent-artifact part typed here as DATA_PARTS).
|
2026-08-22 02:18:27 +03:00
|
|
|
*/
|
|
|
|
|
export type TeacherUITools = {
|
|
|
|
|
quiz: { input: QuizToolInput; output: QuestionAnswerData };
|
|
|
|
|
ask_user_question: { input: AskToolInput; output: QuestionAnswerData };
|
2026-09-11 06:44:20 +03:00
|
|
|
/** The prober's conclusion tool (docs/probe-teach-split.md §2): the
|
|
|
|
|
* input IS the learner assessment; the output confirms the handoff. */
|
|
|
|
|
probe_done: { input: ProbeDoneInput; output: ProbeDoneResult };
|
2026-09-01 19:15:43 +03:00
|
|
|
research: { input: ResearchToolInput; output: string };
|
|
|
|
|
demo: { input: DemoToolInput; output: string };
|
|
|
|
|
visual: { input: VisualToolInput; output: string };
|
2026-08-22 02:18:27 +03:00
|
|
|
};
|
|
|
|
|
|
2026-09-01 19:15:43 +03:00
|
|
|
export type TeacherUIDataParts = {
|
|
|
|
|
"subagent-artifact": SubagentArtifactData;
|
2026-09-11 03:26:56 +03:00
|
|
|
/** Plan blocks (wave 4): frozen plan snapshots rendered in the chat flow. */
|
|
|
|
|
"plan-block": PlanBlockData;
|
2026-09-12 05:14:40 +03:00
|
|
|
/** The learner's plan verdict (accept/decline): its own user message,
|
|
|
|
|
* carrying ONLY this part — the plan→teach phase seam (docs/probe-
|
|
|
|
|
* teach-split.md §4, the custom-message scheme 2026-09-12). */
|
|
|
|
|
verdict: PlanVerdictData;
|
|
|
|
|
/** The probe→teach handoff wake: the wake pipeline's steer message,
|
|
|
|
|
* carrying ONLY this part (the model-facing text lives in the adapter). */
|
|
|
|
|
"probe-handoff": { chatId: string };
|
|
|
|
|
/** The abort steer's message-type marker (the abort badge renders off it). */
|
|
|
|
|
"subagent-aborted": SubagentResultMeta & { aborted: true };
|
2026-09-01 19:15:43 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type TeacherUIMessage = UIMessage<unknown, TeacherUIDataParts, TeacherUITools>;
|