diff --git a/CHANGELOG.md b/CHANGELOG.md index 80208d17..1692bdfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.3.11] - 2026-02-04 + +### Fixed +- Map dotted tool names to API-safe identifiers for DeepSeek tool calls + ## [0.3.10] - 2026-02-04 ### Fixed diff --git a/Cargo.lock b/Cargo.lock index 87b2273d..aebdcae4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -674,7 +674,7 @@ dependencies = [ [[package]] name = "deepseek-tui" -version = "0.3.10" +version = "0.3.11" dependencies = [ "anyhow", "arboard", diff --git a/Cargo.toml b/Cargo.toml index 79c74e3a..59cbd3ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "deepseek-tui" -version = "0.3.10" +version = "0.3.11" edition = "2024" description = "Unofficial DeepSeek CLI - Just run 'deepseek' to start chatting" license = "MIT" diff --git a/src/client.rs b/src/client.rs index fe37963b..3ec73515 100644 --- a/src/client.rs +++ b/src/client.rs @@ -20,6 +20,22 @@ use crate::models::{ StreamEvent, SystemPrompt, Tool, Usage, }; +fn to_api_tool_name(name: &str) -> String { + match name { + "web.run" => "web_run".to_string(), + "multi_tool_use.parallel" => "multi_tool_use_parallel".to_string(), + _ => name.to_string(), + } +} + +fn from_api_tool_name(name: &str) -> String { + match name { + "web_run" => "web.run".to_string(), + "multi_tool_use_parallel" => "multi_tool_use.parallel".to_string(), + _ => name.to_string(), + } +} + // === Types === /// Client for DeepSeek's OpenAI-compatible APIs. @@ -276,7 +292,7 @@ fn build_responses_input(messages: &[Message]) -> Vec { items.push(json!({ "type": "function_call", "call_id": id, - "name": name, + "name": to_api_tool_name(name), "arguments": args, })); } @@ -301,7 +317,7 @@ fn build_responses_input(messages: &[Message]) -> Vec { fn tool_to_responses(tool: &Tool) -> Value { json!({ "type": "function", - "name": tool.name, + "name": to_api_tool_name(&tool.name), "description": tool.description, "parameters": tool.input_schema, }) @@ -373,7 +389,7 @@ fn parse_responses_message(payload: &Value) -> Result { }; content.push(ContentBlock::ToolUse { id: call_id, - name, + name: from_api_tool_name(&name), input, }); } @@ -619,7 +635,7 @@ fn tool_to_chat(tool: &Tool) -> Value { json!({ "type": "function", "function": { - "name": tool.name, + "name": to_api_tool_name(&tool.name), "description": tool.description, "parameters": tool.input_schema, } @@ -640,7 +656,7 @@ fn map_tool_choice_for_chat(choice: &Value) -> Option { "tool" => choice.get("name").and_then(Value::as_str).map(|name| { json!({ "type": "function", - "function": { "name": name } + "function": { "name": to_api_tool_name(name) } }) }), _ => Some(choice.clone()), @@ -715,7 +731,7 @@ fn parse_chat_message(payload: &Value) -> Result { content_blocks.push(ContentBlock::ToolUse { id, - name, + name: from_api_tool_name(&name), input: arguments, }); }