mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-10-06 21:52:51 +08:00
feat(docs): add documentation site and demo features
- Introduced a new documentation site for Cursor BYOK using Next.js and Fumadocs. - Added a product demo page with a corresponding Vite configuration. - Implemented a demo API to simulate LLM calls and responses. - Enhanced the Makefile to include new build and development commands for the documentation. - Updated package.json scripts for building and running the documentation site. - Created various components and layouts for the documentation structure, including blog and user documentation sections. - Added styling for the new components and layouts to ensure a cohesive design. - Included a README and other necessary files for local development and deployment.
This commit is contained in:
@@ -745,89 +745,6 @@ async fn unknown_exec_id_is_a_protocol_error() {
|
||||
));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn await_shell_consumes_the_background_output_file_terminal_state() {
|
||||
let runtime = CursorToolRuntime::default();
|
||||
let dispatcher = ToolDispatcher::new(runtime.clone());
|
||||
let mut await_call = call("await-call", "AwaitShell");
|
||||
await_call.arguments = json!({
|
||||
"shell_id": "42",
|
||||
"block_until_ms": 1000,
|
||||
"pattern": "ready",
|
||||
});
|
||||
await_call.arguments_text = await_call.arguments.to_string();
|
||||
let completed = HashSet::new();
|
||||
let started = HashSet::new();
|
||||
let dispatched = dispatcher
|
||||
.start_batch(
|
||||
&[await_call],
|
||||
ToolBatchState {
|
||||
completed: &completed,
|
||||
started: &started,
|
||||
response_text: "",
|
||||
response_thinking: "",
|
||||
},
|
||||
&[],
|
||||
&BTreeMap::new(),
|
||||
&exec_context(),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let exec = dispatched[0]
|
||||
.messages
|
||||
.iter()
|
||||
.find_map(|message| match message.message.as_ref() {
|
||||
Some(pb::agent_server_message::Message::ExecServerMessage(exec)) => Some(exec),
|
||||
_ => None,
|
||||
})
|
||||
.unwrap();
|
||||
let Some(pb::exec_server_message::Message::ReadArgs(read)) = exec.message.as_ref() else {
|
||||
panic!("expected AwaitShell ReadArgs")
|
||||
};
|
||||
assert_eq!(read.path, "/tmp/terminals/42.txt");
|
||||
|
||||
let event = codec::client_event(
|
||||
&pb::ExecClientMessage {
|
||||
id: exec.id,
|
||||
message: Some(pb::exec_client_message::Message::ReadResult(
|
||||
pb::ReadResult {
|
||||
result: Some(pb::read_result::Result::Success(pb::ReadSuccess {
|
||||
output: Some(pb::read_success::Output::Content(
|
||||
"server ready\nexit_code: 0\n".into(),
|
||||
)),
|
||||
..Default::default()
|
||||
})),
|
||||
},
|
||||
)),
|
||||
..Default::default()
|
||||
},
|
||||
&runtime,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let codec::ClientExecEvent::Completed(completion) = event else {
|
||||
panic!("expected completed AwaitShell")
|
||||
};
|
||||
assert_eq!(completion.result().call_id, "await-call");
|
||||
assert!(!completion.result().is_error);
|
||||
let Some(pb::tool_call::Tool::AwaitToolCall(tool)) = completion.tool_call().tool.as_ref()
|
||||
else {
|
||||
panic!("expected AwaitToolCall")
|
||||
};
|
||||
let pb::await_result::Result::Success(success) =
|
||||
tool.result.as_ref().unwrap().result.as_ref().unwrap()
|
||||
else {
|
||||
panic!("expected Await success")
|
||||
};
|
||||
let pb::await_success::AwaitResult::Complete(complete) = success.await_result.as_ref().unwrap()
|
||||
else {
|
||||
panic!("expected completed background task")
|
||||
};
|
||||
assert_eq!(complete.task_id, "42");
|
||||
assert_eq!(complete.exit_code, Some(0));
|
||||
assert_eq!(complete.regex_match.as_deref(), Some("ready"));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn provider_tool_use_waits_for_client_result_then_calls_provider_again() {
|
||||
let (directory, store) = fixtures::temp_store().await;
|
||||
|
||||
Reference in New Issue
Block a user