MCPcopy Create free account
hub / github.com/GCWing/BitFun / terminal_get

Function terminal_get

src/apps/desktop/src/api/terminal_api.rs:447–479  ·  view source on GitHub ↗
(
    session_id: String,
    state: State<'_, TerminalState>,
)

Source from the content-addressed store, hash-verified

445
446#[tauri::command]
447pub async fn terminal_get(
448 session_id: String,
449 state: State<'_, TerminalState>,
450) -> Result<SessionResponse, String> {
451 // Try remote first (by session_id lookup, not global flag)
452 if let Some(remote_manager) = get_remote_workspace_manager() {
453 if let Some(terminal_manager) = remote_manager.get_terminal_manager().await {
454 if let Some(session) = terminal_manager.get_session(&session_id).await {
455 return Ok(SessionResponse {
456 id: session.id,
457 name: session.name,
458 shell_type: "Remote".to_string(),
459 cwd: session.cwd,
460 pid: session.pid,
461 status: format!("{:?}", session.status),
462 cols: session.cols,
463 rows: session.rows,
464 connection_id: Some(session.connection_id),
465 source: format_session_source(&session.source),
466 });
467 }
468 }
469 }
470
471 let api = state.get_or_init_api().await?;
472
473 let session = api
474 .get_session(&session_id)
475 .await
476 .map_err(|e| format!("Failed to get session: {}", e))?;
477
478 Ok(SessionResponse::from(session))
479}
480
481#[tauri::command]
482pub async fn terminal_list(

Callers

nothing calls this directly

Calls 5

format_session_sourceFunction · 0.85
get_terminal_managerMethod · 0.80
get_or_init_apiMethod · 0.80
get_sessionMethod · 0.45

Tested by

no test coverage detected