mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-10-04 19:31:28 +08:00
chore: release v0.1.0-beta.10
This commit is contained in:
@@ -274,20 +274,7 @@ pub(crate) async fn prepare(
|
||||
};
|
||||
RunAction::Resume { pending_tool_round }
|
||||
};
|
||||
let kind = match (request.subagent_type_name.as_deref(), parent) {
|
||||
(None, _) => RunKind::Root,
|
||||
(Some(name), Some((parent_run_id, parent_tool_call_id))) => RunKind::Subagent {
|
||||
parent_run_id,
|
||||
parent_tool_call_id,
|
||||
kind: model::subagent_kind(name),
|
||||
background: false,
|
||||
},
|
||||
(Some(_), None) => {
|
||||
return Err(Error::Protocol(
|
||||
"subagent Run is missing its parent Run and tool call".into(),
|
||||
));
|
||||
}
|
||||
};
|
||||
let kind = run_kind(request.subagent_type_name.as_deref(), parent)?;
|
||||
let exec = exec_context(
|
||||
request,
|
||||
&request_context,
|
||||
@@ -322,6 +309,21 @@ pub(crate) async fn prepare(
|
||||
))
|
||||
}
|
||||
|
||||
fn run_kind(subagent_type_name: Option<&str>, parent: Option<(RunId, String)>) -> Result<RunKind> {
|
||||
match (subagent_type_name, parent) {
|
||||
(None | Some("side-chat"), _) => Ok(RunKind::Root),
|
||||
(Some(name), Some((parent_run_id, parent_tool_call_id))) => Ok(RunKind::Subagent {
|
||||
parent_run_id,
|
||||
parent_tool_call_id,
|
||||
kind: model::subagent_kind(name),
|
||||
background: false,
|
||||
}),
|
||||
(Some(_), None) => Err(Error::Protocol(
|
||||
"subagent Run is missing its parent Run and tool call".into(),
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
fn validate_prompt_root(messages: &[CanonicalMessage]) -> Result<()> {
|
||||
let prompts = messages
|
||||
.iter()
|
||||
@@ -579,6 +581,23 @@ mod tests {
|
||||
assert!(mode_from_proto(99).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn side_chat_without_task_parent_is_an_independent_root_run() {
|
||||
assert!(matches!(
|
||||
run_kind(Some("side-chat"), None).unwrap(),
|
||||
RunKind::Root
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn task_subagent_without_parent_is_still_rejected() {
|
||||
assert!(matches!(
|
||||
run_kind(Some("explore"), None),
|
||||
Err(Error::Protocol(message))
|
||||
if message == "subagent Run is missing its parent Run and tool call"
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn current_user_message_consumes_the_mode_instead_of_history_mode() {
|
||||
let request = pb::AgentRunRequest {
|
||||
|
||||
Reference in New Issue
Block a user