MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / fork_session

Function fork_session

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

Source from the content-addressed store, hash-verified

490}
491
492async fn fork_session(
493 State(state): State<Arc<ServerState>>,
494 Path(id): Path<String>,
495 Json(req): Json<ForkSessionRequest>,
496) -> Result<Json<SessionInfo>> {
497 let forked = state
498 .sessions
499 .lock()
500 .await
501 .fork(&id, req.message_id.as_deref())
502 .ok_or_else(|| ApiError::SessionNotFound(id))?;
503 persist_sessions_if_enabled(&state).await;
504 Ok(Json(session_to_info(&forked)))
505}
506
507async fn share_session(
508 State(state): State<Arc<ServerState>>,

Callers

nothing calls this directly

Calls 3

session_to_infoFunction · 0.85
forkMethod · 0.80

Tested by

no test coverage detected