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

Function ensure_coordinator_session

src/apps/desktop/src/api/agentic_api.rs:780–819  ·  view source on GitHub ↗
(
    coordinator: State<'_, Arc<ConversationCoordinator>>,
    app_state: State<'_, AppState>,
    request: EnsureCoordinatorSessionRequest,
)

Source from the content-addressed store, hash-verified

778/// Uses the same remote→local session path mapping as `restore_session`.
779#[tauri::command]
780pub async fn ensure_coordinator_session(
781 coordinator: State<'_, Arc<ConversationCoordinator>>,
782 app_state: State<'_, AppState>,
783 request: EnsureCoordinatorSessionRequest,
784) -> Result<(), String> {
785 let session_id = request.session_id.trim();
786 if session_id.is_empty() {
787 return Err("session_id is required".to_string());
788 }
789 if coordinator
790 .get_session_manager()
791 .get_session(session_id)
792 .is_some()
793 {
794 return Ok(());
795 }
796
797 let wp = request.workspace_path.trim();
798 if wp.is_empty() {
799 return Err("workspace_path is required when the session is not loaded".to_string());
800 }
801
802 let effective = desktop_effective_session_storage_path(
803 &app_state,
804 wp,
805 request.remote_connection_id.as_deref(),
806 request.remote_ssh_host.as_deref(),
807 )
808 .await;
809 let restore_result = if request.include_internal {
810 coordinator
811 .restore_internal_session_from_storage_path(&effective, session_id)
812 .await
813 } else {
814 coordinator
815 .restore_session_from_storage_path(&effective, session_id)
816 .await
817 };
818 restore_result.map(|_| ()).map_err(|e| e.to_string())
819}
820
821#[tauri::command]
822pub async fn start_dialog_turn(

Callers

nothing calls this directly

Calls 7

trimMethod · 0.80
get_session_managerMethod · 0.80
is_emptyMethod · 0.45
get_sessionMethod · 0.45

Tested by

no test coverage detected