chore(cleanup): remove old SQLite coach pipeline
The entire local-SQLite Coach teaching pipeline (objective/level/plan/module agents, course-build stepper, written-exercise and drawing windows, review scheduler, screen/camera vision capture for blockage detection, and their renderer views) is retired: it will be replaced by a brand new 7-agent pipeline living server-side in Max API/Postgres, built in a later step. Removes src/main/coach/, the coach and vision skill definitions, the coach renderer views and CourseBuildStepper, drawRoughShapes, useCameraCapture, the camera-frame IPC bridge, and the shared coach/courseBuild/drawing types. Strips the corresponding pipeline guard-rails, system-prompt instructions and IPC handlers from openrouter.ts/index.ts/preload. Drops the now-unused mermaid/roughjs dependencies. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -24,16 +24,6 @@ vi.mock('../../src/main/ai/elevenlabs', () => ({ synthesizeSpeech }))
|
||||
const sendToRenderer = vi.fn()
|
||||
vi.mock('../../src/main/windowBridge', () => ({ sendToRenderer }))
|
||||
|
||||
const getSubjectLevel = vi.fn((): string | null => null)
|
||||
vi.mock('../../src/main/coach/coachStore', () => ({ getSubjectLevel }))
|
||||
|
||||
const recordCourseBuildTool = vi.fn()
|
||||
const clearCourseBuild = vi.fn()
|
||||
vi.mock('../../src/main/coach/courseBuildStepper', () => ({
|
||||
recordCourseBuildTool,
|
||||
clearCourseBuild
|
||||
}))
|
||||
|
||||
const { getAssistantReply } = await import('../../src/main/ai/openrouter')
|
||||
|
||||
function okResponse(body: unknown): Response {
|
||||
@@ -65,7 +55,6 @@ describe('getAssistantReply()', () => {
|
||||
vi.clearAllMocks()
|
||||
vi.stubGlobal('fetch', vi.fn())
|
||||
currentSkills = []
|
||||
getSubjectLevel.mockReturnValue(null)
|
||||
process.env.OPENROUTER_API_KEY = 'test-key'
|
||||
setCurrentUserEmail('test@example.com')
|
||||
})
|
||||
@@ -198,64 +187,3 @@ describe('getAssistantReply()', () => {
|
||||
await expect(getAssistantReply('boucle indefiniment')).rejects.toThrow(/Trop d'appels d'outils/)
|
||||
}, 20000)
|
||||
})
|
||||
|
||||
describe('getAssistantReply() — garde-fous du pipeline Coach', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
vi.stubGlobal('fetch', vi.fn())
|
||||
getSubjectLevel.mockReturnValue(null)
|
||||
process.env.OPENROUTER_API_KEY = 'test-key'
|
||||
setCurrentUserEmail('test@example.com')
|
||||
currentSkills = [
|
||||
{
|
||||
name: 'research_topic',
|
||||
description: '',
|
||||
parameters: {},
|
||||
execute: vi.fn(async () => 'Recherche enregistree.')
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
it('should force a retry toward generate_course_plan when research_topic was called but not the plan', async () => {
|
||||
const executeGeneratePlan = vi.fn(async () => 'Plan enregistre.')
|
||||
currentSkills.push({
|
||||
name: 'generate_course_plan',
|
||||
description: '',
|
||||
parameters: {},
|
||||
execute: executeGeneratePlan
|
||||
})
|
||||
// Des que le nudge a ete pousse une fois (verifie par l'appel ci-dessous), on simule que le
|
||||
// niveau vient d'etre enregistre pour ne pas enchainer sur tous les nudges suivants du pipeline
|
||||
// (plan -> contenu -> evaluation) : seul le declenchement de CE nudge precis est teste ici.
|
||||
getSubjectLevel.mockImplementation(() =>
|
||||
executeGeneratePlan.mock.calls.length > 0 ? 'debutant' : null
|
||||
)
|
||||
vi.mocked(fetch)
|
||||
.mockResolvedValueOnce(okResponse(toolCallMessage('research_topic', { subject: 'algebre' })))
|
||||
.mockResolvedValueOnce(okResponse(textMessage("J'ai fini pour l'instant.")))
|
||||
.mockResolvedValueOnce(
|
||||
okResponse(toolCallMessage('generate_course_plan', { subject: 'algebre' }))
|
||||
)
|
||||
.mockResolvedValueOnce(okResponse(textMessage('Plan en cours.')))
|
||||
|
||||
const reply = await getAssistantReply('apprends-moi algebre')
|
||||
expect(executeGeneratePlan).toHaveBeenCalled()
|
||||
expect(reply).toBe('Plan en cours.')
|
||||
})
|
||||
|
||||
it('should force a retry when the model announces an action at round 0 without calling any tool', async () => {
|
||||
// "subject" est volontairement omis : on isole ici le garde-fou "annonce au round 0", pas celui
|
||||
// du pipeline (recherche -> plan), qui se redeclencherait sinon des que trackedSubject est fixe.
|
||||
vi.mocked(fetch)
|
||||
.mockResolvedValueOnce(
|
||||
okResponse(
|
||||
textMessage("Je vais t'apprendre la trigonometrie ! Commencons par une recherche.")
|
||||
)
|
||||
)
|
||||
.mockResolvedValueOnce(okResponse(toolCallMessage('research_topic', {})))
|
||||
.mockResolvedValueOnce(okResponse(textMessage('Recherche terminee, module prepare.')))
|
||||
|
||||
const reply = await getAssistantReply('apprends-moi la trigonometrie')
|
||||
expect(reply).toBe('Recherche terminee, module prepare.')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user