practice agent: problem + conclude tools, doctrine prompt, handler branch
- tools/practice.ts: problem (terminate pose; commitment hidden in args) and conclude (non-terminating; outcome/verdict/reveal/rung/missClass/ retest), gated by activeProblemOf — pose-while-active and conclude- with-nothing-active both return invalidInputResult. - prompts/practice/00-base.md (voice + accuracy + tool mechanics) and 10-doctrine.md (the owner's doctrine verbatim; one approved edit — §I material arrival generalized). Practice composes its own directory ALONE: no teaching base, no shared fragments. - createPracticeAgent (teacher-agent.ts); chat-handler branch — kind 'practice' builds the practitioner from turn 1 and skips extraction. - problemResult/concludeResult acks in tool-execute (conclude text single-sourced: CONCLUDE_ACK_TEXT).
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { AgentTool, AgentToolResult } from "@earendil-works/pi-agent-core";
|
||||
import type { Static, TSchema } from "typebox";
|
||||
import { CONCLUDE_ACK_TEXT } from "../core/contracts/chat.ts";
|
||||
|
||||
/**
|
||||
* tool-execute — the execution machinery every server-side lh tool shares,
|
||||
@@ -230,3 +231,31 @@ export function questionResult(): AgentToolResult<null> {
|
||||
terminate: true,
|
||||
};
|
||||
}
|
||||
|
||||
/** The practice pose's ack (practice sessions, owner 2026-10-04): unlike
|
||||
* a question, this result is FINAL — it persists (persistTurn filters
|
||||
* only QUESTION_TOOLS placeholders), because the learner's submissions
|
||||
* arrive as MESSAGES, never as this call's result. terminate: true ends
|
||||
* the turn at the pose; the commitment rides the call's arguments. */
|
||||
export function problemResult(): AgentToolResult<null> {
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: "Problem posed — the turn ends here; the learner's thinking traces and answer commits arrive as labeled messages.",
|
||||
},
|
||||
],
|
||||
details: null,
|
||||
terminate: true,
|
||||
};
|
||||
}
|
||||
|
||||
/** The conclude ack: NOT terminate — the turn continues so the same reply
|
||||
* can reveal + pose the next problem. Text single-sourced in contracts
|
||||
* (CONCLUDE_ACK_TEXT — shared with the dismissal-synthesized pair). */
|
||||
export function concludeResult(): AgentToolResult<null> {
|
||||
return {
|
||||
content: [{ type: "text", text: CONCLUDE_ACK_TEXT }],
|
||||
details: null,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user