feat: event-source router CHAT and STEERING conversation turns
Adds ChatTurnEvent (role USER|ROUTER) so router conversation history survives restart and is rebuilt from the event log via projection, restoring Hard Invariant #1 for the CHAT path. Both CHAT and STEERING now emit user + router turn events; STEERING additionally keeps its existing SteeringNoteAddedEvent so the structured directive record is preserved alongside the conversation turns. RouterFacade drops the in-memory ConcurrentHashMap of histories and rebuilds state through the repository after each emission. Reducer appends turns to conversationHistory. ChatTurnEvent is registered in eventModule.
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package com.correx.core.events.events
|
||||
|
||||
import com.correx.core.events.types.SessionId
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
@SerialName("ChatTurn")
|
||||
data class ChatTurnEvent(
|
||||
val sessionId: SessionId,
|
||||
val turnId: String,
|
||||
val role: ChatTurnRole,
|
||||
val content: String,
|
||||
val timestampMs: Long,
|
||||
) : EventPayload
|
||||
|
||||
@Serializable
|
||||
enum class ChatTurnRole {
|
||||
USER,
|
||||
ROUTER,
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import com.correx.core.events.events.ArtifactCreatedEvent
|
||||
import com.correx.core.events.events.ArtifactValidatedEvent
|
||||
import com.correx.core.events.events.ArtifactValidatingEvent
|
||||
import com.correx.core.events.events.ChatSessionStartedEvent
|
||||
import com.correx.core.events.events.ChatTurnEvent
|
||||
import com.correx.core.events.events.EventPayload
|
||||
import com.correx.core.events.events.InferenceCompletedEvent
|
||||
import com.correx.core.events.events.InferenceFailedEvent
|
||||
@@ -71,6 +72,7 @@ val eventModule = SerializersModule {
|
||||
subclass(RetryAttemptedEvent::class)
|
||||
subclass(RiskAssessedEvent::class)
|
||||
subclass(ChatSessionStartedEvent::class)
|
||||
subclass(ChatTurnEvent::class)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user