mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-10-05 20:44:07 +08:00
- Added initial server setup with Cargo.toml defining dependencies and project structure. - Created build.rs for generating protobuf bindings and validating wire contracts. - Established database schema with initial migration files for conversations, messages, and runs. - Introduced tools and prompts for Cursor functionality, enhancing user interaction capabilities.
36 lines
720 B
Rust
36 lines
720 B
Rust
//! Defines Run commands and their explicit delivery results.
|
|
|
|
use tokio::sync::oneshot;
|
|
|
|
use crate::model::{CanonicalMessage, ToolResult};
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
pub enum CommandResult {
|
|
Applied,
|
|
Duplicate,
|
|
RunClosing,
|
|
RunEnded,
|
|
StaleTarget,
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub struct MessageBatch {
|
|
pub event_id: String,
|
|
pub messages: Vec<CanonicalMessage>,
|
|
pub result: oneshot::Sender<CommandResult>,
|
|
}
|
|
|
|
impl MessageBatch {
|
|
pub fn complete(self, result: CommandResult) {
|
|
let _ = self.result.send(result);
|
|
}
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub enum RunCommand {
|
|
ToolResult(ToolResult),
|
|
InsertMessages(MessageBatch),
|
|
BreakMessages(MessageBatch),
|
|
Cancel,
|
|
}
|