feat: add streaming end-to-end coverage

This commit is contained in:
a.tolmachev
2026-04-06 12:44:47 +03:00
parent 4953272bcf
commit b5f80c5d2f
7 changed files with 853 additions and 8 deletions
+28 -1
View File
@@ -520,8 +520,35 @@ async fn handle_base_tool_call(
let operation = runtime_operation(&tool);
let request_preview = build_request_preview(&state.runtime, &operation, &arguments);
let started_at = Instant::now();
let is_window_mode = matches!(
operation
.execution_config
.streaming
.as_ref()
.map(|streaming| streaming.mode),
Some(crank_core::ExecutionMode::Window)
);
match state.runtime.execute(&operation, &arguments).await {
let result = if is_window_mode {
state
.runtime
.execute_window(&operation, &arguments)
.await
.map(|output| {
json!({
"summary": output.summary,
"items": output.items,
"cursor": output.cursor,
"window_complete": output.window_complete,
"truncated": output.truncated,
"has_more": output.has_more,
})
})
} else {
state.runtime.execute(&operation, &arguments).await
};
match result {
Ok(output) => {
let _ = persist_invocation(
&state,