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

Method set

crates/opencode-session/src/status.rs:84–110  ·  view source on GitHub ↗

Set the status for a session and publish bus events. Matches TS `SessionStatus.set(sessionID, status)`.

(&self, session_id: &str, status: SessionStatusInfo)

Source from the content-addressed store, hash-verified

82 /// Set the status for a session and publish bus events.
83 /// Matches TS `SessionStatus.set(sessionID, status)`.
84 pub async fn set(&self, session_id: &str, status: SessionStatusInfo) {
85 // Publish status event
86 if let Some(ref bus) = self.bus {
87 let event_data = serde_json::json!({
88 "sessionID": session_id,
89 "status": status,
90 });
91 bus.publish(&SESSION_STATUS_EVENT, event_data).await;
92 }
93
94 let mut state = self.state.write().await;
95 match &status {
96 SessionStatusInfo::Idle => {
97 // Publish deprecated idle event
98 if let Some(ref bus) = self.bus {
99 let idle_data = serde_json::json!({
100 "sessionID": session_id,
101 });
102 bus.publish(&SESSION_IDLE_EVENT, idle_data).await;
103 }
104 state.remove(session_id);
105 }
106 _ => {
107 state.insert(session_id.to_string(), status);
108 }
109 }
110 }
111
112 /// Convenience: set status to idle.
113 pub async fn set_idle(&self, session_id: &str) {

Callers 8

callbackMethod · 0.45
set_api_keyMethod · 0.45
set_authFunction · 0.45
set_plugin_loaderFunction · 0.45
load_plugin_auth_storeFunction · 0.45
set_idleMethod · 0.45
set_busyMethod · 0.45
set_retryMethod · 0.45

Calls 2

publishMethod · 0.80
removeMethod · 0.45

Tested by

no test coverage detected