From 5d75062a08b23396742417e9ac6dab0fc2599de7 Mon Sep 17 00:00:00 2001 From: IgorSemed0 Date: Mon, 11 Aug 2025 18:22:22 +0100 Subject: [PATCH 01/14] feat(core): screen add keyboard input support --- casper-core/src/screen.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/casper-core/src/screen.rs b/casper-core/src/screen.rs index e3ec4c7..0e537da 100644 --- a/casper-core/src/screen.rs +++ b/casper-core/src/screen.rs @@ -1,8 +1,15 @@ -use enigo::{Enigo, Settings, Coordinate, Mouse}; +use enigo::{Enigo, Settings, Coordinate, Mouse, Keyboard}; pub fn move_mouse(x: i32, y: i32) -> Result<(), String> { let settings = Settings::default(); let mut enigo = Enigo::new(&settings).map_err(|e| e.to_string())?; enigo.move_mouse(x, y, Coordinate::Abs).map_err(|e| e.to_string())?; Ok(()) +} + +pub fn type_text(text: &str) -> Result<(), String> { + let settings = Settings::default(); + let mut enigo = Enigo::new(&settings).map_err(|e| e.to_string())?; + enigo.fast_text(text).map_err(|e| e.to_string())?; + Ok(()) } \ No newline at end of file From 69f972f48d265ce956dc8020555039ee374ebf6e Mon Sep 17 00:00:00 2001 From: IgorSemed0 Date: Mon, 11 Aug 2025 18:23:34 +0100 Subject: [PATCH 02/14] feat(core): connection basic http connection example --- casper-core/src/connections.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/casper-core/src/connections.rs b/casper-core/src/connections.rs index e69de29..71cb1df 100644 --- a/casper-core/src/connections.rs +++ b/casper-core/src/connections.rs @@ -0,0 +1,17 @@ +use reqwest::Client; + +pub async fn connect_to_service(service: &str, action: &str) -> Result { + // Placeholder: Example HTTP request + let client = Client::new(); + match service { + "example_api" => { + let response = client + .get("https://api.example.com") + .send() + .await + .map_err(|e| e.to_string())?; + response.text().await.map_err(|e| e.to_string()) + }, + _ => Err(format!("Unsupported service: {}", service)), + } +} \ No newline at end of file From 89cfe05421a4ab95e1710219d7ccb31a484fa7c8 Mon Sep 17 00:00:00 2001 From: IgorSemed0 Date: Mon, 11 Aug 2025 18:23:52 +0100 Subject: [PATCH 03/14] feat(core): connection basic http connection example --- casper-core/src/connections.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/casper-core/src/connections.rs b/casper-core/src/connections.rs index 71cb1df..1e20381 100644 --- a/casper-core/src/connections.rs +++ b/casper-core/src/connections.rs @@ -1,7 +1,7 @@ use reqwest::Client; pub async fn connect_to_service(service: &str, action: &str) -> Result { - // Placeholder: Example HTTP request + // Example HTTP request let client = Client::new(); match service { "example_api" => { From a72340b26c325d33bc11caad784c35c28319745e Mon Sep 17 00:00:00 2001 From: IgorSemed0 Date: Mon, 11 Aug 2025 18:25:03 +0100 Subject: [PATCH 04/14] feat(core): mcp basic example --- casper-core/src/mcp.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/casper-core/src/mcp.rs b/casper-core/src/mcp.rs index e69de29..d241c5e 100644 --- a/casper-core/src/mcp.rs +++ b/casper-core/src/mcp.rs @@ -0,0 +1,4 @@ +pub fn process_mcp(data: &str) -> Result { + // Process MCP protocol data + Err(format!("MCP under development: received {}", data)) +} \ No newline at end of file From 21e1bcd3dfcb9b0df61930c7bd3e13c4d914d924 Mon Sep 17 00:00:00 2001 From: IgorSemed0 Date: Mon, 11 Aug 2025 18:28:51 +0100 Subject: [PATCH 05/14] feat(core): ai basic example --- casper-core/src/ai.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/casper-core/src/ai.rs b/casper-core/src/ai.rs index e69de29..77b1c84 100644 --- a/casper-core/src/ai.rs +++ b/casper-core/src/ai.rs @@ -0,0 +1,8 @@ +pub fn process_command(command: &str) -> Result { + // Basic keyword matcching, thinking about using use rust-bert, I got interesred º-º + if command.contains("hello") { + Ok("I'm an AI response º-º!".to_string()) + } else { + Err("AI under construction".to_string()) + } +} \ No newline at end of file From 3108e7974f7086e76d74ceb71da10664835bd03a Mon Sep 17 00:00:00 2001 From: IgorSemed0 Date: Mon, 11 Aug 2025 18:31:00 +0100 Subject: [PATCH 06/14] feat(core): tts initial setup --- casper-core/src/tts.rs | 9 +++++++++ casper-core/src/voice.rs | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/casper-core/src/tts.rs b/casper-core/src/tts.rs index e69de29..91f90c5 100644 --- a/casper-core/src/tts.rs +++ b/casper-core/src/tts.rs @@ -0,0 +1,9 @@ +use std::process::Command; + +pub fn speak(text: &str) -> Result<(), String> { + Command::new("espeak-ng") + .arg(text) + .spawn() + .map_err(|e| e.to_string())?; + Ok(()) +} \ No newline at end of file diff --git a/casper-core/src/voice.rs b/casper-core/src/voice.rs index e69de29..e439c15 100644 --- a/casper-core/src/voice.rs +++ b/casper-core/src/voice.rs @@ -0,0 +1,4 @@ +pub fn recognize_voice() -> Result { + // Will use vosk-rust later, later... + Err("Voice under contruction".to_string()) +} \ No newline at end of file From 09426ca9018e5c4fb904c9368bafd9c315932c5c Mon Sep 17 00:00:00 2001 From: IgorSemed0 Date: Mon, 11 Aug 2025 18:34:16 +0100 Subject: [PATCH 07/14] feat(daemon): functions call --- casper-daemon/src/main.rs | 49 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/casper-daemon/src/main.rs b/casper-daemon/src/main.rs index 5b96e03..e174054 100644 --- a/casper-daemon/src/main.rs +++ b/casper-daemon/src/main.rs @@ -2,8 +2,13 @@ use tokio::net::UnixListener; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use std::path::Path; use casper_core::commands::run_command; -use casper_core::screen::move_mouse; +use casper_core::screen::{move_mouse, type_text}; use casper_core::notifications::show_notification; +use casper_core::connections::connect_to_service; +use casper_core::mcp::process_mcp; +use casper_core::ai::process_command; +use casper_core::voice::recognize_voice; +use casper_core::tts::speak; use serde_json::json; #[tokio::main] @@ -46,6 +51,13 @@ async fn main() -> Result<(), Box> { Err(e) => json!({ "status": "error", "message": e }), } }, + Some("type_text") => { + let text = req["text"].as_str().unwrap_or(""); + match type_text(text) { + Ok(_) => json!({ "status": "success" }), + Err(e) => json!({ "status": "error", "message": e }), + } + }, Some("show_notification") => { let summary = req["summary"].as_str().unwrap_or(""); let body = req["body"].as_str().unwrap_or(""); @@ -54,6 +66,41 @@ async fn main() -> Result<(), Box> { Err(e) => json!({ "status": "error", "message": e }), } }, + Some("connect_to_service") => { + let service = req["service"].as_str().unwrap_or(""); + let action = req["action"].as_str().unwrap_or(""); + match connect_to_service(service, action).await { + Ok(result) => json!({ "status": "success", "result": result }), + Err(e) => json!({ "status": "error", "message": e }), + } + }, + Some("process_mcp") => { + let data = req["data"].as_str().unwrap_or(""); + match process_mcp(data) { + Ok(result) => json!({ "status": "success", "result": result }), + Err(e) => json!({ "status": "error", "message": e }), + } + }, + Some("process_command") => { + let command = req["command"].as_str().unwrap_or(""); + match process_command(command) { + Ok(result) => json!({ "status": "success", "result": result }), + Err(e) => json!({ "status": "error", "message": e }), + } + }, + Some("recognize_voice") => { + match recognize_voice() { + Ok(result) => json!({ "status": "success", "result": result }), + Err(e) => json!({ "status": "error", "message": e }), + } + }, + Some("speak") => { + let text = req["text"].as_str().unwrap_or(""); + match speak(text) { + Ok(_) => json!({ "status": "success" }), + Err(e) => json!({ "status": "error", "message": e }), + } + }, _ => json!({ "status": "error", "message": "Unknown request type" }), }; From f9373683d45dae57f2e7cdfc5eca470bb1955a74 Mon Sep 17 00:00:00 2001 From: IgorSemed0 Date: Mon, 11 Aug 2025 18:38:14 +0100 Subject: [PATCH 08/14] fix(build): core --- casper-core/src/connections.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/casper-core/src/connections.rs b/casper-core/src/connections.rs index 1e20381..adcc722 100644 --- a/casper-core/src/connections.rs +++ b/casper-core/src/connections.rs @@ -1,6 +1,6 @@ use reqwest::Client; -pub async fn connect_to_service(service: &str, action: &str) -> Result { +pub async fn connect_to_service(service: &str, _action: &str) -> Result { // Example HTTP request let client = Client::new(); match service { From bfb22274a64761db809091ad1534f38e8b8605c3 Mon Sep 17 00:00:00 2001 From: IgorSemed0 Date: Mon, 11 Aug 2025 18:40:46 +0100 Subject: [PATCH 09/14] feat(test): feat calls --- tests/daemon/client/src/main.rs | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/tests/daemon/client/src/main.rs b/tests/daemon/client/src/main.rs index 87c1524..938aa99 100644 --- a/tests/daemon/client/src/main.rs +++ b/tests/daemon/client/src/main.rs @@ -1,14 +1,32 @@ use tokio::net::UnixStream; use tokio::io::{AsyncReadExt, AsyncWriteExt}; -#[tokio::main] -async fn main() -> Result<(), Box> { +async fn send_request(request: &str) -> Result> { let mut stream = UnixStream::connect("/tmp/casper.sock").await?; - let request = r#"{"type": "run_command", "command": "echo Hello, World!"}"#; stream.write_all(request.as_bytes()).await?; let mut buf = vec![0; 1024]; let n = stream.read(&mut buf).await?; - let response = String::from_utf8_lossy(&buf[..n]); - println!("{}", response); + Ok(String::from_utf8_lossy(&buf[..n]).to_string()) +} + +#[tokio::main] +async fn main() -> Result<(), Box> { + let tests = vec![ + r#"{"type": "run_command", "command": "echo Hello, World!"}"#, + r#"{"type": "move_mouse", "x": 100, "y": 200}"#, + r#"{"type": "type_text", "text": "Hello from Casper"}"#, + r#"{"type": "show_notification", "summary": "Test", "body": "Hello from Casper!"}"#, + r#"{"type": "connect_to_service", "service": "example_api", "action": "get"}"#, + r#"{"type": "process_mcp", "data": "test"}"#, + r#"{"type": "process_command", "command": "hello"}"#, + r#"{"type": "recognize_voice"}"#, + r#"{"type": "speak", "text": "Hello, this is Casper speaking"}"#, + ]; + + for request in tests { + let response = send_request(request).await?; + println!("Request: {}\nResponse: {}\n", request, response); + } + Ok(()) } \ No newline at end of file From dc6246b7ea734fd2823125a45d63c6fc18616661 Mon Sep 17 00:00:00 2001 From: IgorSemed0 Date: Mon, 11 Aug 2025 18:45:54 +0100 Subject: [PATCH 10/14] feat(test): feat calls --- tests/daemon/client/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/daemon/client/src/main.rs b/tests/daemon/client/src/main.rs index 938aa99..dc08676 100644 --- a/tests/daemon/client/src/main.rs +++ b/tests/daemon/client/src/main.rs @@ -20,7 +20,7 @@ async fn main() -> Result<(), Box> { r#"{"type": "process_mcp", "data": "test"}"#, r#"{"type": "process_command", "command": "hello"}"#, r#"{"type": "recognize_voice"}"#, - r#"{"type": "speak", "text": "Hello, this is Casper speaking"}"#, + r#"{"type": "speak", "text": "Hello, this is Casper speaking, is evething ok with you?"}"#, ]; for request in tests { From 9e3a65ebb0f15a1370cee90d3338486a18dfd6ea Mon Sep 17 00:00:00 2001 From: IgorSemed0 Date: Mon, 11 Aug 2025 19:14:11 +0100 Subject: [PATCH 11/14] feat(tui): initial setup --- casper-tui/Cargo.toml | 5 ++- casper-tui/src/main.rs | 100 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 101 insertions(+), 4 deletions(-) diff --git a/casper-tui/Cargo.toml b/casper-tui/Cargo.toml index 45b8399..c9434cf 100644 --- a/casper-tui/Cargo.toml +++ b/casper-tui/Cargo.toml @@ -5,6 +5,7 @@ edition = "2024" [dependencies] casper-core = { path = "../casper-core" } -ratatui = "0.23.0" +ratatui = "0.26.2" crossterm = "0.27.0" -tokio = { version = "1.46.1", features = ["rt", "net"] } \ No newline at end of file +tokio = { version = "1.46.1", features = ["rt", "net", "io-util"] } +serde_json = "1.0.0" \ No newline at end of file diff --git a/casper-tui/src/main.rs b/casper-tui/src/main.rs index e7a11a9..a3127d9 100644 --- a/casper-tui/src/main.rs +++ b/casper-tui/src/main.rs @@ -1,3 +1,99 @@ -fn main() { - println!("Hello, world!"); +use ratatui::{ + backend::CrosstermBackend, + layout::{Constraint, Direction, Layout}, + widgets::{Block, Borders, Paragraph}, + Terminal, +}; +use crossterm::{ + event::{self, Event, KeyCode}, + terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen}, + execute, +}; +use tokio::net::UnixStream; +use tokio::io::{AsyncReadExt, AsyncWriteExt}; +use serde_json::json; +use std::io::{self, Stdout}; + +struct App { + input: String, + output: String, } + +impl App { + fn new() -> Self { + App { + input: String::new(), + output: String::new(), + } + } +} + +async fn send_request(request: &str) -> Result { + let mut stream = UnixStream::connect("/tmp/casper.sock") + .await + .map_err(|e| e.to_string())?; + stream + .write_all(request.as_bytes()) + .await + .map_err(|e| e.to_string())?; + let mut buf = vec![0; 1024]; + let n = stream.read(&mut buf).await.map_err(|e| e.to_string())?; + Ok(String::from_utf8_lossy(&buf[..n]).to_string()) +} + +fn main() -> io::Result<()> { + // Setup terminal + enable_raw_mode()?; + let mut stdout = io::stdout(); + execute!(stdout, EnterAlternateScreen)?; + let backend = CrosstermBackend::new(stdout); + let mut terminal = Terminal::new(backend)?; + + // Run TUI + let mut app = App::new(); + let rt = tokio::runtime::Runtime::new()?; + rt.block_on(async { + loop { + terminal.draw(|f| { + let chunks = Layout::default() + .direction(Direction::Vertical) + .constraints([Constraint::Percentage(10), Constraint::Percentage(90)].as_ref()) + .split(f.size()); + + let input_block = Block::default().title("Input").borders(Borders::ALL); + let input = Paragraph::new(app.input.as_str()).block(input_block); + f.render_widget(input, chunks[0]); + + let output_block = Block::default().title("Output").borders(Borders::ALL); + let output = Paragraph::new(app.output.as_str()).block(output_block); + f.render_widget(output, chunks[1]); + })?; + + if let Event::Key(key) = event::read()? { + match key.code { + KeyCode::Char(c) => app.input.push(c), + KeyCode::Backspace => app.input.pop(), + KeyCode::Enter => { + let request = json!({ + "type": "run_command", + "command": app.input.clone() + }); + app.output = match send_request(&request.to_string()).await { + Ok(resp) => resp, + Err(e) => format!("Error: {}", e), + }; + app.input.clear(); + } + KeyCode::Esc => break, + _ => {} + } + } + } + Ok::<(), io::Error>(()) + })?; + + // Cleanup terminal + disable_raw_mode()?; + execute!(terminal.backend_mut(), LeaveAlternateScreen)?; + Ok(()) +} \ No newline at end of file From 6ec7f4a5b1bb169178513f8257d4ba1a01532dbd Mon Sep 17 00:00:00 2001 From: IgorSemed0 Date: Mon, 11 Aug 2025 19:14:25 +0100 Subject: [PATCH 12/14] feat(tui): initial setup --- casper-tui/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/casper-tui/Cargo.toml b/casper-tui/Cargo.toml index c9434cf..80ec1a4 100644 --- a/casper-tui/Cargo.toml +++ b/casper-tui/Cargo.toml @@ -4,8 +4,8 @@ version = "0.1.0" edition = "2024" [dependencies] -casper-core = { path = "../casper-core" } +casper-core = { version = "0.1.0", path = "../casper-core" } ratatui = "0.26.2" crossterm = "0.27.0" tokio = { version = "1.46.1", features = ["rt", "net", "io-util"] } -serde_json = "1.0.0" \ No newline at end of file +serde_json = "1.0.0" From cec68a88673fe7795ddbb46264f23715c98227c4 Mon Sep 17 00:00:00 2001 From: IgorSemed0 Date: Mon, 11 Aug 2025 19:14:55 +0100 Subject: [PATCH 13/14] test: hello noah --- tests/daemon/client/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/daemon/client/src/main.rs b/tests/daemon/client/src/main.rs index dc08676..a71397f 100644 --- a/tests/daemon/client/src/main.rs +++ b/tests/daemon/client/src/main.rs @@ -20,7 +20,7 @@ async fn main() -> Result<(), Box> { r#"{"type": "process_mcp", "data": "test"}"#, r#"{"type": "process_command", "command": "hello"}"#, r#"{"type": "recognize_voice"}"#, - r#"{"type": "speak", "text": "Hello, this is Casper speaking, is evething ok with you?"}"#, + r#"{"type": "speak", "text": "Hello, noah, how are you? this is Casper speaking, is evething ok with you?"}"#, ]; for request in tests { From 8c308103d5bb956c03c0a037b9798e1ec3ea2777 Mon Sep 17 00:00:00 2001 From: IgorSemed0 Date: Mon, 11 Aug 2025 20:16:26 +0100 Subject: [PATCH 14/14] fea(tui): starter setup io --- Cargo.lock | 122 ++++++++++++++++++++++++++++++++--------- casper-core/Cargo.toml | 2 +- casper-tray/Cargo.toml | 2 +- casper-tui/Cargo.toml | 2 +- casper-tui/src/main.rs | 6 +- 5 files changed, 103 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 66328d4..a85fcc6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,6 +17,12 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + [[package]] name = "async-broadcast" version = "0.7.2" @@ -290,6 +296,7 @@ dependencies = [ "casper-core", "crossterm", "ratatui", + "serde_json", "tokio", ] @@ -299,6 +306,15 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" +[[package]] +name = "castaway" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a" +dependencies = [ + "rustversion", +] + [[package]] name = "cc" version = "1.2.29" @@ -330,6 +346,19 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +[[package]] +name = "compact_str" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f86b9c4c00838774a6d902ef931eff7470720c51d90c2e32cfe15dc304737b3f" +dependencies = [ + "castaway", + "cfg-if", + "itoa", + "ryu", + "static_assertions", +] + [[package]] name = "concurrent-queue" version = "2.5.0" @@ -572,6 +601,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + [[package]] name = "foreign-types" version = "0.3.2" @@ -858,7 +893,7 @@ version = "0.20.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8084af62f09475a3f529b1629c10c429d7600ee1398ae12dd3bf175d74e7145" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro-crate", "proc-macro2", "quote", @@ -1016,12 +1051,11 @@ name = "hashbrown" version = "0.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] [[package]] name = "heck" @@ -1276,12 +1310,6 @@ dependencies = [ "hashbrown", ] -[[package]] -name = "indoc" -version = "2.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd" - [[package]] name = "io-uring" version = "0.7.8" @@ -1311,9 +1339,18 @@ dependencies = [ [[package]] name = "itertools" -version = "0.11.0" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ "either", ] @@ -1374,6 +1411,15 @@ version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" +[[package]] +name = "lru" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" +dependencies = [ + "hashbrown", +] + [[package]] name = "mac-notification-sys" version = "0.6.6" @@ -1794,18 +1840,21 @@ checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" [[package]] name = "ratatui" -version = "0.23.0" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e2e4cd95294a85c3b4446e63ef054eea43e0205b1fd60120c16b74ff7ff96ad" +checksum = "f44c9e68fd46eda15c646fbb85e1040b657a58cdc8c98db1d97a55930d991eef" dependencies = [ "bitflags", "cassowary", + "compact_str", "crossterm", - "indoc", - "itertools", + "itertools 0.12.1", + "lru", "paste", + "stability", "strum", "unicode-segmentation", + "unicode-truncate", "unicode-width", ] @@ -2124,6 +2173,16 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "stability" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d904e7009df136af5297832a3ace3370cd14ff1546a232f4f185036c2736fcac" +dependencies = [ + "quote", + "syn", +] + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -2138,20 +2197,20 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strum" -version = "0.25.0" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" dependencies = [ "strum_macros", ] [[package]] name = "strum_macros" -version = "0.25.3" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ - "heck 0.4.1", + "heck", "proc-macro2", "quote", "rustversion", @@ -2223,7 +2282,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4be53aa0cba896d2dc615bd42bbc130acdcffa239e0a2d965ea5b3b2a86ffdb" dependencies = [ "cfg-expr", - "heck 0.5.0", + "heck", "pkg-config", "toml", "version-compare", @@ -2510,6 +2569,17 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" +[[package]] +name = "unicode-truncate" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3644627a5af5fa321c95b9b235a72fd24cd29c648c2c379431e6628655627bf" +dependencies = [ + "itertools 0.13.0", + "unicode-segmentation", + "unicode-width", +] + [[package]] name = "unicode-width" version = "0.1.14" @@ -3271,4 +3341,4 @@ dependencies = [ "static_assertions", "syn", "winnow", -] \ No newline at end of file +] diff --git a/casper-core/Cargo.toml b/casper-core/Cargo.toml index fa391d5..70eb43a 100644 --- a/casper-core/Cargo.toml +++ b/casper-core/Cargo.toml @@ -6,7 +6,7 @@ edition = "2024" [dependencies] enigo = "0.5.0" notify-rust = "4.0.0" -tokio = { version = "1.46.1", features = ["rt", "net", "io-util"] } +tokio = { version = "1.46.1", features = ["rt-multi-thread", "net", "io-util"] } serde = { version = "1.0.0", features = ["derive"] } serde_json = "1.0.0" reqwest = { version = "0.12.9", features = ["json"] } diff --git a/casper-tray/Cargo.toml b/casper-tray/Cargo.toml index d147ef7..b5e6060 100644 --- a/casper-tray/Cargo.toml +++ b/casper-tray/Cargo.toml @@ -6,4 +6,4 @@ edition = "2024" [dependencies] casper-core = { path = "../casper-core" } gtk4 = "0.9.6" -tokio = { version = "1.46.1", features = ["rt", "net"] } \ No newline at end of file +tokio = { version = "1.46.1", features = ["rt-multi-thread", "net"] } \ No newline at end of file diff --git a/casper-tui/Cargo.toml b/casper-tui/Cargo.toml index 80ec1a4..1989f64 100644 --- a/casper-tui/Cargo.toml +++ b/casper-tui/Cargo.toml @@ -7,5 +7,5 @@ edition = "2024" casper-core = { version = "0.1.0", path = "../casper-core" } ratatui = "0.26.2" crossterm = "0.27.0" -tokio = { version = "1.46.1", features = ["rt", "net", "io-util"] } +tokio = { version = "1.46.1", features = ["rt-multi-thread", "net", "io-util"] } serde_json = "1.0.0" diff --git a/casper-tui/src/main.rs b/casper-tui/src/main.rs index a3127d9..69680ab 100644 --- a/casper-tui/src/main.rs +++ b/casper-tui/src/main.rs @@ -12,7 +12,7 @@ use crossterm::{ use tokio::net::UnixStream; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use serde_json::json; -use std::io::{self, Stdout}; +use std::io; struct App { input: String, @@ -72,7 +72,9 @@ fn main() -> io::Result<()> { if let Event::Key(key) = event::read()? { match key.code { KeyCode::Char(c) => app.input.push(c), - KeyCode::Backspace => app.input.pop(), + KeyCode::Backspace => { + app.input.pop(); // Discard return value to return () + }, KeyCode::Enter => { let request = json!({ "type": "run_command",