feat(code): wire gRPC server into Sol startup

spawns gRPC server alongside Matrix sync loop when [grpc] config
is present. shares ToolRegistry, Store, MistralClient, and Matrix
client with the gRPC CodeSession handler.
This commit is contained in:
2026-03-23 13:01:36 +00:00
parent abfad337c5
commit 71392cef9c
2 changed files with 21 additions and 0 deletions

View File

@@ -65,6 +65,11 @@ impl Responder {
}
}
/// Get a reference to the tool registry (for sharing with gRPC server).
pub fn tools(&self) -> Arc<ToolRegistry> {
self.tools.clone()
}
pub async fn generate_response(
&self,
context: &[ContextMessage],

View File

@@ -293,6 +293,22 @@ async fn main() -> anyhow::Result<()> {
error!("Reaction backfill failed (non-fatal): {e}");
}
// Start gRPC server if configured
if config.grpc.is_some() {
let grpc_state = std::sync::Arc::new(grpc::GrpcState {
config: config.clone(),
tools: state.responder.tools(),
store: store.clone(),
mistral: state.mistral.clone(),
matrix: matrix_client.clone(),
});
tokio::spawn(async move {
if let Err(e) = grpc::start_server(grpc_state).await {
error!("gRPC server error: {e}");
}
});
}
// Start sync loop in background
let sync_client = matrix_client.clone();
let sync_state = state.clone();