feat: add session and async job mcp tools

This commit is contained in:
a.tolmachev
2026-04-06 11:35:37 +03:00
parent bd2c6d4f48
commit fdd0a45124
5 changed files with 1578 additions and 142 deletions
+34
View File
@@ -74,6 +74,40 @@ impl RuntimeExecutor {
crate::aggregation::collect_window_result(&adapter_response.body, streaming)
}
pub async fn execute_session_seed(
&self,
operation: &RuntimeOperation,
input: &Value,
) -> Result<WindowExecutionResult, RuntimeError> {
let Some(streaming) = operation.execution_config.streaming.as_ref() else {
return Err(RuntimeError::MissingStreamingConfig {
operation_id: operation.operation_id.as_str().to_owned(),
});
};
if streaming.mode != ExecutionMode::Session {
return Err(RuntimeError::UnsupportedExecutionMode {
operation_id: operation.operation_id.as_str().to_owned(),
mode: streaming.mode,
});
}
let batch_size = streaming.max_items.unwrap_or(10).max(1);
let seed_limit = batch_size.saturating_mul(4);
let mut seeded_operation = operation.clone();
if let Some(config) = seeded_operation.execution_config.streaming.as_mut() {
config.mode = ExecutionMode::Window;
config.window_duration_ms = config
.window_duration_ms
.or(config.poll_interval_ms)
.or(config.upstream_timeout_ms)
.or(Some(operation.execution_config.timeout_ms));
config.max_items = Some(seed_limit);
}
self.execute_window(&seeded_operation, input).await
}
pub fn prepare_request(
&self,
operation: &RuntimeOperation,