feat(router,server): wire workflow inventory and project profile into router context per turn
This commit is contained in:
@@ -292,6 +292,9 @@ fun main() {
|
||||
// persisted vectors survive restart but the metadata map does not (no-op for
|
||||
// non-rehydratable backends like in_memory).
|
||||
runBlocking { L3MetadataRehydrator(eventStore).rehydrate(l3MemoryStore) }
|
||||
val workflowRegistry = FileSystemWorkflowRegistry(
|
||||
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
|
||||
// embedder and L3 store are construction-time and reused; the facade is what gets swapped).
|
||||
@@ -320,6 +323,16 @@ fun main() {
|
||||
tokenizer = firstProvider.tokenizer,
|
||||
embedder = embedder,
|
||||
l3MemoryStore = l3MemoryStore,
|
||||
workflowSummaryProvider = {
|
||||
workflowRegistry.listAll().map { s ->
|
||||
com.correx.core.router.model.WorkflowSummary(s.workflowId, s.description, s.stageIds)
|
||||
}
|
||||
},
|
||||
sessionProfileProvider = { sid ->
|
||||
runCatching { repositories.sessionRepository.getSession(sid).state.boundProjectProfile }
|
||||
.getOrNull()
|
||||
?.let { renderProjectProfileText(it) }
|
||||
},
|
||||
)
|
||||
}
|
||||
val routerFacade = buildRouterFacade(correxConfig)
|
||||
@@ -383,9 +396,7 @@ fun main() {
|
||||
eventStore = eventStore,
|
||||
artifactStore = artifactStore,
|
||||
sessionRepository = repositories.sessionRepository,
|
||||
workflowRegistry = FileSystemWorkflowRegistry(
|
||||
InfrastructureModule.createWorkflowLoader(configArtifactKindsEarly),
|
||||
),
|
||||
workflowRegistry = workflowRegistry,
|
||||
providerRegistry = infraRegistry.asServerRegistry(),
|
||||
defaultOrchestrationConfig = defaultOrchestrationConfig,
|
||||
routerFacade = routerFacade,
|
||||
@@ -418,6 +429,22 @@ fun main() {
|
||||
embeddedServer(Netty, port = 8080) { configureServer(module) }.start(wait = true)
|
||||
}
|
||||
|
||||
fun renderProjectProfileText(profile: com.correx.core.sessions.BoundProjectProfile?): String? {
|
||||
if (profile == null) return null
|
||||
return buildString {
|
||||
append("## Project profile\n")
|
||||
if (profile.about.isNotBlank()) append(profile.about).append("\n")
|
||||
if (profile.conventions.isNotEmpty()) {
|
||||
append("### Conventions\n")
|
||||
profile.conventions.forEach { append("- ").append(it).append("\n") }
|
||||
}
|
||||
if (profile.commands.isNotEmpty()) {
|
||||
append("### Commands\n")
|
||||
profile.commands.forEach { (name, cmd) -> append(name).append(": ").append(cmd).append("\n") }
|
||||
}
|
||||
}.trimEnd().takeIf { it.isNotBlank() }
|
||||
}
|
||||
|
||||
private fun logModelInfo(
|
||||
modelId: String,
|
||||
infraRegistry: DefaultProviderRegistry,
|
||||
|
||||
Reference in New Issue
Block a user