Update to ACP SDK v0.8.0 (#44063)
Uses the latest version of the SDK + schema crate. A bit painful because we needed to move to `#[non_exhaustive]` on all of these structs/enums, but will be much easier going forward. Also, since we depend on unstable features, I am pinning the version so we don't accidentally introduce compilation errors from other update cycles. Release Notes: - N/A
This commit is contained in:
@@ -261,7 +261,7 @@ impl ExampleContext {
|
||||
.expect("Unknown tool_name content in meta");
|
||||
|
||||
tool_uses_by_id.insert(
|
||||
tool_call.id,
|
||||
tool_call.tool_call_id,
|
||||
ToolUse {
|
||||
name: tool_name.to_string(),
|
||||
value: tool_call.raw_input.unwrap_or_default(),
|
||||
@@ -277,7 +277,9 @@ impl ExampleContext {
|
||||
ThreadEvent::ToolCallUpdate(tool_call_update) => {
|
||||
if let acp_thread::ToolCallUpdate::UpdateFields(update) = tool_call_update {
|
||||
if let Some(raw_input) = update.fields.raw_input {
|
||||
if let Some(tool_use) = tool_uses_by_id.get_mut(&update.id) {
|
||||
if let Some(tool_use) =
|
||||
tool_uses_by_id.get_mut(&update.tool_call_id)
|
||||
{
|
||||
tool_use.value = raw_input;
|
||||
}
|
||||
}
|
||||
@@ -290,7 +292,7 @@ impl ExampleContext {
|
||||
update.fields.status == Some(acp::ToolCallStatus::Completed);
|
||||
|
||||
let tool_use = tool_uses_by_id
|
||||
.remove(&update.id)
|
||||
.remove(&update.tool_call_id)
|
||||
.expect("Unrecognized tool call completed");
|
||||
|
||||
let log_message = if succeeded {
|
||||
@@ -337,10 +339,7 @@ impl ExampleContext {
|
||||
acp::StopReason::MaxTurnRequests => {
|
||||
return Err(anyhow!("Exceeded maximum turn requests"));
|
||||
}
|
||||
acp::StopReason::Refusal => {
|
||||
return Err(anyhow!("Refusal"));
|
||||
}
|
||||
acp::StopReason::Cancelled => return Err(anyhow!("Cancelled")),
|
||||
stop_reason => return Err(anyhow!("{stop_reason:?}")),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,13 +303,12 @@ impl ExampleInstance {
|
||||
let context_server_registry = cx.new(|cx| ContextServerRegistry::new(project.read(cx).context_server_store(), cx));
|
||||
|
||||
let thread = if let Some(json) = &meta.existing_thread_json {
|
||||
let session_id = acp::SessionId(
|
||||
let session_id = acp::SessionId::new(
|
||||
rand::rng()
|
||||
.sample_iter(&distr::Alphanumeric)
|
||||
.take(7)
|
||||
.map(char::from)
|
||||
.collect::<String>()
|
||||
.into(),
|
||||
.collect::<String>(),
|
||||
);
|
||||
|
||||
let db_thread = agent::DbThread::from_json(json.as_bytes()).expect("Can't read serialized thread");
|
||||
@@ -640,7 +639,7 @@ impl agent::ThreadEnvironment for EvalThreadEnvironment {
|
||||
cx.spawn(async move |cx| {
|
||||
let language_registry =
|
||||
project.read_with(cx, |project, _cx| project.languages().clone())?;
|
||||
let id = acp::TerminalId(uuid::Uuid::new_v4().to_string().into());
|
||||
let id = acp::TerminalId::new(uuid::Uuid::new_v4().to_string());
|
||||
let terminal =
|
||||
acp_thread::create_terminal_entity(command, &[], vec![], cwd.clone(), &project, cx)
|
||||
.await?;
|
||||
|
||||
Reference in New Issue
Block a user