fix: restore service entrypoint and clean checks

This commit is contained in:
leokun
2026-08-24 15:46:14 +08:00
parent 7fa4953883
commit 24177fcb6e
7 changed files with 35 additions and 25 deletions
+15
View File
@@ -0,0 +1,15 @@
use cursor_server::{App, Config, Result};
use tracing_subscriber::prelude::*;
#[tokio::main]
async fn main() -> Result<()> {
tracing_subscriber::registry()
.with(
tracing_subscriber::EnvFilter::try_from_default_env()
.unwrap_or_else(|_| "cursor_server=info".into()),
)
.with(tracing_subscriber::fmt::layer())
.init();
App::new(Config::from_env()?).await?.serve().await
}
+1 -1
View File
@@ -695,7 +695,7 @@ fn estimate_output_tokens(output: &str) -> u64 {
} else if output.is_empty() {
0
} else {
((output.chars().count() as u64) + 3) / 4
(output.chars().count() as u64).div_ceil(4)
}
}
+7 -7
View File
@@ -169,6 +169,13 @@ fn text(value: &Value, name: &str) -> String {
.into()
}
fn normalized(name: &str) -> String {
name.chars()
.filter(|character| character.is_ascii_alphanumeric())
.flat_map(char::to_lowercase)
.collect()
}
#[cfg(test)]
mod tests {
use super::*;
@@ -203,10 +210,3 @@ mod tests {
));
}
}
fn normalized(name: &str) -> String {
name.chars()
.filter(|character| character.is_ascii_alphanumeric())
.flat_map(char::to_lowercase)
.collect()
}
+7 -7
View File
@@ -346,6 +346,13 @@ impl CursorToolRuntime {
}
}
pub(crate) fn now_ms() -> u64 {
std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap_or_default()
.as_millis() as u64
}
#[cfg(test)]
mod tests {
use super::*;
@@ -420,10 +427,3 @@ mod tests {
.is_none());
}
}
pub(crate) fn now_ms() -> u64 {
std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap_or_default()
.as_millis() as u64
}