All files / web/src/components/toys/euclid/characters pappusConfig.ts

0% Statements 0/75
0% Branches 0/1
0% Functions 0/1
0% Lines 0/75

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76                                                                                                                                                       
/**
 * Pappus's GeometryVoiceConfig — assembles all Pappus-specific pieces
 * into a single config object consumed by the context provider.
 */

import type { GeometryVoiceConfig } from '../GeometryTeacherConfig'
import { PAPPUS_CHARACTER_DEF } from '../pappusCharacterDef'
import { EUCLID_ENTITY_MARKERS } from '../euclidEntityMarkers'
import { buildPappusCompletionContext } from '../pappusCharacter'
import { createGreetingMode } from '../agent/modes/greetingMode'
import { createConversingMode } from '../agent/modes/conversingMode'
import { createThinkingMode } from '../agent/modes/thinkingMode'
import { buildChatSystemPrompt, type ChatSystemPromptContext } from '../chat/buildChatSystemPrompt'
import { teacherAttitude } from '../agent/attitudes/teacher'

export const pappusConfig: GeometryVoiceConfig = {
  definition: PAPPUS_CHARACTER_DEF,
  attitudeId: 'teacher',
  entityMarkers: EUCLID_ENTITY_MARKERS,

  voice: {
    id: 'echo',
    sessionEndpoint: '/api/realtime/euclid/session',
    chatEndpoint: '/api/realtime/euclid/chat',
    thinkHardEndpoint: '/api/realtime/euclid/think-hard',
    baseDurationMs: 3 * 60 * 1000,
    extensionMs: 2 * 60 * 1000,
  },

  modes: {
    greeting: createGreetingMode({ character: PAPPUS_CHARACTER_DEF, attitude: teacherAttitude }),
    conversing: createConversingMode({
      character: PAPPUS_CHARACTER_DEF,
      buildCompletionContext: buildPappusCompletionContext,
      attitude: teacherAttitude,
    }),
    thinking: createThinkingMode({
      character: PAPPUS_CHARACTER_DEF,
      metaphors: {
        consulting: 'your Collection',
        tool: 'your notes',
        ownership: 'it is the kind of reasoning you have studied deeply',
        framework:
          "the established geometric principles (Euclid's postulates, definitions, common notions)",
        examples: [
          'Let me consult my notes on this.',
          'One moment — I need to check what I wrote about this.',
          'I studied this carefully. Let me recall.',
          'Hold on — let me think this through.',
        ],
      },
      attitude: teacherAttitude,
    }),
  },

  buildChatSystemPrompt: (ctx: ChatSystemPromptContext) =>
    buildChatSystemPrompt(
      { character: PAPPUS_CHARACTER_DEF, buildCompletionContext: buildPappusCompletionContext },
      ctx
    ),
  buildCompletionContext: buildPappusCompletionContext,
  chatAssistantPriming:
    'I understand. I am Pappus of Alexandria, ready to guide you. I will use {seg:AB}, {tri:ABC}, {ang:ABC}, {pt:A} markers for geometric references and {def:N}, {post:N}, {cn:N}, {prop:N} markers when citing foundations and propositions. I may use {tag:value|display text} for custom phrasing.',

  messages: {
    timeWarning:
      '[System: Only 15 seconds left. Wrap up the current point — you have other students and your Collection to attend to. Do NOT mention timers or countdowns. Stay in character as a busy, dedicated scholar.]',
    timeExpired:
      '[System: Time is up. End the lesson warmly but firmly — give the student something to think about for next time. e.g. "That is enough for today. Consider what we discussed — the insight will deepen with reflection. We will continue next time." Then call hang_up.]',
    historyLabel: 'Pappus',
    thinkingLabel: 'Consulting the Collection',
    thinkingFeedback: 'Let me consult my Collection...',
    thinkingResultPrefix: 'From your Collection',
  },
}