MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / update_session

Function update_session

crates/opencode-server/src/routes.rs:1838–1860  ·  view source on GitHub ↗
(
    State(state): State<Arc<ServerState>>,
    Path(id): Path<String>,
    Json(req): Json<UpdateSessionRequest>,
)

Source from the content-addressed store, hash-verified

1836}
1837
1838async fn update_session(
1839 State(state): State<Arc<ServerState>>,
1840 Path(id): Path<String>,
1841 Json(req): Json<UpdateSessionRequest>,
1842) -> Result<Json<SessionInfo>> {
1843 let mut sessions = state.sessions.lock().await;
1844 let session = sessions
1845 .get_mut(&id)
1846 .ok_or_else(|| ApiError::SessionNotFound(id.clone()))?;
1847
1848 if let Some(title) = req.title {
1849 session.set_title(title);
1850 }
1851 if let Some(time) = req.time {
1852 if let Some(archived) = time.archived {
1853 session.set_archived(Some(archived));
1854 }
1855 }
1856 let info = session_to_info(session);
1857 drop(sessions);
1858 persist_sessions_if_enabled(&state).await;
1859 Ok(Json(info))
1860}
1861
1862async fn get_message(
1863 State(state): State<Arc<ServerState>>,

Callers

nothing calls this directly

Calls 6

session_to_infoFunction · 0.85
set_titleMethod · 0.80
set_archivedMethod · 0.80
get_mutMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected