From f22d40c98033fd63499065c9eae191e39990951d Mon Sep 17 00:00:00 2001 From: timurgordon Date: Wed, 4 Jun 2025 04:51:51 +0300 Subject: [PATCH] add ws client and server packages --- README.md | 2 +- client_ws/.gitignore | 1 + client_ws/Cargo.toml | 31 + client_ws/README.md | 86 + client_ws/src/lib.rs | 419 ++++ server_ws/.gitignore | 1 + server_ws/Cargo.lock | 2505 +++++++++++++++++++ server_ws/Cargo.toml | 28 + server_ws/README.md | 52 + server_ws/examples/e2e_rhai_flow.rs | 143 ++ server_ws/examples/timeout_demonstration.rs | 153 ++ server_ws/openrpc.json | 62 + server_ws/src/main.rs | 260 ++ server_ws/tests/timeout_integration_test.rs | 135 + 14 files changed, 3877 insertions(+), 1 deletion(-) create mode 100644 client_ws/.gitignore create mode 100644 client_ws/Cargo.toml create mode 100644 client_ws/README.md create mode 100644 client_ws/src/lib.rs create mode 100644 server_ws/.gitignore create mode 100644 server_ws/Cargo.lock create mode 100644 server_ws/Cargo.toml create mode 100644 server_ws/README.md create mode 100644 server_ws/examples/e2e_rhai_flow.rs create mode 100644 server_ws/examples/timeout_demonstration.rs create mode 100644 server_ws/openrpc.json create mode 100644 server_ws/src/main.rs create mode 100644 server_ws/tests/timeout_integration_test.rs diff --git a/README.md b/README.md index 674acf8..e73fd4f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # Circles -Architecture for a digital life. \ No newline at end of file +Architecture around our digital selves. \ No newline at end of file diff --git a/client_ws/.gitignore b/client_ws/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/client_ws/.gitignore @@ -0,0 +1 @@ +/target diff --git a/client_ws/Cargo.toml b/client_ws/Cargo.toml new file mode 100644 index 0000000..3552d52 --- /dev/null +++ b/client_ws/Cargo.toml @@ -0,0 +1,31 @@ +[package] +name = "circle_client_ws" +version = "0.1.0" +edition = "2021" + +[dependencies] +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +uuid = { version = "1.6", features = ["v4", "serde", "js"] } +log = "0.4" +futures-channel = { version = "0.3", features = ["sink"] } # For mpsc +futures-util = { version = "0.3", features = ["sink"] } # For StreamExt, SinkExt +thiserror = "1.0" +async-trait = "0.1" # May be needed for abstracting WS connection + +# WASM-specific dependencies +[target.'cfg(target_arch = "wasm32")'.dependencies] +gloo-net = { version = "0.4.0", features = ["websocket"] } +wasm-bindgen-futures = "0.4" +gloo-console = "0.3.0" # For wasm logging if needed, or use `log` with wasm_logger + +# Native-specific dependencies +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +tokio-tungstenite = { version = "0.23.0", features = ["native-tls"] } +tokio = { version = "1", features = ["rt", "macros"] } # For tokio::spawn on native +url = "2.5.0" # For native WebSocket connection + +[dev-dependencies] +# For examples within this crate, if any, or for testing +env_logger = "0.10" +# tokio = { version = "1", features = ["full"] } # If examples need full tokio runtime diff --git a/client_ws/README.md b/client_ws/README.md new file mode 100644 index 0000000..d7be221 --- /dev/null +++ b/client_ws/README.md @@ -0,0 +1,86 @@ +# Circle WebSocket Client (`circle_client_ws`) + +This crate provides a WebSocket client (`CircleWsClient`) designed to interact with a server that expects JSON-RPC messages, specifically for executing Rhai scripts. + +It is designed to be compatible with both WebAssembly (WASM) environments (e.g., web browsers) and native Rust applications. + +## Features + +- **Cross-Platform:** Works in WASM and native environments. + - Uses `gloo-net` for WebSockets in WASM. + - Uses `tokio-tungstenite` for WebSockets in native applications. +- **JSON-RPC Communication:** Implements client-side JSON-RPC 2.0 request and response handling. +- **Rhai Script Execution:** Provides a `play(script: String)` method to send Rhai scripts to the server for execution and receive their output. +- **Asynchronous Operations:** Leverages `async/await` and `futures` for non-blocking communication. +- **Connection Management:** Supports connecting to and disconnecting from a WebSocket server. +- **Error Handling:** Defines a comprehensive `CircleWsClientError` enum for various client-side errors. + +## Core Component + +- **`CircleWsClient`**: The main client struct. + - `new(ws_url: String)`: Creates a new client instance targeting the given WebSocket URL. + - `connect()`: Establishes the WebSocket connection. + - `play(script: String)`: Sends a Rhai script to the server for execution and returns the result. + - `disconnect()`: Closes the WebSocket connection. + +## Usage Example (Conceptual) + +```rust +use circle_client_ws::CircleWsClient; + +async fn run_client() { + let mut client = CircleWsClient::new("ws://localhost:8080/ws".to_string()); + + if let Err(e) = client.connect().await { + eprintln!("Failed to connect: {}", e); + return; + } + + let script = "print(\"Hello from Rhai via WebSocket!\"); 40 + 2".to_string(); + + match client.play(script).await { + Ok(result) => { + println!("Script output: {}", result.output); + } + Err(e) => { + eprintln!("Error during play: {}", e); + } + } + + client.disconnect().await; +} + +// To run this example, you'd need an async runtime like tokio for native +// or wasm-bindgen-test for WASM. +``` + +## Building + +### Native +```bash +cargo build +``` + +### WASM +```bash +cargo build --target wasm32-unknown-unknown +``` + +## Dependencies + +Key dependencies include: + +- `serde`, `serde_json`: For JSON serialization/deserialization. +- `futures-channel`, `futures-util`: For asynchronous stream and sink handling. +- `uuid`: For generating unique request IDs. +- `log`: For logging. +- `thiserror`: For error type definitions. + +**WASM-specific:** +- `gloo-net`: For WebSocket communication in WASM. +- `wasm-bindgen-futures`: To bridge Rust futures with JavaScript promises. + +**Native-specific:** +- `tokio-tungstenite`: For WebSocket communication in native environments. +- `tokio`: Asynchronous runtime for native applications. +- `url`: For URL parsing. diff --git a/client_ws/src/lib.rs b/client_ws/src/lib.rs new file mode 100644 index 0000000..2c75740 --- /dev/null +++ b/client_ws/src/lib.rs @@ -0,0 +1,419 @@ +use futures_channel::{mpsc, oneshot}; +use futures_util::{StreamExt, SinkExt, FutureExt}; +use log::{debug, error, info, warn}; +use serde::{Deserialize, Serialize}; +use serde_json::Value; +use std::collections::HashMap; +use std::sync::{Arc, Mutex}; +use thiserror::Error; +use uuid::Uuid; + +// Platform-specific WebSocket imports and spawn function +#[cfg(target_arch = "wasm32")] +use { + gloo_net::websocket::{futures::WebSocket, Message as GlooWsMessage, WebSocketError as GlooWebSocketError}, + wasm_bindgen_futures::spawn_local, +}; + +#[cfg(not(target_arch = "wasm32"))] +use { + tokio_tungstenite::{ + connect_async, + tungstenite::protocol::Message as TungsteniteWsMessage, + // tungstenite::error::Error as TungsteniteError, // Unused + }, + tokio::spawn as spawn_local, // Use tokio::spawn for native + // url::Url, // Url::parse is not used in the final connect_async call path +}; + + +// JSON-RPC Structures (client-side perspective) +#[derive(Serialize, Debug, Clone)] +pub struct JsonRpcRequestClient { + jsonrpc: String, + method: String, + params: Value, + id: String, +} + +#[derive(Deserialize, Debug, Clone)] +pub struct JsonRpcResponseClient { + jsonrpc: String, + pub result: Option, + pub error: Option, + pub id: String, +} + +#[derive(Deserialize, Debug, Clone)] +pub struct JsonRpcErrorClient { + pub code: i32, + pub message: String, + pub data: Option, +} + +#[derive(Serialize, Debug, Clone)] +pub struct PlayParamsClient { + pub script: String, +} + +#[derive(Deserialize, Debug, Clone)] +pub struct PlayResultClient { + pub output: String, +} + +#[derive(Error, Debug)] +pub enum CircleWsClientError { + #[error("WebSocket connection error: {0}")] + ConnectionError(String), + #[error("WebSocket send error: {0}")] + SendError(String), + #[error("WebSocket receive error: {0}")] + ReceiveError(String), + #[error("JSON serialization/deserialization error: {0}")] + JsonError(#[from] serde_json::Error), + #[error("Request timed out for request ID: {0}")] + Timeout(String), + #[error("JSON-RPC error response: {code} - {message}")] + JsonRpcError { code: i32, message: String, data: Option }, + #[error("No response received for request ID: {0}")] + NoResponse(String), + #[error("Client is not connected")] + NotConnected, + #[error("Internal channel error: {0}")] + ChannelError(String), +} + +// Wrapper for messages sent to the WebSocket task +enum InternalWsMessage { + SendJsonRpc(JsonRpcRequestClient, oneshot::Sender>), + Close, +} + +pub struct CircleWsClient { + ws_url: String, + // Sender to the internal WebSocket task + internal_tx: Option>, + // Handle to the spawned WebSocket task (for native, to join on drop if desired) + #[cfg(not(target_arch = "wasm32"))] + task_handle: Option>, + // Callback for unsolicited messages (e.g. notifications from server) + // For Yew, this would typically be a yew::Callback or similar + // For simplicity in this generic client, we'll use a Box + // This part is more complex to make fully generic and easy for Yew, so keeping it simple for now. + // unsolicited_message_callback: Option>, +} + +impl CircleWsClient { + pub fn new(ws_url: String) -> Self { + Self { + ws_url, + internal_tx: None, + #[cfg(not(target_arch = "wasm32"))] + task_handle: None, + // unsolicited_message_callback: None, + } + } + + pub async fn connect(&mut self) -> Result<(), CircleWsClientError> { + if self.internal_tx.is_some() { + info!("Client already connected or connecting."); + return Ok(()); + } + + let (internal_tx, internal_rx) = mpsc::channel::(32); + self.internal_tx = Some(internal_tx); + + let url = self.ws_url.clone(); + + // Pending requests: map request_id to a oneshot sender for the response + let pending_requests: Arc>>>> = + Arc::new(Mutex::new(HashMap::new())); + + let task_pending_requests = pending_requests.clone(); + + let task = async move { + #[cfg(target_arch = "wasm32")] + let ws_result = WebSocket::open(&url); + + #[cfg(not(target_arch = "wasm32"))] + let connect_attempt = async { + // Validate URL parsing separately if needed, but connect_async takes &str + // let parsed_url = Url::parse(&url).map_err(|e| CircleWsClientError::ConnectionError(format!("Invalid URL: {}", e)))?; + connect_async(&url).await.map_err(|e| CircleWsClientError::ConnectionError(e.to_string())) + }; + #[cfg(not(target_arch = "wasm32"))] + let ws_result = connect_attempt.await; + + match ws_result { + Ok(ws_conn_maybe_response) => { + #[cfg(target_arch = "wasm32")] + let ws_conn = ws_conn_maybe_response; + #[cfg(not(target_arch = "wasm32"))] + let (ws_conn, _) = ws_conn_maybe_response; + + info!("Successfully connected to WebSocket: {}", url); + let (mut ws_tx, mut ws_rx) = ws_conn.split(); + let mut internal_rx_fused = internal_rx.fuse(); + + loop { + futures_util::select! { + // Handle messages from the client's public methods (e.g., play) + internal_msg = internal_rx_fused.next().fuse() => { + match internal_msg { + Some(InternalWsMessage::SendJsonRpc(req, response_sender)) => { + let req_id = req.id.clone(); + match serde_json::to_string(&req) { + Ok(req_str) => { + debug!("Sending JSON-RPC request (ID: {}): {}", req_id, req_str); + + #[cfg(target_arch = "wasm32")] + let send_res = ws_tx.send(GlooWsMessage::Text(req_str)).await; + #[cfg(not(target_arch = "wasm32"))] + let send_res = ws_tx.send(TungsteniteWsMessage::Text(req_str)).await; + + if let Err(e) = send_res { + error!("WebSocket send error for request ID {}: {:?}", req_id, e); + let _ = response_sender.send(Err(CircleWsClientError::SendError(e.to_string()))); + } else { + // Store the sender to await the response + task_pending_requests.lock().unwrap().insert(req_id, response_sender); + } + } + Err(e) => { + error!("Failed to serialize request ID {}: {}", req_id, e); + let _ = response_sender.send(Err(CircleWsClientError::JsonError(e))); + } + } + } + Some(InternalWsMessage::Close) => { + info!("Close message received internally, closing WebSocket."); + let _ = ws_tx.close().await; + break; + } + None => { // internal_rx closed, meaning client was dropped + info!("Internal MPSC channel closed, WebSocket task shutting down."); + let _ = ws_tx.close().await; + break; + } + } + }, + + // Handle messages received from the WebSocket server + ws_msg_res = ws_rx.next().fuse() => { + match ws_msg_res { + Some(Ok(msg)) => { + #[cfg(target_arch = "wasm32")] + match msg { + GlooWsMessage::Text(text) => { + debug!("Received WebSocket message: {}", text); + // ... (parse logic as before) + match serde_json::from_str::(&text) { + Ok(response) => { + if let Some(sender) = task_pending_requests.lock().unwrap().remove(&response.id) { + if let Err(failed_send_val) = sender.send(Ok(response)) { + if let Ok(resp_for_log) = failed_send_val { warn!("Failed to send response to waiting task for ID: {}", resp_for_log.id); } + else { warn!("Failed to send response to waiting task, and also failed to get original response for logging.");} + } + } else { warn!("Received response for unknown request ID or unsolicited message: {:?}", response); } + } + Err(e) => { error!("Failed to parse JSON-RPC response: {}. Raw: {}", e, text); } + } + } + GlooWsMessage::Bytes(_) => { + debug!("Received binary WebSocket message (WASM)."); + } + } + #[cfg(not(target_arch = "wasm32"))] + match msg { + TungsteniteWsMessage::Text(text) => { + debug!("Received WebSocket message: {}", text); + // ... (parse logic as before) + match serde_json::from_str::(&text) { + Ok(response) => { + if let Some(sender) = task_pending_requests.lock().unwrap().remove(&response.id) { + if let Err(failed_send_val) = sender.send(Ok(response)) { + if let Ok(resp_for_log) = failed_send_val { warn!("Failed to send response to waiting task for ID: {}", resp_for_log.id); } + else { warn!("Failed to send response to waiting task, and also failed to get original response for logging.");} + } + } else { warn!("Received response for unknown request ID or unsolicited message: {:?}", response); } + } + Err(e) => { error!("Failed to parse JSON-RPC response: {}. Raw: {}", e, text); } + } + } + TungsteniteWsMessage::Binary(_) => { + debug!("Received binary WebSocket message (Native)."); + } + TungsteniteWsMessage::Ping(_) | TungsteniteWsMessage::Pong(_) => { + debug!("Received Ping/Pong (Native)."); + } + TungsteniteWsMessage::Close(_) => { + info!("WebSocket connection closed by server (Native)."); + break; + } + TungsteniteWsMessage::Frame(_) => { + debug!("Received Frame (Native) - not typically handled directly."); + } + } + } + Some(Err(e)) => { + error!("WebSocket receive error: {:?}", e); + break; // Exit loop on receive error + } + None => { // WebSocket stream closed + info!("WebSocket connection closed by server (stream ended)."); + break; + } + } + } + } + } + // Cleanup pending requests on exit + task_pending_requests.lock().unwrap().drain().for_each(|(_, sender)| { + let _ = sender.send(Err(CircleWsClientError::ConnectionError("WebSocket task terminated".to_string()))); + }); + } + Err(e) => { + error!("Failed to connect to WebSocket: {:?}", e); + // Notify any waiting senders about the connection failure + internal_rx.for_each(|msg| async { + if let InternalWsMessage::SendJsonRpc(_, response_sender) = msg { + let _ = response_sender.send(Err(CircleWsClientError::ConnectionError(e.to_string()))); + } + }).await; + } + } + info!("WebSocket task finished."); + }; + + #[cfg(target_arch = "wasm32")] + spawn_local(task); + #[cfg(not(target_arch = "wasm32"))] + { self.task_handle = Some(spawn_local(task)); } + + + Ok(()) + } + + pub fn play(&self, script: String) -> impl std::future::Future> + Send + 'static { + let req_id_outer = Uuid::new_v4().to_string(); + + // Clone the sender option. The sender itself (mpsc::Sender) is also Clone. + let internal_tx_clone_opt = self.internal_tx.clone(); + + async move { + let req_id = req_id_outer; // Move req_id into the async block + let params = PlayParamsClient { script }; // script is moved in + + let request = match serde_json::to_value(params) { + Ok(p_val) => JsonRpcRequestClient { + jsonrpc: "2.0".to_string(), + method: "play".to_string(), + params: p_val, + id: req_id.clone(), + }, + Err(e) => return Err(CircleWsClientError::JsonError(e)), + }; + + let (response_tx, response_rx) = oneshot::channel(); + + if let Some(mut internal_tx) = internal_tx_clone_opt { + internal_tx.send(InternalWsMessage::SendJsonRpc(request, response_tx)).await + .map_err(|e| CircleWsClientError::ChannelError(format!("Failed to send request to internal task: {}", e)))?; + } else { + return Err(CircleWsClientError::NotConnected); + } + + // Add a timeout for waiting for the response + // For simplicity, using a fixed timeout here. Could be configurable. + #[cfg(target_arch = "wasm32")] + { + match response_rx.await { + Ok(Ok(rpc_response)) => { + if let Some(json_rpc_error) = rpc_response.error { + Err(CircleWsClientError::JsonRpcError { + code: json_rpc_error.code, + message: json_rpc_error.message, + data: json_rpc_error.data, + }) + } else if let Some(result_value) = rpc_response.result { + serde_json::from_value(result_value).map_err(CircleWsClientError::JsonError) + } else { + Err(CircleWsClientError::NoResponse(req_id.clone())) + } + } + Ok(Err(e)) => Err(e), // Error propagated from the ws task + Err(_) => Err(CircleWsClientError::Timeout(req_id.clone())), // oneshot channel cancelled + } + } + #[cfg(not(target_arch = "wasm32"))] + { + use tokio::time::timeout as tokio_timeout; + match tokio_timeout(std::time::Duration::from_secs(10), response_rx).await { + Ok(Ok(Ok(rpc_response))) => { // Timeout -> Result + if let Some(json_rpc_error) = rpc_response.error { + Err(CircleWsClientError::JsonRpcError { + code: json_rpc_error.code, + message: json_rpc_error.message, + data: json_rpc_error.data, + }) + } else if let Some(result_value) = rpc_response.result { + serde_json::from_value(result_value).map_err(CircleWsClientError::JsonError) + } else { + Err(CircleWsClientError::NoResponse(req_id.clone())) + } + } + Ok(Ok(Err(e))) => Err(e), // Error propagated from the ws task + Ok(Err(_)) => Err(CircleWsClientError::ChannelError("Response channel cancelled".to_string())), // oneshot cancelled + Err(_) => Err(CircleWsClientError::Timeout(req_id.clone())), // tokio_timeout expired + } + } + } + } + + pub async fn disconnect(&mut self) { + if let Some(mut tx) = self.internal_tx.take() { + info!("Sending close signal to internal WebSocket task."); + let _ = tx.send(InternalWsMessage::Close).await; + } + #[cfg(not(target_arch = "wasm32"))] + if let Some(handle) = self.task_handle.take() { + let _ = handle.await; // Wait for the task to finish + } + info!("Client disconnected."); + } +} + +// Ensure client cleans up on drop for native targets +#[cfg(not(target_arch = "wasm32"))] +impl Drop for CircleWsClient { + fn drop(&mut self) { + if self.internal_tx.is_some() || self.task_handle.is_some() { + warn!("CircleWsClient dropped without explicit disconnect. Spawning task to send close signal."); + // We can't call async disconnect directly in drop. + // Spawn a new task to send the close message if on native. + if let Some(mut tx) = self.internal_tx.take() { + spawn_local(async move { + info!("Drop: Sending close signal to internal WebSocket task."); + let _ = tx.send(InternalWsMessage::Close).await; + }); + } + if let Some(handle) = self.task_handle.take() { + spawn_local(async move { + info!("Drop: Waiting for WebSocket task to finish."); + let _ = handle.await; + info!("Drop: WebSocket task finished."); + }); + } + } + } +} + + +#[cfg(test)] +mod tests { + // use super::*; + #[test] + fn it_compiles() { + assert_eq!(2 + 2, 4); + } +} diff --git a/server_ws/.gitignore b/server_ws/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/server_ws/.gitignore @@ -0,0 +1 @@ +/target diff --git a/server_ws/Cargo.lock b/server_ws/Cargo.lock new file mode 100644 index 0000000..2f8bfba --- /dev/null +++ b/server_ws/Cargo.lock @@ -0,0 +1,2505 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "actix" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de7fa236829ba0841304542f7614c42b80fca007455315c45c785ccfa873a85b" +dependencies = [ + "actix-macros", + "actix-rt", + "actix_derive", + "bitflags", + "bytes", + "crossbeam-channel", + "futures-core", + "futures-sink", + "futures-task", + "futures-util", + "log", + "once_cell", + "parking_lot", + "pin-project-lite", + "smallvec", + "tokio", + "tokio-util", +] + +[[package]] +name = "actix-codec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f7b0a21988c1bf877cf4759ef5ddaac04c1c9fe808c9142ecb78ba97d97a28a" +dependencies = [ + "bitflags", + "bytes", + "futures-core", + "futures-sink", + "memchr", + "pin-project-lite", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "actix-http" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44dfe5c9e0004c623edc65391dfd51daa201e7e30ebd9c9bedf873048ec32bc2" +dependencies = [ + "actix-codec", + "actix-rt", + "actix-service", + "actix-utils", + "base64", + "bitflags", + "brotli", + "bytes", + "bytestring", + "derive_more", + "encoding_rs", + "flate2", + "foldhash", + "futures-core", + "h2", + "http 0.2.12", + "httparse", + "httpdate", + "itoa", + "language-tags", + "local-channel", + "mime", + "percent-encoding", + "pin-project-lite", + "rand 0.9.1", + "sha1", + "smallvec", + "tokio", + "tokio-util", + "tracing", + "zstd", +] + +[[package]] +name = "actix-macros" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "actix-router" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13d324164c51f63867b57e73ba5936ea151b8a41a1d23d1031eeb9f70d0236f8" +dependencies = [ + "bytestring", + "cfg-if", + "http 0.2.12", + "regex", + "regex-lite", + "serde", + "tracing", +] + +[[package]] +name = "actix-rt" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24eda4e2a6e042aa4e55ac438a2ae052d3b5da0ecf83d7411e1a368946925208" +dependencies = [ + "futures-core", + "tokio", +] + +[[package]] +name = "actix-server" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a65064ea4a457eaf07f2fba30b4c695bf43b721790e9530d26cb6f9019ff7502" +dependencies = [ + "actix-rt", + "actix-service", + "actix-utils", + "futures-core", + "futures-util", + "mio", + "socket2", + "tokio", + "tracing", +] + +[[package]] +name = "actix-service" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e46f36bf0e5af44bdc4bdb36fbbd421aa98c79a9bce724e1edeb3894e10dc7f" +dependencies = [ + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "actix-utils" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88a1dcdff1466e3c2488e1cb5c36a71822750ad43839937f85d2f4d9f8b705d8" +dependencies = [ + "local-waker", + "pin-project-lite", +] + +[[package]] +name = "actix-web" +version = "4.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a597b77b5c6d6a1e1097fddde329a83665e25c5437c696a3a9a4aa514a614dea" +dependencies = [ + "actix-codec", + "actix-http", + "actix-macros", + "actix-router", + "actix-rt", + "actix-server", + "actix-service", + "actix-utils", + "actix-web-codegen", + "bytes", + "bytestring", + "cfg-if", + "cookie", + "derive_more", + "encoding_rs", + "foldhash", + "futures-core", + "futures-util", + "impl-more", + "itoa", + "language-tags", + "log", + "mime", + "once_cell", + "pin-project-lite", + "regex", + "regex-lite", + "serde", + "serde_json", + "serde_urlencoded", + "smallvec", + "socket2", + "time", + "tracing", + "url", +] + +[[package]] +name = "actix-web-actors" +version = "4.3.1+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f98c5300b38fd004fe7d2a964f9a90813fdbe8a81fed500587e78b1b71c6f980" +dependencies = [ + "actix", + "actix-codec", + "actix-http", + "actix-web", + "bytes", + "bytestring", + "futures-core", + "pin-project-lite", + "tokio", + "tokio-util", +] + +[[package]] +name = "actix-web-codegen" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f591380e2e68490b5dfaf1dd1aa0ebe78d84ba7067078512b4ea6e4492d622b8" +dependencies = [ + "actix-router", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "actix_derive" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6ac1e58cded18cb28ddc17143c4dea5345b3ad575e14f32f66e4054a56eb271" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "alloc-no-stdlib" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" +dependencies = [ + "alloc-no-stdlib", +] + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anstream" +version = "0.6.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" + +[[package]] +name = "anstyle-parse" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6680de5231bd6ee4c6191b8a1325daa282b415391ec9d3a37bd34f2060dc73fa" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.59.0", +] + +[[package]] +name = "async-trait" +version = "0.1.88" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "backtrace" +version = "0.3.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bitflags" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "brotli" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9991eea70ea4f293524138648e41ee89b0b2b12ddef3b255effa43c8056e0e0d" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "874bb8112abecc98cbd6d81ea4fa7e94fb9449648c93cc89aa40c81c24d7de03" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + +[[package]] +name = "bumpalo" +version = "3.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" + +[[package]] +name = "bytestring" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e465647ae23b2823b0753f50decb2d5a86d2bb2cac04788fafd1f80e45378e5f" +dependencies = [ + "bytes", +] + +[[package]] +name = "cc" +version = "1.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0fc897dc1e865cc67c0e05a836d9d3f1df3cbe442aa4a9473b18e12624a4951" +dependencies = [ + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-link", +] + +[[package]] +name = "circle_client_ws" +version = "0.1.0" +dependencies = [ + "async-trait", + "futures-channel", + "futures-util", + "gloo-console", + "gloo-net", + "log", + "serde", + "serde_json", + "thiserror", + "tokio", + "tokio-tungstenite", + "url", + "uuid", + "wasm-bindgen-futures", +] + +[[package]] +name = "circle_server_ws" +version = "0.1.0" +dependencies = [ + "actix", + "actix-web", + "actix-web-actors", + "chrono", + "circle_client_ws", + "clap", + "env_logger", + "futures-util", + "log", + "redis", + "rhai_client", + "serde", + "serde_json", + "tokio", + "tokio-tungstenite", + "url", + "uuid", +] + +[[package]] +name = "clap" +version = "4.5.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd60e63e9be68e5fb56422e397cf9baddded06dae1d2e523401542383bc72a9f" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89cc6392a1f72bbeb820d71f32108f61fdaf18bc526e1d23954168a67759ef51" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" + +[[package]] +name = "colorchoice" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" + +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "futures-core", + "memchr", + "pin-project-lite", + "tokio", + "tokio-util", +] + +[[package]] +name = "cookie" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" +dependencies = [ + "percent-encoding", + "time", + "version_check", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "data-encoding" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" + +[[package]] +name = "deranged" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "derive_more" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "unicode-xid", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "env_logger" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" +dependencies = [ + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "flate2" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ced92e76e966ca2fd84c8f7aa01a4aea65b0eb6648d72f7c8f3e2764a67fece" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fnv" +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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-core", + "futures-macro", + "futures-sink", + "futures-task", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasi 0.14.2+wasi-0.2.4", +] + +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" + +[[package]] +name = "gloo-console" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a17868f56b4a24f677b17c8cb69958385102fa879418052d60b50bc1727e261" +dependencies = [ + "gloo-utils", + "js-sys", + "serde", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-net" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ac9e8288ae2c632fa9f8657ac70bfe38a1530f345282d7ba66a1f70b72b7dc4" +dependencies = [ + "futures-channel", + "futures-core", + "futures-sink", + "gloo-utils", + "http 0.2.12", + "js-sys", + "pin-project", + "serde", + "serde_json", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "gloo-utils" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5555354113b18c547c1d3a98fbf7fb32a9ff4f6fa112ce823a21641a0ba3aa" +dependencies = [ + "js-sys", + "serde", + "serde_json", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "h2" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.12", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.15.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f154ce46856750ed433c8649605bf7ed2de3bc35fd9d2a9f30cddd873c80cb08" + +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "humantime" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b112acc8b3adf4b107a8ec20977da0273a8c386765a3ec0229bd500a1443f9f" + +[[package]] +name = "iana-time-zone" +version = "0.1.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" + +[[package]] +name = "icu_properties" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "potential_utf", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" + +[[package]] +name = "icu_provider" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" +dependencies = [ + "displaydoc", + "icu_locale_core", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "impl-more" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8a5a9a0ff0086c7a148acb942baaabeadf9504d10400b5a05645853729b9cd2" + +[[package]] +name = "indexmap" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "is-terminal" +version = "0.4.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9" +dependencies = [ + "hermit-abi", + "libc", + "windows-sys 0.59.0", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "jobserver" +version = "0.1.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" +dependencies = [ + "getrandom 0.3.3", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "language-tags" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388" + +[[package]] +name = "libc" +version = "0.2.172" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" + +[[package]] +name = "linux-raw-sys" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" + +[[package]] +name = "litemap" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" + +[[package]] +name = "local-channel" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6cbc85e69b8df4b8bb8b89ec634e7189099cea8927a276b7384ce5488e53ec8" +dependencies = [ + "futures-core", + "futures-sink", + "local-waker", +] + +[[package]] +name = "local-waker" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d873d7c67ce09b42110d801813efbc9364414e356be9935700d368351657487" + +[[package]] +name = "lock_api" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" +dependencies = [ + "libc", + "log", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.59.0", +] + +[[package]] +name = "native-tls" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "object" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" + +[[package]] +name = "openssl" +version = "0.10.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" + +[[package]] +name = "openssl-sys" +version = "0.9.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "parking_lot" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "potential_utf" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro2" +version = "1.0.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", +] + +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", +] + +[[package]] +name = "redis" +version = "0.25.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0d7a6955c7511f60f3ba9e86c6d02b3c3f144f8c24b288d1f4e18074ab8bbec" +dependencies = [ + "async-trait", + "bytes", + "combine", + "futures-util", + "itoa", + "percent-encoding", + "pin-project-lite", + "ryu", + "sha1_smol", + "socket2", + "tokio", + "tokio-util", + "url", +] + +[[package]] +name = "redox_syscall" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "928fca9cf2aa042393a8325b9ead81d2f0df4cb12e1e24cef072922ccd99c5af" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-lite" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53a49587ad06b26609c52e423de037e7f57f20d53535d66e08c695f347df952a" + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "rhai_client" +version = "0.1.0" +dependencies = [ + "chrono", + "log", + "redis", + "serde", + "serde_json", + "tokio", + "uuid", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustix" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustversion" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "schannel" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "serde" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.140" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha1_smol" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d" + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9203b8055f63a2a00e2f593bb0510367fe707d7ff1e5c872de2f537b339e5410" +dependencies = [ + "libc", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" + +[[package]] +name = "socket2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "2.0.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tempfile" +version = "3.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" +dependencies = [ + "fastrand", + "getrandom 0.3.3", + "once_cell", + "rustix", + "windows-sys 0.59.0", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "time" +version = "0.3.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" + +[[package]] +name = "time-macros" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tokio" +version = "1.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.52.0", +] + +[[package]] +name = "tokio-macros" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6989540ced10490aaf14e6bad2e3d33728a2813310a0c71d1574304c49631cd" +dependencies = [ + "futures-util", + "log", + "native-tls", + "tokio", + "tokio-native-tls", + "tungstenite", +] + +[[package]] +name = "tokio-util" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" +dependencies = [ + "once_cell", +] + +[[package]] +name = "tungstenite" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e2ce1e47ed2994fd43b04c8f618008d4cabdd5ee34027cf14f9d918edd9c8" +dependencies = [ + "byteorder", + "bytes", + "data-encoding", + "http 1.3.1", + "httparse", + "log", + "native-tls", + "rand 0.8.5", + "sha1", + "thiserror", + "utf-8", +] + +[[package]] +name = "typenum" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "url" +version = "2.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "uuid" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d" +dependencies = [ + "getrandom 0.3.3", + "js-sys", + "serde", + "wasm-bindgen", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasi" +version = "0.14.2+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" +dependencies = [ + "cfg-if", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "wit-bindgen-rt" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags", +] + +[[package]] +name = "writeable" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" + +[[package]] +name = "yoke" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zstd" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "7.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" +dependencies = [ + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.15+zstd.1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb81183ddd97d0c74cedf1d50d85c8d08c1b8b68ee863bdee9e706eedba1a237" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/server_ws/Cargo.toml b/server_ws/Cargo.toml new file mode 100644 index 0000000..f80d013 --- /dev/null +++ b/server_ws/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "circle_server_ws" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +actix-web = "4" +actix-web-actors = "4" +actix = "0.13" +env_logger = "0.10" +log = "0.4" +clap = { version = "4.4", features = ["derive"] } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +redis = { version = "0.25.0", features = ["tokio-comp"] } # For async Redis with Actix +uuid = { version = "1.6", features = ["v4", "serde"] } +tokio = { version = "1", features = ["macros", "rt-multi-thread"] } # For polling interval +chrono = { version = "0.4", features = ["serde"] } # For timestamps +rhai_client = { path = "/Users/timurgordon/code/git.ourworld.tf/herocode/rhaj/src/client" } + +[dev-dependencies] +tokio-tungstenite = { version = "0.23.0", features = ["native-tls"] } +futures-util = "0.3" # For StreamExt and SinkExt on WebSocket stream +url = "2.5.0" # For parsing WebSocket URL +circle_client_ws = { path = "../client_ws" } +uuid = { version = "1.6", features = ["v4", "serde"] } # For e2e example, if it still uses Uuid directly for req id diff --git a/server_ws/README.md b/server_ws/README.md new file mode 100644 index 0000000..065abe8 --- /dev/null +++ b/server_ws/README.md @@ -0,0 +1,52 @@ +# Circle Server WebSocket (`server_ws`) + +## Overview + +The `server_ws` component is an Actix-based WebSocket server designed to handle client connections and execute Rhai scripts. It acts as a bridge between WebSocket clients and a Rhai scripting engine, facilitating remote script execution and result retrieval. + +## Key Features + +* **WebSocket Communication:** Establishes and manages WebSocket connections with clients. +* **Rhai Script Execution:** Receives Rhai scripts from clients, submits them for execution via `rhai_client`, and returns the results. +* **Timeout Management:** Implements timeouts for Rhai script execution to prevent indefinite blocking, returning specific error codes on timeout. +* **Asynchronous Processing:** Leverages Actix actors for concurrent handling of multiple client connections and script executions. + +## Core Components + +* **`CircleWs` Actor:** The primary Actix actor responsible for handling individual WebSocket sessions. It manages the lifecycle of a client connection, processes incoming messages (Rhai scripts), and sends back results or errors. +* **`rhai_client` Integration:** Utilizes the `rhai_client` crate to submit scripts to a shared Rhai processing service (likely Redis-backed for task queuing and result storage) and await their completion. + +## Dependencies + +* `actix`: Actor framework for building concurrent applications. +* `actix-web-actors`: WebSocket support for Actix. +* `rhai_client`: Client library for interacting with the Rhai scripting service. +* `serde_json`: For serializing and deserializing JSON messages exchanged over WebSockets. +* `uuid`: For generating unique task identifiers. + +## Workflow + +1. A client establishes a WebSocket connection to the `/ws/` endpoint. +2. The server upgrades the connection and spawns a `CircleWs` actor instance for that session. +3. The client sends a JSON-RPC formatted message containing the Rhai script to be executed. +4. The `CircleWs` actor parses the message and uses `rhai_client::RhaiClient::submit_script_and_await_result` to send the script for execution. This method handles the interaction with the underlying task queue (e.g., Redis) and waits for the script's outcome. +5. The `rhai_client` will return the script's result or an error (e.g., timeout, script error). +6. `CircleWs` formats the result/error into a JSON-RPC response and sends it back to the client over the WebSocket. + +## Configuration + +* **`REDIS_URL`**: The `rhai_client` component (and thus `server_ws` indirectly) relies on a Redis instance. The connection URL for this Redis instance is typically configured via an environment variable or a constant that `rhai_client` uses. +* **Timeout Durations**: + * `TASK_TIMEOUT_DURATION` (e.g., 30 seconds): The maximum time the server will wait for a Rhai script to complete execution. + * `TASK_POLL_INTERVAL_DURATION` (e.g., 200 milliseconds): The interval at which the `rhai_client` polls for task completion (this is an internal detail of `rhai_client` but relevant to understanding its behavior). + +## Error Handling + +The server implements specific JSON-RPC error responses for various scenarios: +* **Script Execution Timeout:** If a script exceeds `TASK_TIMEOUT_DURATION`, a specific error (e.g., code -32002) is returned. +* **Other `RhaiClientError`s:** Other errors originating from `rhai_client` (e.g., issues with the Redis connection, script compilation errors detected by the remote Rhai engine) are also translated into appropriate JSON-RPC error responses. +* **Message Parsing Errors:** Invalid incoming messages will result in error responses. + +## How to Run + +(Instructions on how to build and run the server would typically go here, e.g., `cargo run --bin circle_server_ws`) diff --git a/server_ws/examples/e2e_rhai_flow.rs b/server_ws/examples/e2e_rhai_flow.rs new file mode 100644 index 0000000..39a03f5 --- /dev/null +++ b/server_ws/examples/e2e_rhai_flow.rs @@ -0,0 +1,143 @@ +use std::process::{Command, Child, Stdio}; +use std::time::Duration; +use std::path::PathBuf; +use tokio::time::sleep; +// tokio_tungstenite and direct futures_util for ws stream are no longer needed here +// use tokio_tungstenite::{connect_async, tungstenite::protocol::Message as WsMessage}; +// use futures_util::{StreamExt, SinkExt}; +// use serde_json::Value; // No longer needed as CircleWsClient::play takes String +// Uuid is handled by CircleWsClient internally for requests. +// use uuid::Uuid; +use circle_client_ws::CircleWsClient; +// PlayResultClient and CircleWsClientError will be resolved via the client methods if needed, +// or this indicates they were not actually needed in the scope of this file directly. +// The compiler warning suggests they are unused from this specific import. + +const TEST_CIRCLE_NAME: &str = "e2e_test_circle"; +const TEST_SERVER_PORT: u16 = 9876; // Choose a unique port for the test +const RHAI_WORKER_BIN_NAME: &str = "rhai_worker"; +const CIRCLE_SERVER_WS_BIN_NAME: &str = "circle_server_ws"; + +// RAII guard for cleaning up child processes +struct ChildProcessGuard { + child: Child, + name: String, +} + +impl ChildProcessGuard { + fn new(child: Child, name: String) -> Self { + Self { child, name } + } +} + +impl Drop for ChildProcessGuard { + fn drop(&mut self) { + log::info!("Cleaning up {} process (PID: {})...", self.name, self.child.id()); + match self.child.kill() { + Ok(_) => { + log::info!("Successfully sent kill signal to {} (PID: {}).", self.name, self.child.id()); + // Optionally wait for a short period or check status + match self.child.wait() { + Ok(status) => log::info!("{} (PID: {}) exited with status: {}", self.name, self.child.id(), status), + Err(e) => log::warn!("Error waiting for {} (PID: {}): {}", self.name, self.child.id(), e), + } + } + Err(e) => log::error!("Failed to kill {} (PID: {}): {}", self.name, self.child.id(), e), + } + } +} + +fn find_target_dir() -> Result { + // Try to find the cargo target directory relative to current exe or manifest + let mut current_exe = std::env::current_exe().map_err(|e| format!("Failed to get current exe path: {}", e))?; + // current_exe is target/debug/examples/e2e_rhai_flow + // want target/debug/ + if current_exe.ends_with("examples/e2e_rhai_flow") { // Adjust if example name changes + current_exe.pop(); // remove e2e_rhai_flow + current_exe.pop(); // remove examples + Ok(current_exe) + } else { + // Fallback: Assume 'target/debug' relative to workspace root if CARGO_MANIFEST_DIR is set + let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").map_err(|_| "CARGO_MANIFEST_DIR not set".to_string())?; + let workspace_root = PathBuf::from(manifest_dir).parent().ok_or("Failed to get workspace root")?.to_path_buf(); + Ok(workspace_root.join("target").join("debug")) + } +} + + +#[tokio::main] +async fn main() -> Result<(), Box> { + env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")).init(); + + let target_dir = find_target_dir().map_err(|e| { + log::error!("Could not determine target directory: {}", e); + e + })?; + + let rhai_worker_path = target_dir.join(RHAI_WORKER_BIN_NAME); + let circle_server_ws_path = target_dir.join(CIRCLE_SERVER_WS_BIN_NAME); + + if !rhai_worker_path.exists() { + return Err(format!("Rhai worker binary not found at {:?}. Ensure it's built (e.g., cargo build --package rhai_worker)", rhai_worker_path).into()); + } + if !circle_server_ws_path.exists() { + return Err(format!("Circle server WS binary not found at {:?}. Ensure it's built (e.g., cargo build --package circle_server_ws)", circle_server_ws_path).into()); + } + + log::info!("Starting {}...", RHAI_WORKER_BIN_NAME); + let rhai_worker_process = Command::new(&rhai_worker_path) + .args(["--circles", TEST_CIRCLE_NAME]) + .stdout(Stdio::piped()) // Capture stdout + .stderr(Stdio::piped()) // Capture stderr + .spawn()?; + let _rhai_worker_guard = ChildProcessGuard::new(rhai_worker_process, RHAI_WORKER_BIN_NAME.to_string()); + log::info!("{} started with PID {}", RHAI_WORKER_BIN_NAME, _rhai_worker_guard.child.id()); + + log::info!("Starting {} for circle '{}' on port {}...", CIRCLE_SERVER_WS_BIN_NAME, TEST_CIRCLE_NAME, TEST_SERVER_PORT); + let circle_server_process = Command::new(&circle_server_ws_path) + .args(["--port", &TEST_SERVER_PORT.to_string(), "--circle-name", TEST_CIRCLE_NAME]) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn()?; + let _circle_server_guard = ChildProcessGuard::new(circle_server_process, CIRCLE_SERVER_WS_BIN_NAME.to_string()); + log::info!("{} started with PID {}", CIRCLE_SERVER_WS_BIN_NAME, _circle_server_guard.child.id()); + + // Give servers a moment to start + sleep(Duration::from_secs(3)).await; // Increased sleep + + let ws_url_str = format!("ws://127.0.0.1:{}/ws", TEST_SERVER_PORT); + + log::info!("Creating CircleWsClient for {}...", ws_url_str); + let mut client = CircleWsClient::new(ws_url_str.clone()); + + log::info!("Connecting CircleWsClient..."); + client.connect().await.map_err(|e| { + log::error!("CircleWsClient connection failed: {}", e); + format!("CircleWsClient connection failed: {}", e) + })?; + log::info!("CircleWsClient connected successfully."); + + let script_to_run = "let a = 5; let b = 10; print(\"E2E Rhai: \" + (a+b)); a + b"; + + log::info!("Sending 'play' request via CircleWsClient for script: '{}'", script_to_run); + + match client.play(script_to_run.to_string()).await { + Ok(play_result) => { + log::info!("Received play result: {:?}", play_result); + assert_eq!(play_result.output, "15"); + log::info!("E2E Test Passed! Correct output '15' received via CircleWsClient."); + } + Err(e) => { + log::error!("CircleWsClient play request failed: {}", e); + return Err(format!("CircleWsClient play request failed: {}", e).into()); + } + } + + log::info!("Disconnecting CircleWsClient..."); + client.disconnect().await; + log::info!("CircleWsClient disconnected."); + + log::info!("E2E Rhai flow example completed successfully."); + // Guards will automatically clean up child processes when they go out of scope here + Ok(()) +} \ No newline at end of file diff --git a/server_ws/examples/timeout_demonstration.rs b/server_ws/examples/timeout_demonstration.rs new file mode 100644 index 0000000..50743f5 --- /dev/null +++ b/server_ws/examples/timeout_demonstration.rs @@ -0,0 +1,153 @@ +// Example: Timeout Demonstration for circle_server_ws +// +// This example demonstrates how circle_server_ws handles Rhai scripts that exceed +// the configured execution timeout (default 30 seconds). +// +// This example will attempt to start its own instance of circle_server_ws. +// Ensure circle_server_ws is compiled (cargo build --bin circle_server_ws). + +use circle_client_ws::CircleWsClient; +use tokio::time::{sleep, Duration}; +use std::process::{Command, Child, Stdio}; +use std::path::PathBuf; + +const EXAMPLE_SERVER_PORT: u16 = 8089; // Using a specific port for this example +const WS_URL: &str = "ws://127.0.0.1:8089/ws"; +const CIRCLE_NAME_FOR_EXAMPLE: &str = "timeout_example_circle"; +const CIRCLE_SERVER_WS_BIN_NAME: &str = "circle_server_ws"; +const SCRIPT_TIMEOUT_SECONDS: u64 = 30; // This is the server-side timeout we expect to hit + +// RAII guard for cleaning up child processes +struct ChildProcessGuard { + child: Child, + name: String, +} + +impl ChildProcessGuard { + fn new(child: Child, name: String) -> Self { + log::info!("{} process started with PID: {}", name, child.id()); + Self { child, name } + } +} + +impl Drop for ChildProcessGuard { + fn drop(&mut self) { + log::info!("Cleaning up {} process (PID: {})...", self.name, self.child.id()); + match self.child.kill() { + Ok(_) => { + log::info!("Successfully sent kill signal to {} (PID: {}).", self.name, self.child.id()); + match self.child.wait() { + Ok(status) => log::info!("{} (PID: {}) exited with status: {}", self.name, self.child.id(), status), + Err(e) => log::warn!("Error waiting for {} (PID: {}): {}", self.name, self.child.id(), e), + } + } + Err(e) => log::error!("Failed to kill {} (PID: {}): {}", self.name, self.child.id(), e), + } + } +} + +fn find_target_bin_path(bin_name: &str) -> Result { + let mut current_exe = std::env::current_exe().map_err(|e| format!("Failed to get current exe path: {}", e))?; + // current_exe is typically target/debug/examples/timeout_demonstration + // We want to find target/debug/[bin_name] + current_exe.pop(); // remove executable name + current_exe.pop(); // remove examples directory + let target_debug_dir = current_exe; + let bin_path = target_debug_dir.join(bin_name); + if !bin_path.exists() { + // Fallback: try CARGO_BIN_EXE_[bin_name] if running via `cargo run --example` which sets these + if let Ok(cargo_bin_path_str) = std::env::var(format!("CARGO_BIN_EXE_{}", bin_name.to_uppercase())) { + let cargo_bin_path = PathBuf::from(cargo_bin_path_str); + if cargo_bin_path.exists() { + return Ok(cargo_bin_path); + } + } + // Fallback: try target/debug/[bin_name] relative to CARGO_MANIFEST_DIR (crate root) + if let Ok(manifest_dir_str) = std::env::var("CARGO_MANIFEST_DIR") { + let bin_path_rel_manifest = PathBuf::from(manifest_dir_str).join("target").join("debug").join(bin_name); + if bin_path_rel_manifest.exists() { + return Ok(bin_path_rel_manifest); + } + } + return Err(format!("Binary '{}' not found at {:?}. Ensure it's built.", bin_name, bin_path)); + } + Ok(bin_path) +} + +#[tokio::main] +async fn main() -> Result<(), Box> { + env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")).init(); + + let server_bin_path = find_target_bin_path(CIRCLE_SERVER_WS_BIN_NAME)?; + log::info!("Found server binary at: {:?}", server_bin_path); + + log::info!("Starting {} for circle '{}' on port {}...", CIRCLE_SERVER_WS_BIN_NAME, CIRCLE_NAME_FOR_EXAMPLE, EXAMPLE_SERVER_PORT); + let server_process = Command::new(&server_bin_path) + .args([ + "--port", &EXAMPLE_SERVER_PORT.to_string(), + "--circle-name", CIRCLE_NAME_FOR_EXAMPLE + ]) + .stdout(Stdio::piped()) // Pipe stdout to keep terminal clean, or Stdio::inherit() to see server logs + .stderr(Stdio::piped()) // Pipe stderr as well + .spawn() + .map_err(|e| format!("Failed to start {}: {}. Ensure it is built.", CIRCLE_SERVER_WS_BIN_NAME, e))?; + + let _server_guard = ChildProcessGuard::new(server_process, CIRCLE_SERVER_WS_BIN_NAME.to_string()); + + log::info!("Giving the server a moment to start up..."); + sleep(Duration::from_secs(3)).await; // Wait for server to initialize + + log::info!("Attempting to connect to WebSocket server at: {}", WS_URL); + let mut client = CircleWsClient::new(WS_URL.to_string()); + + log::info!("Connecting client..."); + if let Err(e) = client.connect().await { + log::error!("Failed to connect to WebSocket server: {}", e); + log::error!("Please check server logs if it failed to start correctly."); + return Err(e.into()); + } + log::info!("Client connected successfully."); + + // This Rhai script is designed to run for much longer than the typical server timeout. + let long_running_script = " + log(\"Rhai: Starting long-running script...\"); + let mut x = 0; + for i in 0..9999999999 { // Extremely large loop + x = x + i; + if i % 100000000 == 0 { + // log(\"Rhai: Loop iteration \" + i); + } + } + // This part should not be reached if timeout works correctly. + log(\"Rhai: Long-running script finished calculation (x = \" + x + \").\"); + print(x); + x + ".to_string(); + + log::info!("Sending long-running script (expected to time out on server after ~{}s)...", SCRIPT_TIMEOUT_SECONDS); + + match client.play(long_running_script).await { + Ok(play_result) => { + log::warn!("Received unexpected success from play request: {:?}", play_result); + log::warn!("This might indicate the script finished faster than expected, or the timeout didn't trigger."); + } + Err(e) => { + log::info!("Received expected error from play request: {}", e); + log::info!("This demonstrates the server timing out the script execution."); + // You can further inspect the error details if CircleWsClientError provides them. + // For example, if e.to_string() contains 'code: -32002' or 'timed out'. + if e.to_string().contains("timed out") || e.to_string().contains("-32002") { + log::info!("Successfully received timeout error from the server!"); + } else { + log::warn!("Received an error, but it might not be the expected timeout error: {}", e); + } + } + } + + log::info!("Disconnecting client..."); + client.disconnect().await; + log::info!("Client disconnected."); + log::info!("Timeout demonstration example finished."); + + Ok(()) +} diff --git a/server_ws/openrpc.json b/server_ws/openrpc.json new file mode 100644 index 0000000..0565650 --- /dev/null +++ b/server_ws/openrpc.json @@ -0,0 +1,62 @@ +{ + "openrpc": "1.2.6", + "info": { + "title": "Circle WebSocket Server API", + "version": "0.1.0", + "description": "API for interacting with a Circle's WebSocket server, primarily for Rhai script execution." + }, + "methods": [ + { + "name": "play", + "summary": "Executes a Rhai script on the server.", + "params": [ + { + "name": "script", + "description": "The Rhai script to execute.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "result": { + "name": "playResult", + "description": "The output from the executed Rhai script.", + "schema": { + "$ref": "#/components/schemas/PlayResult" + } + }, + "examples": [ + { + "name": "Simple Script Execution", + "params": [ + { + "name": "script", + "value": "let x = 10; x * 2" + } + ], + "result": { + "name": "playResult", + "value": { + "output": "20" + } + } + } + ] + } + ], + "components": { + "schemas": { + "PlayResult": { + "type": "object", + "properties": { + "output": { + "type": "string", + "description": "The string representation of the Rhai script's evaluation result." + } + }, + "required": ["output"] + } + } + } +} \ No newline at end of file diff --git a/server_ws/src/main.rs b/server_ws/src/main.rs new file mode 100644 index 0000000..9de61f2 --- /dev/null +++ b/server_ws/src/main.rs @@ -0,0 +1,260 @@ +use actix_web::{web, App, HttpRequest, HttpServer, HttpResponse, Error}; +use actix_web_actors::ws; +use actix::{Actor, ActorContext, StreamHandler, AsyncContext, WrapFuture, ActorFutureExt}; +// HashMap no longer needed +use clap::Parser; +use serde::{Deserialize, Serialize}; +use serde_json::Value; +use std::time::Duration; +// AsyncCommands no longer directly used here +use rhai_client::RhaiClientError; // Import RhaiClientError for matching +// Uuid is not directly used here anymore for task_id generation, RhaiClient handles it. +// Utc no longer directly used here +// RhaiClientError is not directly handled here, errors from RhaiClient are strings or RhaiClient's own error type. +use rhai_client::RhaiClient; // ClientRhaiTaskDetails is used via rhai_client::RhaiTaskDetails + +const REDIS_URL: &str = "redis://127.0.0.1/"; // Make this configurable if needed + +// JSON-RPC 2.0 Structures +#[derive(Serialize, Deserialize, Debug, Clone)] // Added Clone +struct JsonRpcRequest { + jsonrpc: String, + method: String, + params: Value, + id: Option, +} + +#[derive(Serialize, Deserialize, Debug, Clone)] // Added Clone +struct JsonRpcResponse { + jsonrpc: String, + result: Option, + error: Option, + id: Value, +} + +#[derive(Serialize, Deserialize, Debug, Clone)] // Added Clone +struct JsonRpcError { + code: i32, + message: String, + data: Option, +} + +// Specific params and result for "play" method +#[derive(Serialize, Deserialize, Debug, Clone)] // Added Clone +struct PlayParams { + script: String, +} + +#[derive(Serialize, Deserialize, Debug, Clone)] // Added Clone +struct PlayResult { + output: String, +} + +// Local RhaiTaskDetails struct is removed, will use ClientRhaiTaskDetails from rhai_client crate. +// Ensure field names used in polling logic (e.g. error_message) are updated if they differ. +// rhai_client::RhaiTaskDetails uses 'error' and 'client_rpc_id'. + +#[derive(Parser, Debug)] +#[clap(author, version, about, long_about = None)] +struct Args { + #[clap(short, long, value_parser, default_value_t = 8080)] + port: u16, + + #[clap(short, long, value_parser)] + circle_name: String, +} + +// WebSocket Actor +struct CircleWs { + server_circle_name: String, + // redis_client field removed as RhaiClient handles its own connection +} + +const TASK_TIMEOUT_DURATION: Duration = Duration::from_secs(30); // 30 seconds timeout +const TASK_POLL_INTERVAL_DURATION: Duration = Duration::from_millis(200); // 200 ms poll interval + +impl CircleWs { + fn new(name: String) -> Self { + Self { + server_circle_name: name, + } + } +} + +impl Actor for CircleWs { + type Context = ws::WebsocketContext; + + fn started(&mut self, _ctx: &mut Self::Context) { + log::info!("WebSocket session started for server dedicated to: {}", self.server_circle_name); + } + + fn stopping(&mut self, _ctx: &mut Self::Context) -> actix::Running { + log::info!("WebSocket session stopping for server dedicated to: {}", self.server_circle_name); + actix::Running::Stop + } +} + +// WebSocket message handler +impl StreamHandler> for CircleWs { + fn handle(&mut self, msg: Result, ctx: &mut Self::Context) { + match msg { + Ok(ws::Message::Text(text)) => { + log::info!("WS Text for {}: {}", self.server_circle_name, text); + match serde_json::from_str::(&text) { + Ok(req) => { + let client_rpc_id = req.id.clone().unwrap_or(Value::Null); + if req.method == "play" { + match serde_json::from_value::(req.params.clone()) { + Ok(play_params) => { + // Use RhaiClient to submit the script + let script_content = play_params.script; + let current_circle_name = self.server_circle_name.clone(); + let rpc_id_for_client = client_rpc_id.clone(); // client_rpc_id is already Value + + let fut = async move { + match RhaiClient::new(REDIS_URL) { + Ok(rhai_task_client) => { + rhai_task_client.submit_script_and_await_result( + ¤t_circle_name, + script_content, + Some(rpc_id_for_client.clone()), + TASK_TIMEOUT_DURATION, + TASK_POLL_INTERVAL_DURATION, + ).await // This returns Result + } + Err(e) => { + log::error!("Failed to create RhaiClient: {}", e); + Err(e) // Convert the error from RhaiClient::new into the type expected by the map function's error path. + } + } + }; + + ctx.spawn(fut.into_actor(self).map(move |result, _act, ws_ctx| { + let response = match result { + Ok(task_details) => { // ClientRhaiTaskDetails + if task_details.status == "completed" { + log::info!("Task completed successfully. Client RPC ID: {:?}, Output: {:?}", task_details.client_rpc_id, task_details.output); + JsonRpcResponse { + jsonrpc: "2.0".to_string(), + result: Some(serde_json::to_value(PlayResult { + output: task_details.output.unwrap_or_default() + }).unwrap()), + error: None, + id: client_rpc_id, // Use the original client_rpc_id from the request + } + } else { // status == "error" + log::warn!("Task execution failed. Client RPC ID: {:?}, Error: {:?}", task_details.client_rpc_id, task_details.error); + JsonRpcResponse { + jsonrpc: "2.0".to_string(), + result: None, + error: Some(JsonRpcError { + code: -32004, // Script execution error + message: task_details.error.unwrap_or_else(|| "Script execution failed with no specific error message".to_string()), + data: None, + }), + id: client_rpc_id, + } + } + } + Err(rhai_err) => { // RhaiClientError + log::error!("RhaiClient operation failed: {}", rhai_err); + let (code, message) = match rhai_err { + RhaiClientError::Timeout(task_id) => (-32002, format!("Timeout waiting for task {} to complete", task_id)), + RhaiClientError::RedisError(e) => (-32003, format!("Redis communication error: {}", e)), + RhaiClientError::SerializationError(e) => (-32003, format!("Serialization error: {}", e)), + RhaiClientError::TaskNotFound(task_id) => (-32005, format!("Task {} not found after submission", task_id)), + }; + JsonRpcResponse { + jsonrpc: "2.0".to_string(), + result: None, + id: client_rpc_id, + error: Some(JsonRpcError { code, message, data: None }), + } + } + }; + ws_ctx.text(serde_json::to_string(&response).unwrap()); + })); + } + Err(e) => { // Invalid params for 'play' + log::error!("Invalid params for 'play' method: {}", e); + let err_resp = JsonRpcResponse { + jsonrpc: "2.0".to_string(), result: None, id: client_rpc_id, + error: Some(JsonRpcError { code: -32602, message: "Invalid params".to_string(), data: Some(Value::String(e.to_string())) }), + }; + ctx.text(serde_json::to_string(&err_resp).unwrap()); + } + } + } else { // Method not found + log::warn!("Method not found: {}", req.method); + let err_resp = JsonRpcResponse { + jsonrpc: "2.0".to_string(), result: None, id: client_rpc_id, + error: Some(JsonRpcError { code: -32601, message: "Method not found".to_string(), data: None }), + }; + ctx.text(serde_json::to_string(&err_resp).unwrap()); + } + } + Err(e) => { // Parse error + log::error!("Failed to parse JSON-RPC request: {}", e); + let err_resp = JsonRpcResponse { + jsonrpc: "2.0".to_string(), result: None, id: Value::Null, // No ID if request couldn't be parsed + error: Some(JsonRpcError { code: -32700, message: "Parse error".to_string(), data: Some(Value::String(e.to_string())) }), + }; + ctx.text(serde_json::to_string(&err_resp).unwrap()); + } + } + } + Ok(ws::Message::Ping(msg)) => ctx.pong(&msg), + Ok(ws::Message::Pong(_)) => {}, + Ok(ws::Message::Binary(_bin)) => log::warn!("Binary messages not supported."), + Ok(ws::Message::Close(reason)) => { + ctx.close(reason); + ctx.stop(); + } + Ok(ws::Message::Continuation(_)) => ctx.stop(), + Ok(ws::Message::Nop) => (), + Err(e) => { + log::error!("WS Error: {:?}", e); + ctx.stop(); + } + } + } +} + +// WebSocket handshake and actor start +async fn ws_handler( + req: HttpRequest, + stream: web::Payload, + server_name: web::Data, + // redis_client: web::Data, // No longer passed to CircleWs actor directly +) -> Result { + log::info!("WebSocket handshake attempt for server: {}", server_name.get_ref()); + let resp = ws::start( + CircleWs::new(server_name.get_ref().clone()), // Pass only the server name + &req, + stream + )?; + Ok(resp) +} + +#[actix_web::main] +async fn main() -> std::io::Result<()> { + let args = Args::parse(); + + std::env::set_var("RUST_LOG", "info,circle_server_ws=debug"); + env_logger::init(); + + log::info!( + "Starting WebSocket server for Circle: '{}' on port {}...", + args.circle_name, args.port + ); + + HttpServer::new(move || { + App::new() + .app_data(web::Data::new(args.circle_name.clone())) + .route("/ws", web::get().to(ws_handler)) + .default_service(web::route().to(|| async { HttpResponse::NotFound().body("404 Not Found - This is a WebSocket-only server for a specific circle.") })) + }) + .bind(("127.0.0.1", args.port))? + .run() + .await +} diff --git a/server_ws/tests/timeout_integration_test.rs b/server_ws/tests/timeout_integration_test.rs new file mode 100644 index 0000000..e3d3ec6 --- /dev/null +++ b/server_ws/tests/timeout_integration_test.rs @@ -0,0 +1,135 @@ +use tokio::time::Duration; // Removed unused sleep +use futures_util::{sink::SinkExt, stream::StreamExt}; +use tokio_tungstenite::{connect_async, tungstenite::protocol::Message}; +use serde_json::Value; // Removed unused json macro import +use std::process::Command; +use std::thread; +use std::sync::Once; + +// Define a simple JSON-RPC request structure for sending scripts +#[derive(serde::Serialize, Debug)] +struct JsonRpcRequest { + jsonrpc: String, + method: String, + params: ScriptParams, + id: u64, +} + +#[derive(serde::Serialize, Debug)] +struct ScriptParams { + script: String, +} + +// Define a simple JSON-RPC error response structure for assertion +#[derive(serde::Deserialize, Debug)] +struct JsonRpcErrorResponse { + _jsonrpc: String, // Field is present in response, but not used in assert + error: JsonRpcErrorDetails, + _id: Option, // Field is present in response, but not used in assert +} + +#[derive(serde::Deserialize, Debug)] +struct JsonRpcErrorDetails { + code: i32, + message: String, +} + +const SERVER_ADDRESS: &str = "ws://127.0.0.1:8088/ws"; // Match port in main.rs or make configurable +const TEST_CIRCLE_NAME: &str = "test_timeout_circle"; +const SERVER_STARTUP_TIME: Duration = Duration::from_secs(5); // Time to wait for server to start +const RHAI_TIMEOUT_SECONDS: u64 = 30; // Should match TASK_TIMEOUT_DURATION in circle_server_ws + +static START_SERVER: Once = Once::new(); + +fn ensure_server_is_running() { + START_SERVER.call_once(|| { + println!("Attempting to start circle_server_ws for integration tests..."); + // The server executable will be in target/debug relative to the crate root + let server_executable = "target/debug/circle_server_ws"; + + thread::spawn(move || { + let mut child = Command::new(server_executable) + .arg("--port=8088") // Use a specific port for testing + .arg(format!("--circle-name={}", TEST_CIRCLE_NAME)) + .spawn() + .expect("Failed to start circle_server_ws. Make sure it's compiled (cargo build)."); + + let status = child.wait().expect("Failed to wait on server process."); + println!("Server process exited with status: {}", status); + }); + println!("Server start command issued. Waiting for {}s...", SERVER_STARTUP_TIME.as_secs()); + thread::sleep(SERVER_STARTUP_TIME); + println!("Presumed server started."); + }); +} + +#[tokio::test] +async fn test_rhai_script_timeout() { + ensure_server_is_running(); + + println!("Connecting to WebSocket server: {}", SERVER_ADDRESS); + let (mut ws_stream, _response) = connect_async(SERVER_ADDRESS) + .await + .expect("Failed to connect to WebSocket server"); + println!("Connected to WebSocket server."); + + // Rhai script designed to run longer than RHAI_TIMEOUT_SECONDS + // A large loop should cause a timeout. + let long_running_script = format!(" + let mut x = 0; + for i in 0..999999999 {{ + x = x + i; + if i % 10000000 == 0 {{ + // debug(\"Looping: \" + i); // Optional: for server-side logging if enabled + }} + }} + print(x); // This line will likely not be reached due to timeout + "); + + let request = JsonRpcRequest { + jsonrpc: "2.0".to_string(), + method: "execute_script".to_string(), + params: ScriptParams { script: long_running_script }, + id: 1, + }; + + let request_json = serde_json::to_string(&request).expect("Failed to serialize request"); + println!("Sending long-running script request: {}", request_json); + ws_stream.send(Message::Text(request_json)).await.expect("Failed to send message"); + + println!("Waiting for response (expecting timeout after ~{}s)..", RHAI_TIMEOUT_SECONDS); + + // Wait for a response, expecting a timeout error + // The server's timeout is RHAI_TIMEOUT_SECONDS, client should wait a bit longer. + match tokio::time::timeout(Duration::from_secs(RHAI_TIMEOUT_SECONDS + 15), ws_stream.next()).await { + Ok(Some(Ok(Message::Text(text)))) => { + println!("Received response: {}", text); + let response: Result = serde_json::from_str(&text); + match response { + Ok(err_resp) => { + assert_eq!(err_resp.error.code, -32002, "Error code should indicate timeout."); + assert!(err_resp.error.message.contains("timed out"), "Error message should indicate timeout."); + println!("Timeout test passed! Received correct timeout error."); + } + Err(e) => { + panic!("Failed to deserialize error response: {}. Raw: {}", e, text); + } + } + } + Ok(Some(Ok(other_msg))) => { + panic!("Received unexpected message type: {:?}", other_msg); + } + Ok(Some(Err(e))) => { + panic!("WebSocket error: {}", e); + } + Ok(None) => { + panic!("WebSocket stream closed unexpectedly."); + } + Err(_) => { + panic!("Test timed out waiting for server response. Server might not have sent timeout error or took too long."); + } + } + + ws_stream.close(None).await.ok(); + println!("Test finished, WebSocket closed."); +}