mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-10-08 07:21:13 +08:00
fix: restore service entrypoint and clean checks
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@ claude-server.tar
|
|||||||
dist
|
dist
|
||||||
.task
|
.task
|
||||||
/local-docs/
|
/local-docs/
|
||||||
bin
|
/bin/
|
||||||
logs/
|
logs/
|
||||||
cursor-server.db
|
cursor-server.db
|
||||||
cursor-server.db-shm
|
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() {
|
} else if output.is_empty() {
|
||||||
0
|
0
|
||||||
} else {
|
} 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()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn normalized(name: &str) -> String {
|
||||||
|
name.chars()
|
||||||
|
.filter(|character| character.is_ascii_alphanumeric())
|
||||||
|
.flat_map(char::to_lowercase)
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
@@ -420,10 +427,3 @@ mod tests {
|
|||||||
.is_none());
|
.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]
|
#[test]
|
||||||
fn task_keeps_wire_type_model_parent_and_background_fields() {
|
fn task_keeps_wire_type_model_parent_and_background_fields() {
|
||||||
let mut context = context();
|
let mut context = context();
|
||||||
context.subagent_models.insert(
|
context.subagent_model = Some(SubagentModel::Model("guide-model".into()));
|
||||||
"cursor-guide".into(),
|
|
||||||
SubagentModel::Model("guide-model".into()),
|
|
||||||
);
|
|
||||||
let call = task_call(serde_json::json!({
|
let call = task_call(serde_json::json!({
|
||||||
"description": "guide",
|
"description": "guide",
|
||||||
"prompt": "inspect",
|
"prompt": "inspect",
|
||||||
@@ -105,9 +102,7 @@ fn task_renders_general_typed_and_custom_subagent_types_without_aliases() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn disabled_task_model_is_left_for_the_model_visible_reminder() {
|
fn disabled_task_model_is_left_for_the_model_visible_reminder() {
|
||||||
let mut context = context();
|
let mut context = context();
|
||||||
context
|
context.subagent_model = Some(SubagentModel::Disabled);
|
||||||
.subagent_models
|
|
||||||
.insert("security-review".into(), SubagentModel::Disabled);
|
|
||||||
let call = task_call(serde_json::json!({
|
let call = task_call(serde_json::json!({
|
||||||
"description": "review",
|
"description": "review",
|
||||||
"prompt": "inspect",
|
"prompt": "inspect",
|
||||||
@@ -192,7 +187,7 @@ fn context() -> ExecContext {
|
|||||||
conversation_id: "child".into(),
|
conversation_id: "child".into(),
|
||||||
root_conversation_id: "root".into(),
|
root_conversation_id: "root".into(),
|
||||||
default_subagent_model: "parent-model".into(),
|
default_subagent_model: "parent-model".into(),
|
||||||
subagent_models: HashMap::new(),
|
subagent_model: None,
|
||||||
allow_subagents: true,
|
allow_subagents: true,
|
||||||
subagents_disabled: false,
|
subagents_disabled: false,
|
||||||
terminals_folder: "/tmp/terminals".into(),
|
terminals_folder: "/tmp/terminals".into(),
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ fn exec_context() -> ExecContext {
|
|||||||
conversation_id: "conversation".into(),
|
conversation_id: "conversation".into(),
|
||||||
root_conversation_id: "conversation".into(),
|
root_conversation_id: "conversation".into(),
|
||||||
default_subagent_model: "model".into(),
|
default_subagent_model: "model".into(),
|
||||||
subagent_models: std::collections::HashMap::new(),
|
subagent_model: None,
|
||||||
terminals_folder: "/tmp/terminals".into(),
|
terminals_folder: "/tmp/terminals".into(),
|
||||||
admin_command_denylist: Vec::new(),
|
admin_command_denylist: Vec::new(),
|
||||||
allow_subagents: true,
|
allow_subagents: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user