mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-10-04 02:52:55 +08:00
fix: restore service entrypoint and clean checks
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@ claude-server.tar
|
||||
dist
|
||||
.task
|
||||
/local-docs/
|
||||
bin
|
||||
/bin/
|
||||
logs/
|
||||
cursor-server.db
|
||||
cursor-server.db-shm
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -16,10 +16,7 @@ use cursor_server::{
|
||||
#[test]
|
||||
fn task_keeps_wire_type_model_parent_and_background_fields() {
|
||||
let mut context = context();
|
||||
context.subagent_models.insert(
|
||||
"cursor-guide".into(),
|
||||
SubagentModel::Model("guide-model".into()),
|
||||
);
|
||||
context.subagent_model = Some(SubagentModel::Model("guide-model".into()));
|
||||
let call = task_call(serde_json::json!({
|
||||
"description": "guide",
|
||||
"prompt": "inspect",
|
||||
@@ -105,9 +102,7 @@ fn task_renders_general_typed_and_custom_subagent_types_without_aliases() {
|
||||
#[test]
|
||||
fn disabled_task_model_is_left_for_the_model_visible_reminder() {
|
||||
let mut context = context();
|
||||
context
|
||||
.subagent_models
|
||||
.insert("security-review".into(), SubagentModel::Disabled);
|
||||
context.subagent_model = Some(SubagentModel::Disabled);
|
||||
let call = task_call(serde_json::json!({
|
||||
"description": "review",
|
||||
"prompt": "inspect",
|
||||
@@ -192,7 +187,7 @@ fn context() -> ExecContext {
|
||||
conversation_id: "child".into(),
|
||||
root_conversation_id: "root".into(),
|
||||
default_subagent_model: "parent-model".into(),
|
||||
subagent_models: HashMap::new(),
|
||||
subagent_model: None,
|
||||
allow_subagents: true,
|
||||
subagents_disabled: false,
|
||||
terminals_folder: "/tmp/terminals".into(),
|
||||
|
||||
@@ -42,7 +42,7 @@ fn exec_context() -> ExecContext {
|
||||
conversation_id: "conversation".into(),
|
||||
root_conversation_id: "conversation".into(),
|
||||
default_subagent_model: "model".into(),
|
||||
subagent_models: std::collections::HashMap::new(),
|
||||
subagent_model: None,
|
||||
terminals_folder: "/tmp/terminals".into(),
|
||||
admin_command_denylist: Vec::new(),
|
||||
allow_subagents: true,
|
||||
|
||||
Reference in New Issue
Block a user