feat: version string formatting yy.mm.dd.hhmmss, app icon, and test fixes
This commit is contained in:
1 parent
1752753fcc
commit
81aac7245b
17 files changed
+170
-412
No files matched your search
@@ -4,40 +4,17 @@ use std::process::{Command, Stdio};
|
||||
|
||||
fn send_message(stdin: &mut std::process::ChildStdin, msg: Value) {
|
||||
let s = serde_json::to_string(&msg).unwrap();
|
||||
let payload = format!("Content-Length: {}\r\n\r\n{}", s.len(), s);
|
||||
stdin.write_all(payload.as_bytes()).unwrap();
|
||||
stdin.write_all(format!("{}\n", s).as_bytes()).unwrap();
|
||||
stdin.flush().unwrap();
|
||||
}
|
||||
|
||||
fn read_message(stdout: &mut std::process::ChildStdout) -> Option<Value> {
|
||||
let mut reader = BufReader::new(stdout);
|
||||
let mut length = 0;
|
||||
|
||||
// Read headers
|
||||
loop {
|
||||
let mut line = String::new();
|
||||
if reader.read_line(&mut line).unwrap_or(0) == 0 {
|
||||
return None; // EOF
|
||||
}
|
||||
let line = line.trim_end();
|
||||
if line.is_empty() {
|
||||
break;
|
||||
}
|
||||
if let Some(len_str) = line.strip_prefix("Content-Length: ") {
|
||||
length = len_str.parse().unwrap_or(0);
|
||||
}
|
||||
}
|
||||
|
||||
if length == 0 {
|
||||
let mut line = String::new();
|
||||
if reader.read_line(&mut line).unwrap_or(0) == 0 {
|
||||
return None;
|
||||
}
|
||||
|
||||
// Read body
|
||||
let mut buf = vec![0u8; length];
|
||||
reader.read_exact(&mut buf).unwrap();
|
||||
let body_str = String::from_utf8_lossy(&buf);
|
||||
|
||||
Some(serde_json::from_str(&body_str).unwrap())
|
||||
serde_json::from_str(&line).ok()
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -83,10 +60,7 @@ fn test_mcp_initialization_and_tools_list() {
|
||||
"id": 1
|
||||
});
|
||||
|
||||
// Send initialize using JSONL format!
|
||||
let s = serde_json::to_string(&init_req).unwrap();
|
||||
stdin.write_all(format!("{}\n", s).as_bytes()).unwrap();
|
||||
stdin.flush().unwrap();
|
||||
send_message(&mut stdin, init_req);
|
||||
|
||||
let init_resp = read_message(&mut stdout).expect("Failed to read initialize response");
|
||||
|
||||
|
||||
Reference in new issue
Block a user