Bump rust toolchain to 1.92 (current stable) (#6356)
This commit is contained in:
@@ -782,9 +782,9 @@ impl ExtensionManager {
|
||||
let extension_name = params.get("extension_name").and_then(|v| v.as_str());
|
||||
|
||||
// If extension name is provided, we can just look it up
|
||||
if extension_name.is_some() {
|
||||
if let Some(ext_name) = extension_name {
|
||||
let read_result = self
|
||||
.read_resource(uri, extension_name.unwrap(), cancellation_token.clone())
|
||||
.read_resource(uri, ext_name, cancellation_token.clone())
|
||||
.await?;
|
||||
|
||||
let mut result = Vec::new();
|
||||
@@ -1288,7 +1288,7 @@ mod tests {
|
||||
use rmcp::model::ListToolsResult;
|
||||
use rmcp::model::ReadResourceResult;
|
||||
use rmcp::model::ServerNotification;
|
||||
use serde_json::json;
|
||||
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
impl ExtensionManager {
|
||||
|
||||
@@ -544,7 +544,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_valid_conversation() {
|
||||
let all_messages = vec![
|
||||
let all_messages = [
|
||||
Message::user().with_text("Can you help me search for something?"),
|
||||
Message::assistant()
|
||||
.with_text("I'll help you search.")
|
||||
|
||||
@@ -84,8 +84,7 @@ impl ToolPermissionStore {
|
||||
self.permissions.get(&key).and_then(|records| {
|
||||
records
|
||||
.iter()
|
||||
.filter(|record| record.expiry.is_none_or(|exp| exp > Utc::now().timestamp()))
|
||||
.next_back()
|
||||
.rfind(|record| record.expiry.is_none_or(|exp| exp > Utc::now().timestamp()))
|
||||
.map(|record| record.allowed)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ use rmcp::model::{
|
||||
object, AnnotateAble, CallToolRequestParam, Content, ErrorCode, ErrorData, RawContent,
|
||||
ResourceContents, Role, Tool,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde::Serialize;
|
||||
use serde_json::{json, Value};
|
||||
use std::borrow::Cow;
|
||||
|
||||
@@ -370,43 +370,6 @@ pub fn response_to_message(response: &Value) -> anyhow::Result<Message> {
|
||||
))
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
struct DeltaToolCallFunction {
|
||||
name: Option<String>,
|
||||
arguments: String, // chunk of encoded JSON,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
struct DeltaToolCall {
|
||||
id: Option<String>,
|
||||
function: DeltaToolCallFunction,
|
||||
index: Option<i32>,
|
||||
r#type: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
struct Delta {
|
||||
content: Option<String>,
|
||||
role: Option<String>,
|
||||
tool_calls: Option<Vec<DeltaToolCall>>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
struct StreamingChoice {
|
||||
delta: Delta,
|
||||
index: Option<i32>,
|
||||
finish_reason: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
struct StreamingChunk {
|
||||
choices: Vec<StreamingChoice>,
|
||||
created: Option<i64>,
|
||||
id: Option<String>,
|
||||
usage: Option<Value>,
|
||||
model: String,
|
||||
}
|
||||
|
||||
/// Check if the model name indicates a Claude/Anthropic model that supports cache control.
|
||||
fn is_claude_model(model_name: &str) -> bool {
|
||||
model_name.contains("claude")
|
||||
@@ -740,13 +703,13 @@ mod tests {
|
||||
}),
|
||||
);
|
||||
|
||||
let spec = format_tools(&[tool.clone()], "gpt-4o")?;
|
||||
let spec = format_tools(std::slice::from_ref(&tool), "gpt-4o")?;
|
||||
assert_eq!(
|
||||
spec[0]["function"]["parameters"]["$schema"],
|
||||
"http://json-schema.org/draft-07/schema#"
|
||||
);
|
||||
|
||||
let spec = format_tools(&[tool.clone()], "gemini-2-5-flash")?;
|
||||
let spec = format_tools(std::slice::from_ref(&tool), "gemini-2-5-flash")?;
|
||||
assert!(spec[0]["function"]["parameters"].get("$schema").is_none());
|
||||
assert_eq!(spec[0]["function"]["parameters"]["type"], "object");
|
||||
|
||||
|
||||
@@ -439,7 +439,7 @@ impl Provider for GcpVertexAIProvider {
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
let model_strings: Vec<String> = vec![
|
||||
let model_strings: Vec<String> = [
|
||||
GcpVertexAIModel::Claude(ClaudeVersion::Sonnet37),
|
||||
GcpVertexAIModel::Claude(ClaudeVersion::Sonnet4),
|
||||
GcpVertexAIModel::Claude(ClaudeVersion::Opus4),
|
||||
|
||||
@@ -23,9 +23,10 @@ pub const CURRENT_SCHEMA_VERSION: i32 = 6;
|
||||
pub const SESSIONS_FOLDER: &str = "sessions";
|
||||
pub const DB_NAME: &str = "sessions.db";
|
||||
|
||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize, ToSchema, PartialEq, Eq)]
|
||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize, ToSchema, PartialEq, Eq, Default)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum SessionType {
|
||||
#[default]
|
||||
User,
|
||||
Scheduled,
|
||||
SubAgent,
|
||||
@@ -33,12 +34,6 @@ pub enum SessionType {
|
||||
Terminal,
|
||||
}
|
||||
|
||||
impl Default for SessionType {
|
||||
fn default() -> Self {
|
||||
Self::User
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for SessionType {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
|
||||
Reference in New Issue
Block a user