1use crate::schema::json_schema_for;
2use anyhow::{Context as _, Result, anyhow};
3use assistant_tool::{ActionLog, Tool, ToolCard, ToolResult, ToolUseStatus};
4use futures::{FutureExt as _, future::Shared};
5use gpui::{
6 AnyWindowHandle, App, AppContext, Empty, Entity, EntityId, Task, TextStyleRefinement,
7 WeakEntity, Window,
8};
9use language::LineEnding;
10use language_model::{LanguageModel, LanguageModelRequest, LanguageModelToolSchemaFormat};
11use markdown::{Markdown, MarkdownElement, MarkdownStyle};
12use portable_pty::{CommandBuilder, PtySize, native_pty_system};
13use project::{Project, terminals::TerminalKind};
14use schemars::JsonSchema;
15use serde::{Deserialize, Serialize};
16use settings::Settings;
17use std::{
18 env,
19 path::{Path, PathBuf},
20 process::ExitStatus,
21 sync::Arc,
22 time::{Duration, Instant},
23};
24use terminal_view::TerminalView;
25use theme::ThemeSettings;
26use ui::{Disclosure, Tooltip, prelude::*};
27use util::{
28 get_system_shell, markdown::MarkdownInlineCode, size::format_file_size,
29 time::duration_alt_display,
30};
31use workspace::Workspace;
32
33const COMMAND_OUTPUT_LIMIT: usize = 16 * 1024;
34
35#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)]
36pub struct TerminalToolInput {
37 /// The one-liner command to execute.
38 command: String,
39 /// Working directory for the command. This must be one of the root directories of the project.
40 cd: String,
41}
42
43pub struct TerminalTool {
44 determine_shell: Shared<Task<String>>,
45}
46
47impl TerminalTool {
48 pub const NAME: &str = "terminal";
49
50 pub(crate) fn new(cx: &mut App) -> Self {
51 let determine_shell = cx.background_spawn(async move {
52 if cfg!(windows) {
53 return get_system_shell();
54 }
55
56 if which::which("bash").is_ok() {
57 log::info!("agent selected bash for terminal tool");
58 "bash".into()
59 } else {
60 let shell = get_system_shell();
61 log::info!("agent selected {shell} for terminal tool");
62 shell
63 }
64 });
65 Self {
66 determine_shell: determine_shell.shared(),
67 }
68 }
69}
70
71impl Tool for TerminalTool {
72 fn name(&self) -> String {
73 Self::NAME.to_string()
74 }
75
76 fn needs_confirmation(&self, _: &serde_json::Value, _: &App) -> bool {
77 true
78 }
79
80 fn description(&self) -> String {
81 include_str!("./terminal_tool/description.md").to_string()
82 }
83
84 fn icon(&self) -> IconName {
85 IconName::Terminal
86 }
87
88 fn input_schema(&self, format: LanguageModelToolSchemaFormat) -> Result<serde_json::Value> {
89 json_schema_for::<TerminalToolInput>(format)
90 }
91
92 fn ui_text(&self, input: &serde_json::Value) -> String {
93 match serde_json::from_value::<TerminalToolInput>(input.clone()) {
94 Ok(input) => {
95 let mut lines = input.command.lines();
96 let first_line = lines.next().unwrap_or_default();
97 let remaining_line_count = lines.count();
98 match remaining_line_count {
99 0 => MarkdownInlineCode(&first_line).to_string(),
100 1 => MarkdownInlineCode(&format!(
101 "{} - {} more line",
102 first_line, remaining_line_count
103 ))
104 .to_string(),
105 n => MarkdownInlineCode(&format!("{} - {} more lines", first_line, n))
106 .to_string(),
107 }
108 }
109 Err(_) => "Run terminal command".to_string(),
110 }
111 }
112
113 fn run(
114 self: Arc<Self>,
115 input: serde_json::Value,
116 _request: Arc<LanguageModelRequest>,
117 project: Entity<Project>,
118 _action_log: Entity<ActionLog>,
119 _model: Arc<dyn LanguageModel>,
120 window: Option<AnyWindowHandle>,
121 cx: &mut App,
122 ) -> ToolResult {
123 let input: TerminalToolInput = match serde_json::from_value(input) {
124 Ok(input) => input,
125 Err(err) => return Task::ready(Err(anyhow!(err))).into(),
126 };
127
128 let working_dir = match working_dir(&input, &project, cx) {
129 Ok(dir) => dir,
130 Err(err) => return Task::ready(Err(err)).into(),
131 };
132 let program = self.determine_shell.clone();
133 let command = if cfg!(windows) {
134 format!("$null | & {{{}}}", input.command.replace("\"", "'"))
135 } else if let Some(cwd) = working_dir
136 .as_ref()
137 .and_then(|cwd| cwd.as_os_str().to_str())
138 {
139 // Make sure once we're *inside* the shell, we cd into `cwd`
140 format!("(cd {cwd}; {}) </dev/null", input.command)
141 } else {
142 format!("({}) </dev/null", input.command)
143 };
144 let args = vec!["-c".into(), command];
145
146 let cwd = working_dir.clone();
147 let env = match &working_dir {
148 Some(dir) => project.update(cx, |project, cx| {
149 project.directory_environment(dir.as_path().into(), cx)
150 }),
151 None => Task::ready(None).shared(),
152 };
153
154 let env = cx.spawn(async move |_| {
155 let mut env = env.await.unwrap_or_default();
156 if cfg!(unix) {
157 env.insert("PAGER".into(), "cat".into());
158 }
159 env
160 });
161
162 let Some(window) = window else {
163 // Headless setup, a test or eval. Our terminal subsystem requires a workspace,
164 // so bypass it and provide a convincing imitation using a pty.
165 let task = cx.background_spawn(async move {
166 let env = env.await;
167 let pty_system = native_pty_system();
168 let program = program.await;
169 let mut cmd = CommandBuilder::new(program);
170 cmd.args(args);
171 for (k, v) in env {
172 cmd.env(k, v);
173 }
174 if let Some(cwd) = cwd {
175 cmd.cwd(cwd);
176 }
177 let pair = pty_system.openpty(PtySize {
178 rows: 24,
179 cols: 80,
180 ..Default::default()
181 })?;
182 let mut child = pair.slave.spawn_command(cmd)?;
183 let mut reader = pair.master.try_clone_reader()?;
184 drop(pair);
185 let mut content = String::new();
186 reader.read_to_string(&mut content)?;
187 // Massage the pty output a bit to try to match what the terminal codepath gives us
188 LineEnding::normalize(&mut content);
189 content = content
190 .chars()
191 .filter(|c| c.is_ascii_whitespace() || !c.is_ascii_control())
192 .collect();
193 let content = content.trim_start().trim_start_matches("^D");
194 let exit_status = child.wait()?;
195 let (processed_content, _) =
196 process_content(content, &input.command, Some(exit_status));
197 Ok(processed_content.into())
198 });
199 return ToolResult {
200 output: task,
201 card: None,
202 };
203 };
204
205 let terminal = cx.spawn({
206 let project = project.downgrade();
207 async move |cx| {
208 let program = program.await;
209 let env = env.await;
210 let terminal = project
211 .update(cx, |project, cx| {
212 project.create_terminal(
213 TerminalKind::Task(task::SpawnInTerminal {
214 command: program,
215 args,
216 cwd,
217 env,
218 ..Default::default()
219 }),
220 window,
221 cx,
222 )
223 })?
224 .await;
225 terminal
226 }
227 });
228
229 let command_markdown = cx.new(|cx| {
230 Markdown::new(
231 format!("```bash\n{}\n```", input.command).into(),
232 None,
233 None,
234 cx,
235 )
236 });
237
238 let card = cx.new(|cx| {
239 TerminalToolCard::new(
240 command_markdown.clone(),
241 working_dir.clone(),
242 cx.entity_id(),
243 )
244 });
245
246 let output = cx.spawn({
247 let card = card.clone();
248 async move |cx| {
249 let terminal = terminal.await?;
250 let workspace = window
251 .downcast::<Workspace>()
252 .and_then(|handle| handle.entity(cx).ok())
253 .context("no workspace entity in root of window")?;
254
255 let terminal_view = window.update(cx, |_, window, cx| {
256 cx.new(|cx| {
257 TerminalView::new(
258 terminal.clone(),
259 workspace.downgrade(),
260 None,
261 project.downgrade(),
262 true,
263 window,
264 cx,
265 )
266 })
267 })?;
268
269 let _ = card.update(cx, |card, _| {
270 card.terminal = Some(terminal_view.clone());
271 card.start_instant = Instant::now();
272 });
273
274 let exit_status = terminal
275 .update(cx, |terminal, cx| terminal.wait_for_completed_task(cx))?
276 .await;
277 let (content, content_line_count) = terminal.read_with(cx, |terminal, _| {
278 (terminal.get_content(), terminal.total_lines())
279 })?;
280
281 let previous_len = content.len();
282 let (processed_content, finished_with_empty_output) = process_content(
283 &content,
284 &input.command,
285 exit_status.map(portable_pty::ExitStatus::from),
286 );
287
288 let _ = card.update(cx, |card, _| {
289 card.command_finished = true;
290 card.exit_status = exit_status;
291 card.was_content_truncated = processed_content.len() < previous_len;
292 card.original_content_len = previous_len;
293 card.content_line_count = content_line_count;
294 card.finished_with_empty_output = finished_with_empty_output;
295 card.elapsed_time = Some(card.start_instant.elapsed());
296 });
297
298 Ok(processed_content.into())
299 }
300 });
301
302 ToolResult {
303 output,
304 card: Some(card.into()),
305 }
306 }
307}
308
309fn process_content(
310 content: &str,
311 command: &str,
312 exit_status: Option<portable_pty::ExitStatus>,
313) -> (String, bool) {
314 let should_truncate = content.len() > COMMAND_OUTPUT_LIMIT;
315
316 let content = if should_truncate {
317 let mut end_ix = COMMAND_OUTPUT_LIMIT.min(content.len());
318 while !content.is_char_boundary(end_ix) {
319 end_ix -= 1;
320 }
321 // Don't truncate mid-line, clear the remainder of the last line
322 end_ix = content[..end_ix].rfind('\n').unwrap_or(end_ix);
323 &content[..end_ix]
324 } else {
325 content
326 };
327 let content = content.trim();
328 let is_empty = content.is_empty();
329 let content = format!("```\n{content}\n```");
330 let content = if should_truncate {
331 format!(
332 "Command output too long. The first {} bytes:\n\n{content}",
333 content.len(),
334 )
335 } else {
336 content
337 };
338
339 let content = match exit_status {
340 Some(exit_status) if exit_status.success() => {
341 if is_empty {
342 "Command executed successfully.".to_string()
343 } else {
344 content.to_string()
345 }
346 }
347 Some(exit_status) => {
348 if is_empty {
349 format!(
350 "Command \"{command}\" failed with exit code {}.",
351 exit_status.exit_code()
352 )
353 } else {
354 format!(
355 "Command \"{command}\" failed with exit code {}.\n\n{content}",
356 exit_status.exit_code()
357 )
358 }
359 }
360 None => {
361 format!(
362 "Command failed or was interrupted.\nPartial output captured:\n\n{}",
363 content,
364 )
365 }
366 };
367 (content, is_empty)
368}
369
370fn working_dir(
371 input: &TerminalToolInput,
372 project: &Entity<Project>,
373 cx: &mut App,
374) -> Result<Option<PathBuf>> {
375 let project = project.read(cx);
376 let cd = &input.cd;
377
378 if cd == "." || cd == "" {
379 // Accept "." or "" as meaning "the one worktree" if we only have one worktree.
380 let mut worktrees = project.worktrees(cx);
381
382 match worktrees.next() {
383 Some(worktree) => {
384 anyhow::ensure!(
385 worktrees.next().is_none(),
386 "'.' is ambiguous in multi-root workspaces. Please specify a root directory explicitly.",
387 );
388 Ok(Some(worktree.read(cx).abs_path().to_path_buf()))
389 }
390 None => Ok(None),
391 }
392 } else {
393 let input_path = Path::new(cd);
394
395 if input_path.is_absolute() {
396 // Absolute paths are allowed, but only if they're in one of the project's worktrees.
397 if project
398 .worktrees(cx)
399 .any(|worktree| input_path.starts_with(&worktree.read(cx).abs_path()))
400 {
401 return Ok(Some(input_path.into()));
402 }
403 } else {
404 if let Some(worktree) = project.worktree_for_root_name(cd, cx) {
405 return Ok(Some(worktree.read(cx).abs_path().to_path_buf()));
406 }
407 }
408
409 anyhow::bail!("`cd` directory {cd:?} was not in any of the project's worktrees.");
410 }
411}
412
413struct TerminalToolCard {
414 input_command: Entity<Markdown>,
415 working_dir: Option<PathBuf>,
416 entity_id: EntityId,
417 exit_status: Option<ExitStatus>,
418 terminal: Option<Entity<TerminalView>>,
419 command_finished: bool,
420 was_content_truncated: bool,
421 finished_with_empty_output: bool,
422 content_line_count: usize,
423 original_content_len: usize,
424 preview_expanded: bool,
425 start_instant: Instant,
426 elapsed_time: Option<Duration>,
427}
428
429impl TerminalToolCard {
430 pub fn new(
431 input_command: Entity<Markdown>,
432 working_dir: Option<PathBuf>,
433 entity_id: EntityId,
434 ) -> Self {
435 Self {
436 input_command,
437 working_dir,
438 entity_id,
439 exit_status: None,
440 terminal: None,
441 command_finished: false,
442 was_content_truncated: false,
443 finished_with_empty_output: false,
444 original_content_len: 0,
445 content_line_count: 0,
446 preview_expanded: true,
447 start_instant: Instant::now(),
448 elapsed_time: None,
449 }
450 }
451}
452
453impl ToolCard for TerminalToolCard {
454 fn render(
455 &mut self,
456 status: &ToolUseStatus,
457 window: &mut Window,
458 _workspace: WeakEntity<Workspace>,
459 cx: &mut Context<Self>,
460 ) -> impl IntoElement {
461 let Some(terminal) = self.terminal.as_ref() else {
462 return Empty.into_any();
463 };
464
465 let tool_failed = matches!(status, ToolUseStatus::Error(_));
466
467 let command_failed =
468 self.command_finished && self.exit_status.is_none_or(|code| !code.success());
469
470 if (tool_failed || command_failed) && self.elapsed_time.is_none() {
471 self.elapsed_time = Some(self.start_instant.elapsed());
472 }
473 let time_elapsed = self
474 .elapsed_time
475 .unwrap_or_else(|| self.start_instant.elapsed());
476 let should_hide_terminal = tool_failed || self.finished_with_empty_output;
477
478 let header_bg = cx
479 .theme()
480 .colors()
481 .element_background
482 .blend(cx.theme().colors().editor_foreground.opacity(0.025));
483
484 let border_color = cx.theme().colors().border.opacity(0.6);
485
486 let path = self
487 .working_dir
488 .as_ref()
489 .cloned()
490 .or_else(|| env::current_dir().ok())
491 .map(|path| format!("{}", path.display()))
492 .unwrap_or_else(|| "current directory".to_string());
493
494 let header = h_flex()
495 .flex_none()
496 .gap_1()
497 .justify_between()
498 .rounded_t_md()
499 .child(
500 div()
501 .id(("command-target-path", self.entity_id))
502 .w_full()
503 .max_w_full()
504 .overflow_x_scroll()
505 .child(
506 Label::new(path)
507 .buffer_font(cx)
508 .size(LabelSize::XSmall)
509 .color(Color::Muted),
510 ),
511 )
512 .when(self.was_content_truncated, |header| {
513 let tooltip = if self.content_line_count + 10 > terminal::MAX_SCROLL_HISTORY_LINES {
514 "Output exceeded terminal max lines and was \
515 truncated, the model received the first 16 KB."
516 .to_string()
517 } else {
518 format!(
519 "Output is {} long, to avoid unexpected token usage, \
520 only 16 KB was sent back to the model.",
521 format_file_size(self.original_content_len as u64, true),
522 )
523 };
524 header.child(
525 h_flex()
526 .id(("terminal-tool-truncated-label", self.entity_id))
527 .tooltip(Tooltip::text(tooltip))
528 .gap_1()
529 .child(
530 Icon::new(IconName::Info)
531 .size(IconSize::XSmall)
532 .color(Color::Ignored),
533 )
534 .child(
535 Label::new("Truncated")
536 .color(Color::Muted)
537 .size(LabelSize::Small),
538 ),
539 )
540 })
541 .when(time_elapsed > Duration::from_secs(10), |header| {
542 header.child(
543 Label::new(format!("({})", duration_alt_display(time_elapsed)))
544 .buffer_font(cx)
545 .color(Color::Muted)
546 .size(LabelSize::Small),
547 )
548 })
549 .when(tool_failed || command_failed, |header| {
550 header.child(
551 div()
552 .id(("terminal-tool-error-code-indicator", self.entity_id))
553 .child(
554 Icon::new(IconName::Close)
555 .size(IconSize::Small)
556 .color(Color::Error),
557 )
558 .when(command_failed && self.exit_status.is_some(), |this| {
559 this.tooltip(Tooltip::text(format!(
560 "Exited with code {}",
561 self.exit_status
562 .and_then(|status| status.code())
563 .unwrap_or(-1),
564 )))
565 })
566 .when(
567 !command_failed && tool_failed && status.error().is_some(),
568 |this| {
569 this.tooltip(Tooltip::text(format!(
570 "Error: {}",
571 status.error().unwrap(),
572 )))
573 },
574 ),
575 )
576 })
577 .when(!should_hide_terminal, |header| {
578 header.child(
579 Disclosure::new(
580 ("terminal-tool-disclosure", self.entity_id),
581 self.preview_expanded,
582 )
583 .opened_icon(IconName::ChevronUp)
584 .closed_icon(IconName::ChevronDown)
585 .on_click(cx.listener(
586 move |this, _event, _window, _cx| {
587 this.preview_expanded = !this.preview_expanded;
588 },
589 )),
590 )
591 });
592
593 v_flex()
594 .mb_2()
595 .border_1()
596 .when(tool_failed || command_failed, |card| card.border_dashed())
597 .border_color(border_color)
598 .rounded_lg()
599 .overflow_hidden()
600 .child(
601 v_flex()
602 .p_2()
603 .gap_0p5()
604 .bg(header_bg)
605 .text_xs()
606 .child(header)
607 .child(
608 MarkdownElement::new(
609 self.input_command.clone(),
610 markdown_style(window, cx),
611 )
612 .code_block_renderer(
613 markdown::CodeBlockRenderer::Default {
614 copy_button: false,
615 copy_button_on_hover: true,
616 border: false,
617 },
618 ),
619 ),
620 )
621 .when(self.preview_expanded && !should_hide_terminal, |this| {
622 this.child(
623 div()
624 .pt_2()
625 .min_h_72()
626 .border_t_1()
627 .border_color(border_color)
628 .bg(cx.theme().colors().editor_background)
629 .rounded_b_md()
630 .text_ui_sm(cx)
631 .child(terminal.clone()),
632 )
633 })
634 .into_any()
635 }
636}
637
638fn markdown_style(window: &Window, cx: &App) -> MarkdownStyle {
639 let theme_settings = ThemeSettings::get_global(cx);
640 let buffer_font_size = TextSize::Default.rems(cx);
641 let mut text_style = window.text_style();
642
643 text_style.refine(&TextStyleRefinement {
644 font_family: Some(theme_settings.buffer_font.family.clone()),
645 font_fallbacks: theme_settings.buffer_font.fallbacks.clone(),
646 font_features: Some(theme_settings.buffer_font.features.clone()),
647 font_size: Some(buffer_font_size.into()),
648 color: Some(cx.theme().colors().text),
649 ..Default::default()
650 });
651
652 MarkdownStyle {
653 base_text_style: text_style.clone(),
654 selection_background_color: cx.theme().players().local().selection,
655 ..Default::default()
656 }
657}
658
659#[cfg(test)]
660mod tests {
661 use editor::EditorSettings;
662 use fs::RealFs;
663 use gpui::{BackgroundExecutor, TestAppContext};
664 use language_model::fake_provider::FakeLanguageModel;
665 use pretty_assertions::assert_eq;
666 use serde_json::json;
667 use settings::{Settings, SettingsStore};
668 use terminal::terminal_settings::TerminalSettings;
669 use theme::ThemeSettings;
670 use util::{ResultExt as _, test::TempTree};
671
672 use super::*;
673
674 fn init_test(executor: &BackgroundExecutor, cx: &mut TestAppContext) {
675 zlog::init_test();
676
677 executor.allow_parking();
678 cx.update(|cx| {
679 let settings_store = SettingsStore::test(cx);
680 cx.set_global(settings_store);
681 language::init(cx);
682 Project::init_settings(cx);
683 workspace::init_settings(cx);
684 ThemeSettings::register(cx);
685 TerminalSettings::register(cx);
686 EditorSettings::register(cx);
687 });
688 }
689
690 #[gpui::test]
691 async fn test_interactive_command(executor: BackgroundExecutor, cx: &mut TestAppContext) {
692 if cfg!(windows) {
693 return;
694 }
695
696 init_test(&executor, cx);
697
698 let fs = Arc::new(RealFs::new(None, executor));
699 let tree = TempTree::new(json!({
700 "project": {},
701 }));
702 let project: Entity<Project> =
703 Project::test(fs, [tree.path().join("project").as_path()], cx).await;
704 let action_log = cx.update(|cx| cx.new(|_| ActionLog::new(project.clone())));
705 let model = Arc::new(FakeLanguageModel::default());
706
707 let input = TerminalToolInput {
708 command: "cat".to_owned(),
709 cd: tree
710 .path()
711 .join("project")
712 .as_path()
713 .to_string_lossy()
714 .to_string(),
715 };
716 let result = cx.update(|cx| {
717 TerminalTool::run(
718 Arc::new(TerminalTool::new(cx)),
719 serde_json::to_value(input).unwrap(),
720 Arc::default(),
721 project.clone(),
722 action_log.clone(),
723 model,
724 None,
725 cx,
726 )
727 });
728
729 let output = result.output.await.log_err().unwrap().content;
730 assert_eq!(output.as_str().unwrap(), "Command executed successfully.");
731 }
732
733 #[gpui::test]
734 async fn test_working_directory(executor: BackgroundExecutor, cx: &mut TestAppContext) {
735 if cfg!(windows) {
736 return;
737 }
738
739 init_test(&executor, cx);
740
741 let fs = Arc::new(RealFs::new(None, executor));
742 let tree = TempTree::new(json!({
743 "project": {},
744 "other-project": {},
745 }));
746 let project: Entity<Project> =
747 Project::test(fs, [tree.path().join("project").as_path()], cx).await;
748 let action_log = cx.update(|cx| cx.new(|_| ActionLog::new(project.clone())));
749 let model = Arc::new(FakeLanguageModel::default());
750
751 let check = |input, expected, cx: &mut App| {
752 let headless_result = TerminalTool::run(
753 Arc::new(TerminalTool::new(cx)),
754 serde_json::to_value(input).unwrap(),
755 Arc::default(),
756 project.clone(),
757 action_log.clone(),
758 model.clone(),
759 None,
760 cx,
761 );
762 cx.spawn(async move |_| {
763 let output = headless_result.output.await.map(|output| output.content);
764 assert_eq!(
765 output
766 .ok()
767 .and_then(|content| content.as_str().map(ToString::to_string)),
768 expected
769 );
770 })
771 };
772
773 cx.update(|cx| {
774 check(
775 TerminalToolInput {
776 command: "pwd".into(),
777 cd: ".".into(),
778 },
779 Some(format!(
780 "```\n{}\n```",
781 tree.path().join("project").display()
782 )),
783 cx,
784 )
785 })
786 .await;
787
788 cx.update(|cx| {
789 check(
790 TerminalToolInput {
791 command: "pwd".into(),
792 cd: "other-project".into(),
793 },
794 None, // other-project is a dir, but *not* a worktree (yet)
795 cx,
796 )
797 })
798 .await;
799
800 // Absolute path above the worktree root
801 cx.update(|cx| {
802 check(
803 TerminalToolInput {
804 command: "pwd".into(),
805 cd: tree.path().to_string_lossy().into(),
806 },
807 None,
808 cx,
809 )
810 })
811 .await;
812
813 project
814 .update(cx, |project, cx| {
815 project.create_worktree(tree.path().join("other-project"), true, cx)
816 })
817 .await
818 .unwrap();
819
820 cx.update(|cx| {
821 check(
822 TerminalToolInput {
823 command: "pwd".into(),
824 cd: "other-project".into(),
825 },
826 Some(format!(
827 "```\n{}\n```",
828 tree.path().join("other-project").display()
829 )),
830 cx,
831 )
832 })
833 .await;
834
835 cx.update(|cx| {
836 check(
837 TerminalToolInput {
838 command: "pwd".into(),
839 cd: ".".into(),
840 },
841 None,
842 cx,
843 )
844 })
845 .await;
846 }
847}