Merge branch 'main' of github.com:leookun/cursor-byok

This commit is contained in:
leokun
2026-08-31 15:38:11 +08:00
4 changed files with 80 additions and 56 deletions
+8 -1
View File
@@ -343,7 +343,14 @@ impl ConversationOutput {
let call = calls.get_mut(&index).ok_or_else(|| {
Error::Protocol(format!("unknown completed tool index: {index}"))
})?;
call.arguments = serde_json::from_str(&call.arguments_text)?;
// A tool call with no arguments streams no argument text.
// Treat empty text as an empty object, matching the model
// cycle, instead of failing the run on `from_str("")`.
call.arguments = if call.arguments_text.trim().is_empty() {
serde_json::json!({})
} else {
serde_json::from_str(&call.arguments_text)?
};
}
RunEvent::Usage(usage) => {
if !self.context.compacting {
+8 -1
View File
@@ -101,7 +101,14 @@ impl Store {
.bind(&call.call_id)
.bind(&call.model_call_id)
.bind(&call.name)
.bind(&call.arguments_text)
// A no-argument tool call streams no argument text; persist it as an
// empty object so the `arguments_json` column always holds valid JSON
// and can be re-parsed on load.
.bind(if call.arguments_text.trim().is_empty() {
"{}"
} else {
call.arguments_text.as_str()
})
.execute(&mut *tx)
.await?;
}