refactor: rename the router subsystem to Talkie
The 'router' name was misleading — it's the always-on conversational front-end
(CHAT triage + STEERING into a running workflow), not a routing layer, and it's
distinct from InferenceRouter. Rename core:router -> core:talkie, package
com.correx.core.router -> com.correx.core.talkie, and RouterFacade/Config/State/
Repository/ContextBuilder/Projector/Reducer/Response -> Talkie*. Config section
[router] -> [talkie] (legacy [router] still read as fallback).
Persisted wire formats are preserved: ChatTurnRole.ROUTER and the
RouterNarrationEvent @SerialName("RouterNarration") stay, so existing event
logs still replay. RouterNarrationEvent the class is now TalkieNarrationEvent.
This commit is contained in:
@@ -38,7 +38,7 @@ dependencies {
|
||||
implementation project(':infrastructure:inference:llama_cpp')
|
||||
implementation project(':infrastructure:inference:openai_compat')
|
||||
implementation project(':infrastructure:inference:commons')
|
||||
implementation project(':core:router')
|
||||
implementation project(':core:talkie')
|
||||
implementation project(':core:tools')
|
||||
implementation project(':core:toolintent')
|
||||
implementation project(':infrastructure:tools')
|
||||
|
||||
@@ -44,9 +44,9 @@ import com.correx.core.kernel.orchestration.WorkspaceTools
|
||||
import com.correx.core.kernel.orchestration.WorkspaceToolRegistryProvider
|
||||
import com.correx.core.kernel.retry.DefaultRetryCoordinator
|
||||
import com.correx.core.risk.DefaultRiskAssessor
|
||||
import com.correx.core.router.RouterFacade
|
||||
import com.correx.core.router.l3.L3MetadataRehydrator
|
||||
import com.correx.core.router.model.RouterConfig
|
||||
import com.correx.core.talkie.TalkieFacade
|
||||
import com.correx.core.talkie.l3.L3MetadataRehydrator
|
||||
import com.correx.core.talkie.model.TalkieConfig
|
||||
import com.correx.core.sessions.DefaultSessionReducer
|
||||
import com.correx.core.sessions.DefaultSessionRepository
|
||||
import com.correx.core.sessions.SessionProjector
|
||||
@@ -294,7 +294,7 @@ fun main() {
|
||||
|
||||
// Constructed before the engines so the context builder can rank freeform turns by relevance
|
||||
// to the current query (pipeline §6, query-conditioned selection). Reused by L3 retrieval below.
|
||||
val embedder = InfrastructureModule.createEmbedderFromConfig(correxConfig.router.embedder)
|
||||
val embedder = InfrastructureModule.createEmbedderFromConfig(correxConfig.talkie.embedder)
|
||||
val engines = OrchestratorEngines(
|
||||
transitionResolver = DefaultTransitionResolver { condition, ctx -> condition.evaluate(ctx) },
|
||||
contextPackBuilder = DefaultContextPackBuilder(
|
||||
@@ -345,7 +345,7 @@ fun main() {
|
||||
val artifactKindRegistry = DefaultArtifactKindRegistry().also { reg ->
|
||||
configArtifactKindsEarly.forEach { reg.register(it) }
|
||||
}
|
||||
val l3MemoryStore = InfrastructureModule.createL3MemoryStoreFromConfig(correxConfig.router.l3)
|
||||
val l3MemoryStore = InfrastructureModule.createL3MemoryStoreFromConfig(correxConfig.talkie.l3)
|
||||
// Rebuild the L3 metadata map from the ChatTurnEvent log before serving queries:
|
||||
// persisted vectors survive restart but the metadata map does not (no-op for
|
||||
// non-rehydratable backends like in_memory).
|
||||
@@ -390,11 +390,11 @@ fun main() {
|
||||
InfrastructureModule.createWorkflowLoader(configArtifactKindsEarly),
|
||||
)
|
||||
// Builds the router facade from a config snapshot, mapping the [router] block onto the domain
|
||||
// RouterConfig. Reused by ConfigService's rebuild hook so router knob edits apply live (the
|
||||
// TalkieConfig. Reused by ConfigService's rebuild hook so router knob edits apply live (the
|
||||
// embedder and L3 store are construction-time and reused; the facade is what gets swapped).
|
||||
fun buildRouterFacade(cfg: CorrexConfig): RouterFacade {
|
||||
val rc = cfg.router
|
||||
val domainRouterConfig = RouterConfig(
|
||||
fun buildTalkieFacade(cfg: CorrexConfig): TalkieFacade {
|
||||
val rc = cfg.talkie
|
||||
val domainTalkieConfig = TalkieConfig(
|
||||
conversationKeepLast = rc.conversationKeepLast,
|
||||
retrievalK = rc.retrievalK,
|
||||
tokenBudget = TokenBudget(limit = rc.tokenBudget),
|
||||
@@ -410,16 +410,16 @@ fun main() {
|
||||
),
|
||||
narrationModelId = rc.narration.modelId,
|
||||
)
|
||||
return InfrastructureModule.createRouterFacade(
|
||||
return InfrastructureModule.createTalkieFacade(
|
||||
eventStore = eventStore,
|
||||
inferenceRouter = inferenceRouter,
|
||||
config = domainRouterConfig,
|
||||
config = domainTalkieConfig,
|
||||
tokenizer = firstProvider.tokenizer,
|
||||
embedder = embedder,
|
||||
l3MemoryStore = l3MemoryStore,
|
||||
workflowSummaryProvider = {
|
||||
workflowRegistry.listAll().map { s ->
|
||||
com.correx.core.router.model.WorkflowSummary(s.workflowId, s.description, s.stageIds)
|
||||
com.correx.core.talkie.model.WorkflowSummary(s.workflowId, s.description, s.stageIds)
|
||||
}
|
||||
},
|
||||
sessionProfileProvider = { sid ->
|
||||
@@ -429,7 +429,7 @@ fun main() {
|
||||
},
|
||||
)
|
||||
}
|
||||
val routerFacade = buildRouterFacade(correxConfig)
|
||||
val routerFacade = buildTalkieFacade(correxConfig)
|
||||
val sessionUndoService = com.correx.apps.server.undo.SessionUndoService(
|
||||
eventStore = eventStore,
|
||||
artifactStore = artifactStore,
|
||||
@@ -546,7 +546,7 @@ fun main() {
|
||||
modelSwapper = modelSwapper,
|
||||
resourceProbe = resourceProbe,
|
||||
workspaceResolver = workspaceResolver,
|
||||
narrationMaxPerRun = correxConfig.router.narration.maxPerRun,
|
||||
narrationMaxPerRun = correxConfig.talkie.narration.maxPerRun,
|
||||
projectMemory = projectMemory,
|
||||
architectContradictionChecker = architectContradictionChecker,
|
||||
configHolder = configHolder,
|
||||
@@ -564,7 +564,7 @@ fun main() {
|
||||
// services. Built after the module so the rebuild hook can swap them in place.
|
||||
module.configService = ConfigService(configHolder, ConfigLoader.configPath()) { cfg ->
|
||||
module.applyRebuiltServices(
|
||||
newRouterFacade = buildRouterFacade(cfg),
|
||||
newTalkieFacade = buildTalkieFacade(cfg),
|
||||
newProjectMemory = buildProjectMemory(cfg),
|
||||
newProfileAdaptationService = buildProfileAdaptation(cfg),
|
||||
)
|
||||
|
||||
@@ -39,7 +39,7 @@ import com.correx.core.kernel.execution.WorkflowResult
|
||||
import com.correx.core.kernel.orchestration.DefaultSessionOrchestrator
|
||||
import com.correx.core.kernel.orchestration.OrchestrationConfig
|
||||
import com.correx.core.kernel.orchestration.OrchestrationRepository
|
||||
import com.correx.core.router.RouterFacade
|
||||
import com.correx.core.talkie.TalkieFacade
|
||||
import com.correx.core.sessions.DefaultSessionRepository
|
||||
import com.correx.core.sessions.SessionSummary
|
||||
import com.correx.core.sessions.SessionSummaryProjector
|
||||
@@ -72,7 +72,7 @@ class ServerModule(
|
||||
val defaultOrchestrationConfig: OrchestrationConfig,
|
||||
// Rebuilt by ConfigService on a live config edit (router knobs); read at use-time by
|
||||
// GlobalStreamHandler.onUserInput so the next chat turn picks up the new facade.
|
||||
routerFacade: RouterFacade,
|
||||
routerFacade: TalkieFacade,
|
||||
val orchestrationRepository: OrchestrationRepository,
|
||||
val approvalRepository: DefaultApprovalRepository,
|
||||
val toolRegistry: ToolRegistry,
|
||||
@@ -134,7 +134,7 @@ class ServerModule(
|
||||
// Config-derived services that ConfigService swaps on a live edit. Reads happen at use-time
|
||||
// (next session / next chat turn), so in-flight sessions keep the config they started with.
|
||||
@Volatile
|
||||
var routerFacade: RouterFacade = routerFacade
|
||||
var routerFacade: TalkieFacade = routerFacade
|
||||
private set
|
||||
|
||||
@Volatile
|
||||
@@ -154,11 +154,11 @@ class ServerModule(
|
||||
* In-flight sessions are untouched; the next session/turn reads the new instances.
|
||||
*/
|
||||
fun applyRebuiltServices(
|
||||
newRouterFacade: RouterFacade,
|
||||
newTalkieFacade: TalkieFacade,
|
||||
newProjectMemory: com.correx.apps.server.memory.ProjectMemoryService?,
|
||||
newProfileAdaptationService: com.correx.apps.server.personalization.ProfileAdaptationService?,
|
||||
) {
|
||||
this.routerFacade = newRouterFacade
|
||||
this.routerFacade = newTalkieFacade
|
||||
this.projectMemory = newProjectMemory
|
||||
this.profileAdaptationService = newProfileAdaptationService
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ import com.correx.core.events.events.ToolCallAssessedEvent
|
||||
import com.correx.core.events.events.ToolInvocationRequestedEvent
|
||||
import com.correx.core.events.events.TransitionExecutedEvent
|
||||
import com.correx.core.events.events.WorkflowCompletedEvent
|
||||
import com.correx.core.events.events.RouterNarrationEvent
|
||||
import com.correx.core.events.events.TalkieNarrationEvent
|
||||
import com.correx.core.events.events.WorkflowFailedEvent
|
||||
import com.correx.core.events.events.WorkflowProposedEvent
|
||||
import com.correx.core.events.risk.RiskAction
|
||||
@@ -249,7 +249,7 @@ suspend fun domainEventToServerMessage(
|
||||
sequence = seq,
|
||||
sessionSequence = sessionSequence,
|
||||
)
|
||||
is RouterNarrationEvent -> ServerMessage.Narration(
|
||||
is TalkieNarrationEvent -> ServerMessage.Narration(
|
||||
sessionId = p.sessionId,
|
||||
content = p.content,
|
||||
stageId = p.stageId,
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@ import com.correx.core.events.events.RelatedDecision
|
||||
import com.correx.core.events.types.SessionId
|
||||
import com.correx.core.events.types.StageId
|
||||
import com.correx.core.inference.Embedder
|
||||
import com.correx.core.router.l3.L3MemoryStore
|
||||
import com.correx.core.router.l3.L3Query
|
||||
import com.correx.core.talkie.l3.L3MemoryStore
|
||||
import com.correx.core.talkie.l3.L3Query
|
||||
|
||||
/**
|
||||
* Display-only architect contradiction surfacing (BACKLOG §B-§4). When the architect records a
|
||||
|
||||
+2
-2
@@ -4,8 +4,8 @@ import com.correx.core.events.events.RepoKnowledgeHit
|
||||
import com.correx.core.events.types.SessionId
|
||||
import com.correx.core.inference.Embedder
|
||||
import com.correx.core.kernel.orchestration.RepoKnowledgeRetriever
|
||||
import com.correx.core.router.l3.L3MemoryStore
|
||||
import com.correx.core.router.l3.L3Query
|
||||
import com.correx.core.talkie.l3.L3MemoryStore
|
||||
import com.correx.core.talkie.l3.L3Query
|
||||
|
||||
private const val RETRIEVAL_OVERSAMPLE_FACTOR = 4
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ import com.correx.core.events.types.SessionId
|
||||
import com.correx.core.inference.Embedder
|
||||
import com.correx.core.journal.DefaultDecisionJournalRepository
|
||||
import com.correx.core.journal.ProjectMemoryDistiller
|
||||
import com.correx.core.router.l3.L3MemoryEntry
|
||||
import com.correx.core.router.l3.L3MemoryStore
|
||||
import com.correx.core.router.l3.L3Query
|
||||
import com.correx.core.talkie.l3.L3MemoryEntry
|
||||
import com.correx.core.talkie.l3.L3MemoryStore
|
||||
import com.correx.core.talkie.l3.L3Query
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.datetime.Clock
|
||||
import org.slf4j.LoggerFactory
|
||||
|
||||
@@ -13,8 +13,8 @@ import com.correx.core.events.events.WorkflowFailedEvent
|
||||
import com.correx.core.events.events.WorkflowStartedEvent
|
||||
import com.correx.core.events.stores.EventStore
|
||||
import com.correx.core.events.types.SessionId
|
||||
import com.correx.core.router.RouterFacade
|
||||
import com.correx.core.router.model.NarrationTrigger
|
||||
import com.correx.core.talkie.TalkieFacade
|
||||
import com.correx.core.talkie.model.NarrationTrigger
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
@@ -27,7 +27,7 @@ import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
class NarrationSubscriber(
|
||||
private val eventStore: EventStore,
|
||||
private val routerFacade: RouterFacade,
|
||||
private val routerFacade: TalkieFacade,
|
||||
private val scope: CoroutineScope,
|
||||
private val maxPerRun: Int = DEFAULT_MAX_PER_RUN,
|
||||
) {
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.correx.core.events.types.ClarificationRequestId
|
||||
import com.correx.core.events.types.GrantId
|
||||
import com.correx.core.events.types.SessionId
|
||||
import com.correx.core.events.types.StageId
|
||||
import com.correx.core.router.ChatMode
|
||||
import com.correx.core.talkie.ChatMode
|
||||
import kotlinx.datetime.Instant
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
||||
@@ -562,7 +562,7 @@ sealed interface ServerMessage {
|
||||
|
||||
@Serializable
|
||||
@SerialName("router.response")
|
||||
data class RouterResponseMessage(
|
||||
data class TalkieResponseMessage(
|
||||
val sessionId: SessionId,
|
||||
val content: String,
|
||||
val steeringEmitted: Boolean,
|
||||
|
||||
@@ -35,7 +35,7 @@ import com.correx.core.kernel.orchestration.WorkspaceContext
|
||||
import com.correx.core.config.ProjectProfileLoader
|
||||
import com.correx.core.config.ProjectProfileWriter
|
||||
import com.correx.core.config.withConvention
|
||||
import com.correx.core.router.IdeaReader
|
||||
import com.correx.core.talkie.IdeaReader
|
||||
import com.correx.core.utils.TypeId
|
||||
import com.correx.infrastructure.inference.commons.ResourceProbe
|
||||
import com.correx.infrastructure.inference.commons.ResourceSnapshot
|
||||
@@ -253,7 +253,7 @@ class GlobalStreamHandler(private val module: ServerModule) {
|
||||
is ClientMessage.ChatInput -> {
|
||||
// The USER and ROUTER turns are emitted as ChatTurnEvents inside onUserInput
|
||||
// and reach the client as chat.turn frames via streamGlobal — no direct
|
||||
// RouterResponseMessage (the conversation is event-derived).
|
||||
// TalkieResponseMessage (the conversation is event-derived).
|
||||
withSessionContext(msg.sessionId) {
|
||||
runCatching {
|
||||
module.routerFacade.onUserInput(msg.sessionId, msg.text, msg.mode)
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.correx.apps.server.logging.withSessionContext
|
||||
import com.correx.apps.server.protocol.ClientMessage
|
||||
import com.correx.apps.server.protocol.ProtocolSerializer
|
||||
import com.correx.apps.server.protocol.ServerMessage
|
||||
import com.correx.apps.server.protocol.ServerMessage.RouterResponseMessage
|
||||
import com.correx.apps.server.protocol.ServerMessage.TalkieResponseMessage
|
||||
import com.correx.core.events.types.SessionId
|
||||
import io.ktor.server.websocket.DefaultWebSocketServerSession
|
||||
import io.ktor.websocket.Frame
|
||||
@@ -93,7 +93,7 @@ class SessionStreamHandler(private val module: ServerModule) {
|
||||
session.send(
|
||||
Frame.Text(
|
||||
ProtocolSerializer.encodeServerMessage(
|
||||
RouterResponseMessage(
|
||||
TalkieResponseMessage(
|
||||
sessionId = msg.sessionId,
|
||||
content = response.content,
|
||||
steeringEmitted = response.steeringEmitted,
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.correx.core.approvals.GRANT_LEDGER_SESSION_ID
|
||||
import com.correx.core.approvals.GrantScope
|
||||
import com.correx.core.approvals.ProjectIdentity
|
||||
import com.correx.core.events.types.ProjectId
|
||||
import com.correx.core.router.IdeaReader
|
||||
import com.correx.core.talkie.IdeaReader
|
||||
import com.correx.core.config.EditableConfig
|
||||
import com.correx.core.events.events.ArtifactContentStoredEvent
|
||||
import com.correx.core.events.events.ArtifactCreatedEvent
|
||||
|
||||
+7
-7
@@ -35,11 +35,11 @@ import com.correx.core.kernel.orchestration.OrchestratorEngines
|
||||
import com.correx.core.kernel.orchestration.OrchestratorRepositories
|
||||
import com.correx.core.kernel.retry.DefaultRetryCoordinator
|
||||
import com.correx.core.risk.DefaultRiskAssessor
|
||||
import com.correx.core.router.l3.L3Hit
|
||||
import com.correx.core.router.l3.L3MemoryEntry
|
||||
import com.correx.core.router.l3.L3MemoryStore
|
||||
import com.correx.core.router.l3.L3Query
|
||||
import com.correx.core.router.model.RouterConfig
|
||||
import com.correx.core.talkie.l3.L3Hit
|
||||
import com.correx.core.talkie.l3.L3MemoryEntry
|
||||
import com.correx.core.talkie.l3.L3MemoryStore
|
||||
import com.correx.core.talkie.l3.L3Query
|
||||
import com.correx.core.talkie.model.TalkieConfig
|
||||
import com.correx.core.sessions.DefaultSessionReducer
|
||||
import com.correx.core.sessions.DefaultSessionRepository
|
||||
import com.correx.core.sessions.SessionProjector
|
||||
@@ -182,10 +182,10 @@ class ArchitectContradictionHookTest {
|
||||
tokenizer = provider.tokenizer,
|
||||
decisionJournalRepository = InfrastructureModule.createDecisionJournalRepository(eventStore),
|
||||
)
|
||||
val routerFacade = InfrastructureModule.createRouterFacade(
|
||||
val routerFacade = InfrastructureModule.createTalkieFacade(
|
||||
eventStore = eventStore,
|
||||
inferenceRouter = inferenceRouter,
|
||||
config = RouterConfig(),
|
||||
config = TalkieConfig(),
|
||||
tokenizer = provider.tokenizer,
|
||||
)
|
||||
val noopProviderRegistry = object : ProviderRegistry {
|
||||
|
||||
+3
-3
@@ -24,7 +24,7 @@ import com.correx.core.kernel.orchestration.OrchestratorEngines
|
||||
import com.correx.core.kernel.orchestration.OrchestratorRepositories
|
||||
import com.correx.core.kernel.retry.DefaultRetryCoordinator
|
||||
import com.correx.core.risk.DefaultRiskAssessor
|
||||
import com.correx.core.router.model.RouterConfig
|
||||
import com.correx.core.talkie.model.TalkieConfig
|
||||
import com.correx.core.sessions.DefaultSessionReducer
|
||||
import com.correx.core.sessions.DefaultSessionRepository
|
||||
import com.correx.core.sessions.SessionProjector
|
||||
@@ -116,10 +116,10 @@ fun buildTestServerModule(
|
||||
decisionJournalRepository = decisionJournalRepository,
|
||||
)
|
||||
|
||||
val routerFacade = InfrastructureModule.createRouterFacade(
|
||||
val routerFacade = InfrastructureModule.createTalkieFacade(
|
||||
eventStore = eventStore,
|
||||
inferenceRouter = modelSwapper,
|
||||
config = RouterConfig(),
|
||||
config = TalkieConfig(),
|
||||
tokenizer = firstProvider.tokenizer,
|
||||
)
|
||||
|
||||
|
||||
+4
-4
@@ -3,10 +3,10 @@ package com.correx.apps.server.memory
|
||||
import com.correx.core.events.types.SessionId
|
||||
import com.correx.core.events.types.StageId
|
||||
import com.correx.core.inference.Embedder
|
||||
import com.correx.core.router.l3.L3Hit
|
||||
import com.correx.core.router.l3.L3MemoryEntry
|
||||
import com.correx.core.router.l3.L3MemoryStore
|
||||
import com.correx.core.router.l3.L3Query
|
||||
import com.correx.core.talkie.l3.L3Hit
|
||||
import com.correx.core.talkie.l3.L3MemoryEntry
|
||||
import com.correx.core.talkie.l3.L3MemoryStore
|
||||
import com.correx.core.talkie.l3.L3Query
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Assertions.assertNull
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@ package com.correx.apps.server.memory
|
||||
|
||||
import com.correx.core.events.types.SessionId
|
||||
import com.correx.core.inference.Embedder
|
||||
import com.correx.core.router.l3.InMemoryL3MemoryStore
|
||||
import com.correx.core.router.l3.L3MemoryEntry
|
||||
import com.correx.core.talkie.l3.InMemoryL3MemoryStore
|
||||
import com.correx.core.talkie.l3.L3MemoryEntry
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import com.correx.core.inference.Embedder
|
||||
import com.correx.core.journal.DecisionJournalProjector
|
||||
import com.correx.core.journal.DefaultDecisionJournalReducer
|
||||
import com.correx.core.journal.DefaultDecisionJournalRepository
|
||||
import com.correx.core.router.l3.InMemoryL3MemoryStore
|
||||
import com.correx.core.talkie.l3.InMemoryL3MemoryStore
|
||||
import com.correx.core.sessions.projections.replay.DefaultEventReplayer
|
||||
import com.correx.infrastructure.persistence.InMemoryEventStore
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import com.correx.core.inference.Embedder
|
||||
import com.correx.core.journal.DecisionJournalProjector
|
||||
import com.correx.core.journal.DefaultDecisionJournalReducer
|
||||
import com.correx.core.journal.DefaultDecisionJournalRepository
|
||||
import com.correx.core.router.l3.InMemoryL3MemoryStore
|
||||
import com.correx.core.talkie.l3.InMemoryL3MemoryStore
|
||||
import com.correx.core.sessions.projections.replay.DefaultEventReplayer
|
||||
import com.correx.core.events.types.SessionId
|
||||
import com.correx.infrastructure.persistence.InMemoryEventStore
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import com.correx.core.inference.Embedder
|
||||
import com.correx.core.journal.DecisionJournalProjector
|
||||
import com.correx.core.journal.DefaultDecisionJournalReducer
|
||||
import com.correx.core.journal.DefaultDecisionJournalRepository
|
||||
import com.correx.core.router.l3.InMemoryL3MemoryStore
|
||||
import com.correx.core.talkie.l3.InMemoryL3MemoryStore
|
||||
import com.correx.core.sessions.projections.replay.DefaultEventReplayer
|
||||
import com.correx.infrastructure.persistence.InMemoryEventStore
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
||||
+17
-17
@@ -25,10 +25,10 @@ import com.correx.core.events.types.StageId
|
||||
import com.correx.core.events.types.TransitionId
|
||||
import com.correx.core.events.types.ValidationReportId
|
||||
import org.junit.jupiter.api.Assertions.assertTrue
|
||||
import com.correx.core.router.ChatMode
|
||||
import com.correx.core.router.RouterFacade
|
||||
import com.correx.core.router.model.NarrationTrigger
|
||||
import com.correx.core.router.model.RouterResponse
|
||||
import com.correx.core.talkie.ChatMode
|
||||
import com.correx.core.talkie.TalkieFacade
|
||||
import com.correx.core.talkie.model.NarrationTrigger
|
||||
import com.correx.core.talkie.model.TalkieResponse
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -72,10 +72,10 @@ class NarrationSubscriberTest {
|
||||
override suspend fun lastGlobalSequence(): Long = 0L
|
||||
}
|
||||
|
||||
private class RecordingRouterFacade : RouterFacade {
|
||||
private class RecordingTalkieFacade : TalkieFacade {
|
||||
val calls = CopyOnWriteArrayList<Pair<SessionId, NarrationTrigger>>()
|
||||
|
||||
override suspend fun onUserInput(sessionId: SessionId, input: String, mode: ChatMode): RouterResponse =
|
||||
override suspend fun onUserInput(sessionId: SessionId, input: String, mode: ChatMode): TalkieResponse =
|
||||
error("unused in narration tests")
|
||||
|
||||
override suspend fun narrate(sessionId: SessionId, trigger: NarrationTrigger) {
|
||||
@@ -99,7 +99,7 @@ class NarrationSubscriberTest {
|
||||
|
||||
@Test
|
||||
fun `triggers are narrated in order for matching events`(): Unit = runBlocking {
|
||||
val facade = RecordingRouterFacade()
|
||||
val facade = RecordingTalkieFacade()
|
||||
NarrationSubscriber(fakeStore, facade, scope).start()
|
||||
|
||||
// Wait for subscription to be attached
|
||||
@@ -122,7 +122,7 @@ class NarrationSubscriberTest {
|
||||
|
||||
@Test
|
||||
fun `pause narration is grounded with the pending approval tool and preview`(): Unit = runBlocking {
|
||||
val facade = RecordingRouterFacade()
|
||||
val facade = RecordingTalkieFacade()
|
||||
NarrationSubscriber(fakeStore, facade, scope).start()
|
||||
|
||||
while (liveFlow.subscriptionCount.value == 0) yield()
|
||||
@@ -158,7 +158,7 @@ class NarrationSubscriberTest {
|
||||
|
||||
@Test
|
||||
fun `maxPerRun=1 skips second trigger after first narration`(): Unit = runBlocking {
|
||||
val facade = RecordingRouterFacade()
|
||||
val facade = RecordingTalkieFacade()
|
||||
NarrationSubscriber(fakeStore, facade, scope, maxPerRun = 1).start()
|
||||
|
||||
while (liveFlow.subscriptionCount.value == 0) yield()
|
||||
@@ -180,10 +180,10 @@ class NarrationSubscriberTest {
|
||||
@Test
|
||||
fun `a throwing narrate does not prevent subsequent narrations`(): Unit = runBlocking {
|
||||
var callCount = 0
|
||||
val facade = object : RouterFacade {
|
||||
val facade = object : TalkieFacade {
|
||||
val calls = CopyOnWriteArrayList<String>()
|
||||
|
||||
override suspend fun onUserInput(sessionId: SessionId, input: String, mode: ChatMode): RouterResponse =
|
||||
override suspend fun onUserInput(sessionId: SessionId, input: String, mode: ChatMode): TalkieResponse =
|
||||
error("unused")
|
||||
|
||||
override suspend fun narrate(sessionId: SessionId, trigger: NarrationTrigger) {
|
||||
@@ -210,7 +210,7 @@ class NarrationSubscriberTest {
|
||||
|
||||
@Test
|
||||
fun `execution plan rejection triggers narration with rejection reason`(): Unit = runBlocking {
|
||||
val facade = RecordingRouterFacade()
|
||||
val facade = RecordingTalkieFacade()
|
||||
NarrationSubscriber(fakeStore, facade, scope).start()
|
||||
|
||||
while (liveFlow.subscriptionCount.value == 0) yield()
|
||||
@@ -244,7 +244,7 @@ class NarrationSubscriberTest {
|
||||
* letting the test enqueue further events (and resolve the pause) while the pause narration is
|
||||
* still pending in the channel.
|
||||
*/
|
||||
private class GatingRouterFacade : RouterFacade {
|
||||
private class GatingTalkieFacade : TalkieFacade {
|
||||
val calls = CopyOnWriteArrayList<NarrationTrigger>()
|
||||
val release = CompletableDeferred<Unit>()
|
||||
// Signals that the worker has pulled the first (warmup) trigger and is now blocked,
|
||||
@@ -252,7 +252,7 @@ class NarrationSubscriberTest {
|
||||
val blocked = CompletableDeferred<Unit>()
|
||||
private var first = true
|
||||
|
||||
override suspend fun onUserInput(sessionId: SessionId, input: String, mode: ChatMode): RouterResponse =
|
||||
override suspend fun onUserInput(sessionId: SessionId, input: String, mode: ChatMode): TalkieResponse =
|
||||
error("unused in narration tests")
|
||||
|
||||
override suspend fun narrate(sessionId: SessionId, trigger: NarrationTrigger) {
|
||||
@@ -289,7 +289,7 @@ class NarrationSubscriberTest {
|
||||
|
||||
@Test
|
||||
fun `resolved approval drops the still-queued pause narration`(): Unit = runBlocking {
|
||||
val facade = GatingRouterFacade()
|
||||
val facade = GatingTalkieFacade()
|
||||
NarrationSubscriber(fakeStore, facade, scope).start()
|
||||
|
||||
while (liveFlow.subscriptionCount.value == 0) yield()
|
||||
@@ -320,7 +320,7 @@ class NarrationSubscriberTest {
|
||||
|
||||
@Test
|
||||
fun `unrelated approval resolution leaves the pending pause intact`(): Unit = runBlocking {
|
||||
val facade = GatingRouterFacade()
|
||||
val facade = GatingTalkieFacade()
|
||||
NarrationSubscriber(fakeStore, facade, scope).start()
|
||||
|
||||
while (liveFlow.subscriptionCount.value == 0) yield()
|
||||
@@ -342,7 +342,7 @@ class NarrationSubscriberTest {
|
||||
|
||||
@Test
|
||||
fun `resume drops every queued pause narration for the session`(): Unit = runBlocking {
|
||||
val facade = GatingRouterFacade()
|
||||
val facade = GatingTalkieFacade()
|
||||
NarrationSubscriber(fakeStore, facade, scope).start()
|
||||
|
||||
while (liveFlow.subscriptionCount.value == 0) yield()
|
||||
|
||||
@@ -33,7 +33,7 @@ import com.correx.core.kernel.orchestration.OrchestratorRepositories
|
||||
import com.correx.core.kernel.retry.DefaultRetryCoordinator
|
||||
import com.correx.core.events.types.ProviderId
|
||||
import com.correx.core.risk.DefaultRiskAssessor
|
||||
import com.correx.core.router.model.RouterConfig
|
||||
import com.correx.core.talkie.model.TalkieConfig
|
||||
import com.correx.core.sessions.DefaultSessionReducer
|
||||
import com.correx.core.sessions.DefaultSessionRepository
|
||||
import com.correx.core.sessions.SessionProjector
|
||||
@@ -165,10 +165,10 @@ class EventInspectRoutesTest {
|
||||
tokenizer = provider.tokenizer,
|
||||
decisionJournalRepository = InfrastructureModule.createDecisionJournalRepository(eventStore),
|
||||
)
|
||||
val routerFacade = InfrastructureModule.createRouterFacade(
|
||||
val routerFacade = InfrastructureModule.createTalkieFacade(
|
||||
eventStore = eventStore,
|
||||
inferenceRouter = inferenceRouter,
|
||||
config = RouterConfig(),
|
||||
config = TalkieConfig(),
|
||||
tokenizer = provider.tokenizer,
|
||||
)
|
||||
val noopProviderRegistry = object : ProviderRegistry {
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.correx.core.kernel.orchestration.OrchestratorRepositories
|
||||
import com.correx.core.kernel.retry.DefaultRetryCoordinator
|
||||
import com.correx.core.events.types.ProviderId
|
||||
import com.correx.core.risk.DefaultRiskAssessor
|
||||
import com.correx.core.router.model.RouterConfig
|
||||
import com.correx.core.talkie.model.TalkieConfig
|
||||
import com.correx.core.sessions.DefaultSessionReducer
|
||||
import com.correx.core.sessions.DefaultSessionRepository
|
||||
import com.correx.core.sessions.SessionProjector
|
||||
@@ -444,10 +444,10 @@ class TaskRoutesTest {
|
||||
tokenizer = provider.tokenizer,
|
||||
decisionJournalRepository = InfrastructureModule.createDecisionJournalRepository(eventStore),
|
||||
)
|
||||
val routerFacade = InfrastructureModule.createRouterFacade(
|
||||
val routerFacade = InfrastructureModule.createTalkieFacade(
|
||||
eventStore = eventStore,
|
||||
inferenceRouter = inferenceRouter,
|
||||
config = RouterConfig(),
|
||||
config = TalkieConfig(),
|
||||
tokenizer = provider.tokenizer,
|
||||
)
|
||||
val noopProviderRegistry = object : ProviderRegistry {
|
||||
|
||||
@@ -186,10 +186,10 @@ class WorkspaceHandshakeTest {
|
||||
decisionJournalRepository = InfrastructureModule.createDecisionJournalRepository(eventStore),
|
||||
)
|
||||
|
||||
val routerFacade = InfrastructureModule.createRouterFacade(
|
||||
val routerFacade = InfrastructureModule.createTalkieFacade(
|
||||
eventStore = eventStore,
|
||||
inferenceRouter = inferenceRouter,
|
||||
config = com.correx.core.router.model.RouterConfig(),
|
||||
config = com.correx.core.talkie.model.TalkieConfig(),
|
||||
tokenizer = provider.tokenizer,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user