codex-mobile-bridge 0.3.7

Remote bridge and service manager for codex-mobile.
Documentation
use super::*;

impl BridgeState {
    pub(super) fn thread_response_payload(
        &self,
        runtime_id: &str,
        result: &Value,
        archived: bool,
    ) -> Result<Value> {
        let thread_value = result.get("thread").context("返回缺少 thread 字段")?;
        let thread = normalize_thread(runtime_id, thread_value, archived)?;
        self.storage.upsert_thread_index(&thread)?;
        let _ = self.storage.record_directory_usage(Path::new(&thread.cwd));
        let _ = self.emit_directory_state();
        let thread = self.storage.get_thread_index(&thread.id)?.unwrap_or(thread);
        let render_snapshot = self
            .cache_thread_render_snapshot(build_thread_render_snapshot(runtime_id, thread_value)?);

        Ok(json!({
            "runtimeId": runtime_id,
            "thread": thread,
            "renderSnapshot": render_snapshot,
        }))
    }
}