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

Function get_session_todos

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

Source from the content-addressed store, hash-verified

461 Lazy::new(opencode_session::TodoManager::new);
462
463async fn get_session_todos(
464 State(state): State<Arc<ServerState>>,
465 Path(id): Path<String>,
466) -> Result<Json<Vec<TodoInfo>>> {
467 let sessions = state.sessions.lock().await;
468 if sessions.get(&id).is_none() {
469 return Err(ApiError::SessionNotFound(id));
470 }
471 drop(sessions);
472
473 let todos = TODO_MANAGER.get(&id).await;
474 let items = todos
475 .into_iter()
476 .enumerate()
477 .map(|(idx, todo)| TodoInfo {
478 id: format!("{}_{}", id, idx),
479 content: todo.content,
480 status: todo.status,
481 priority: todo.priority,
482 })
483 .collect();
484 Ok(Json(items))
485}
486
487#[derive(Debug, Deserialize)]
488pub struct ForkSessionRequest {

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected