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

Function set_session_run_status

crates/opencode-server/src/routes.rs:279–304  ·  view source on GitHub ↗
(
    state: &Arc<ServerState>,
    session_id: &str,
    status: SessionRunStatus,
)

Source from the content-addressed store, hash-verified

277 Lazy::new(|| RwLock::new(HashMap::new()));
278
279async fn set_session_run_status(
280 state: &Arc<ServerState>,
281 session_id: &str,
282 status: SessionRunStatus,
283) {
284 {
285 let mut statuses = SESSION_RUN_STATUS.write().await;
286 match &status {
287 SessionRunStatus::Idle => {
288 statuses.remove(session_id);
289 }
290 _ => {
291 statuses.insert(session_id.to_string(), status.clone());
292 }
293 }
294 }
295
296 state.broadcast(
297 &serde_json::json!({
298 "type": "session.status",
299 "sessionID": session_id,
300 "status": status,
301 })
302 .to_string(),
303 );
304}
305
306async fn session_status(
307 State(state): State<Arc<ServerState>>,

Callers 1

session_promptFunction · 0.85

Calls 3

broadcastMethod · 0.80
removeMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected