mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-12-01 09:15:33 +08:00
fix: shell
This commit is contained in:
1 parent
df053c3720
commit
5450fc76e2
25 files changed
+1367
-101
No files matched your search
+50
-14
@@ -151,15 +151,39 @@ impl CursorActor {
|
||||
context.dynamic_tools.keys().cloned().collect(),
|
||||
context.turn_user.clone(),
|
||||
);
|
||||
if context.background_completion
|
||||
&& dependencies
|
||||
.run_registry
|
||||
.insert_messages(
|
||||
&prepared.conversation_id,
|
||||
prepared.initial_messages.clone(),
|
||||
)
|
||||
.await
|
||||
{
|
||||
crate::cursor::lifecycle::finish_success(
|
||||
&handle,
|
||||
);
|
||||
let _ = handle
|
||||
.command(CursorCommand::Finished)
|
||||
.await;
|
||||
return;
|
||||
}
|
||||
let cancellation = handle.cancellation();
|
||||
let (port, core) = crate::client::session(256);
|
||||
let core_commands = core.commands.clone();
|
||||
let actor = RunActor::new(
|
||||
dependencies.store.clone(),
|
||||
dependencies.provider,
|
||||
dependencies.run_registry,
|
||||
);
|
||||
let core_run =
|
||||
actor.spawn(prepared, port, cancellation).await;
|
||||
let core_run = actor
|
||||
.spawn(
|
||||
prepared,
|
||||
port,
|
||||
core_commands,
|
||||
cancellation,
|
||||
)
|
||||
.await;
|
||||
let session = CursorSession::new(
|
||||
handle.clone(),
|
||||
dependencies.store,
|
||||
@@ -181,7 +205,6 @@ impl CursorActor {
|
||||
%error,
|
||||
"Cursor session failed"
|
||||
);
|
||||
handle.cancel();
|
||||
let _ = crate::cursor::lifecycle::fail(
|
||||
&handle, &error,
|
||||
);
|
||||
@@ -235,12 +258,14 @@ impl CursorActor {
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if tool_runtime.take_exec(close.id).await.is_some()
|
||||
match codec::stream_closed(close.id, &tool_runtime)
|
||||
.await
|
||||
{
|
||||
results_tx.send_error(crate::Error::Protocol(format!(
|
||||
"Exec stream closed before result for id: {}",
|
||||
close.id
|
||||
)));
|
||||
Ok(Some(completion)) => {
|
||||
results_tx.send(completion)
|
||||
}
|
||||
Ok(None) => {}
|
||||
Err(error) => results_tx.send_error(error),
|
||||
}
|
||||
}
|
||||
Some(Message::Throw(throw)) => {
|
||||
@@ -311,13 +336,12 @@ impl CursorActor {
|
||||
//
|
||||
// The remaining unimplemented Action variants are
|
||||
// ShellCommandAction, StartPlanAction,
|
||||
// AsyncAskQuestionCompletionAction, CancelSubagentAction,
|
||||
// BackgroundShellAction, BackgroundSubagentAction,
|
||||
// AsyncAskQuestionCompletionAction, BackgroundShellAction,
|
||||
// BackgroundSubagentAction,
|
||||
// SubscriptionNotificationAction and GoalContinuationAction.
|
||||
// CancelSubagentAction must not start an LLM; variants whose wire
|
||||
// behavior is not captured yet need evidence before assigning
|
||||
// semantics. Every unsupported runtime Action must return an explicit
|
||||
// Protocol Error rather than falling through silently.
|
||||
// Variants whose wire behavior is not captured yet need evidence
|
||||
// before assigning semantics. Every unsupported runtime Action must
|
||||
// return an explicit Protocol Error rather than falling through silently.
|
||||
Some(
|
||||
pb::agent_client_message::Message::ConversationAction(
|
||||
action,
|
||||
@@ -341,6 +365,18 @@ impl CursorActor {
|
||||
));
|
||||
}
|
||||
}
|
||||
Some(
|
||||
pb::conversation_action::Action::CancelSubagentAction(
|
||||
action,
|
||||
),
|
||||
) => {
|
||||
if let Some(id) = tool_runtime
|
||||
.running_task_exec_id(&action.subagent_id)
|
||||
.await
|
||||
{
|
||||
let _ = handle.emit(&codec::abort(id));
|
||||
}
|
||||
}
|
||||
Some(action) => {
|
||||
results_tx.send_error(crate::Error::Protocol(format!(
|
||||
"unsupported runtime ConversationAction: {}",
|
||||
|
||||
Reference in new issue
Block a user