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

Function archive_session

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

Source from the content-addressed store, hash-verified

537}
538
539async fn archive_session(
540 State(state): State<Arc<ServerState>>,
541 Path(id): Path<String>,
542 Json(req): Json<ArchiveSessionRequest>,
543) -> Result<Json<SessionInfo>> {
544 let mut sessions = state.sessions.lock().await;
545 let info = if req.archive.unwrap_or(true) {
546 let updated = sessions
547 .set_archived(&id, None)
548 .ok_or_else(|| ApiError::SessionNotFound(id.clone()))?;
549 session_to_info(&updated)
550 } else {
551 let session = sessions
552 .get(&id)
553 .ok_or_else(|| ApiError::SessionNotFound(id.clone()))?;
554 session_to_info(session)
555 };
556 drop(sessions);
557 persist_sessions_if_enabled(&state).await;
558 Ok(Json(info))
559}
560
561#[derive(Debug, Deserialize)]
562pub struct SetTitleRequest {

Callers

nothing calls this directly

Calls 5

session_to_infoFunction · 0.85
set_archivedMethod · 0.80
cloneMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected