feat(sessions): wire Agents 2-4 into the pipeline orchestration
confirmObjective() now chains Agent 2 (mapping) then starts Agent 3 (level) synchronously after Agent 1 confirms - by the time the HTTP response returns, session.status is already "level_assessment" and the response carries Agent 3's first question in a new "nextPrompt" field, to be spoken aloud (never displayed as text). New endpoints: POST /sessions/:id/level/confirm (runs Agent 4, advances to "planning") and POST /sessions/:id/level/dispute. routeIncomingMessage dispatches "level_assessment" sessions to LevelAgent.converse(), same single entry point used for text and voice. RouteMessageResponseDto gains levelDone/levelProfile fields: every response field is a structured, typed signal the frontend's main process can branch on to decide whether to open a result window - never an instruction embedded in the LLM's reply text. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
5c00976e8f
commit
755bc07d18
@@ -0,0 +1,19 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, MaxLength, MinLength } from 'class-validator';
|
||||
|
||||
export class LevelDisputeDto {
|
||||
@ApiProperty({ example: 'Shaders de vertex' })
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
@MaxLength(200)
|
||||
concept!: string;
|
||||
|
||||
@ApiProperty({
|
||||
example:
|
||||
"J'ecrirais un shader qui modifie gl_Position selon une matrice de rotation.",
|
||||
})
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
@MaxLength(2000)
|
||||
answer!: string;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { LevelGapDto } from './level-turn-response.dto';
|
||||
|
||||
export class LevelProfileResponseDto {
|
||||
@ApiProperty() id!: number;
|
||||
@ApiProperty() sessionId!: number;
|
||||
@ApiProperty({ type: [String] }) mastered!: string[];
|
||||
@ApiProperty({ type: [LevelGapDto] }) gaps!: LevelGapDto[];
|
||||
@ApiProperty({ type: [String] }) unknown!: string[];
|
||||
@ApiProperty({ enum: ['beginner', 'intermediate', 'advanced'] })
|
||||
overallLevel!: 'beginner' | 'intermediate' | 'advanced';
|
||||
@ApiProperty({ required: false }) completedAt?: Date;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
export class LevelGapDto {
|
||||
@ApiProperty() concept!: string;
|
||||
@ApiProperty() description!: string;
|
||||
}
|
||||
|
||||
export class LevelProfileDto {
|
||||
@ApiProperty({ type: [String] }) mastered!: string[];
|
||||
@ApiProperty({ type: [LevelGapDto] }) gaps!: LevelGapDto[];
|
||||
@ApiProperty({ type: [String] }) unknown!: string[];
|
||||
@ApiProperty({ enum: ['beginner', 'intermediate', 'advanced'] })
|
||||
overallLevel!: 'beginner' | 'intermediate' | 'advanced';
|
||||
}
|
||||
|
||||
export class LevelTurnResponseDto {
|
||||
@ApiProperty({
|
||||
description: 'Question de Max, ou transition une fois le profil pret.',
|
||||
})
|
||||
reply!: string;
|
||||
|
||||
@ApiProperty({
|
||||
description:
|
||||
'true une fois les 3-5 questions posees et le profil pret a etre confirme via POST /sessions/:id/level/confirm.',
|
||||
})
|
||||
done!: boolean;
|
||||
|
||||
@ApiProperty({ type: LevelProfileDto, required: false })
|
||||
profile?: LevelProfileDto;
|
||||
}
|
||||
@@ -1,6 +1,11 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { ObjectiveDraftDto } from './objective-message-response.dto';
|
||||
import { LevelProfileDto } from './level-turn-response.dto';
|
||||
|
||||
// Chaque champ optionnel ci-dessous est un signal structure et non ambigu que le frontend (Max
|
||||
// Avatar) utilise pour decider, en code, d'ouvrir ou non une fenetre dediee (ObjectiveValidationCard,
|
||||
// LevelResultCard, etc.) - jamais une instruction au LLM. Un seul champ booleen/objet par agent
|
||||
// evite d'avoir a parser le texte de "reply" pour savoir quoi afficher.
|
||||
export class RouteMessageResponseDto {
|
||||
@ApiProperty({
|
||||
enum: ['chat', 'learn'],
|
||||
@@ -9,7 +14,10 @@ export class RouteMessageResponseDto {
|
||||
})
|
||||
type!: 'chat' | 'learn';
|
||||
|
||||
@ApiProperty({ description: 'Reponse de Max a afficher dans le chat.' })
|
||||
@ApiProperty({
|
||||
description:
|
||||
'Reponse de Max a dire a voix haute (jamais affichee en bulle de texte).',
|
||||
})
|
||||
reply!: string;
|
||||
|
||||
@ApiProperty({
|
||||
@@ -18,9 +26,23 @@ export class RouteMessageResponseDto {
|
||||
})
|
||||
sessionId?: number;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@ApiProperty({
|
||||
required: false,
|
||||
description:
|
||||
'Agent 1 (Objectif) : true quand "draft" est pret pour ObjectiveValidationCard.',
|
||||
})
|
||||
ready?: boolean;
|
||||
|
||||
@ApiProperty({ type: ObjectiveDraftDto, required: false })
|
||||
draft?: ObjectiveDraftDto;
|
||||
|
||||
@ApiProperty({
|
||||
required: false,
|
||||
description:
|
||||
'Agent 3 (Niveau) : true quand "levelProfile" est pret pour LevelResultCard.',
|
||||
})
|
||||
levelDone?: boolean;
|
||||
|
||||
@ApiProperty({ type: LevelProfileDto, required: false })
|
||||
levelProfile?: LevelProfileDto;
|
||||
}
|
||||
|
||||
@@ -7,4 +7,17 @@ export class SessionObjectiveResponseDto {
|
||||
@ApiProperty() professionalGoal!: string;
|
||||
@ApiProperty() duration!: string;
|
||||
@ApiProperty() validatedAt!: Date;
|
||||
|
||||
// Une fois l'objectif confirme, le backend enchaine automatiquement l'Agent 2 (Cartographie)
|
||||
// puis demarre l'Agent 3 (Niveau) dans le meme appel (voir sessions.service.ts,
|
||||
// confirmObjective()) : "Max ne parle pas pendant les phases de traitement" sauf pour annoncer
|
||||
// le debut de l'evaluation de niveau (docs/Max Refonte Coach Freelance.md). Ce champ porte cette
|
||||
// toute premiere question, a dire a voix haute des que la confirmation reussit - jamais affichee
|
||||
// en texte.
|
||||
@ApiProperty({
|
||||
required: false,
|
||||
description:
|
||||
'Premiere question de Max pour l-evaluation de niveau (Agent 3), a dire a voix haute juste apres la confirmation. Absent quand ce DTO ne sert qu-a lire l-etat existant (GET /sessions/:id).',
|
||||
})
|
||||
nextPrompt?: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user