codex-mobile-bridge 0.3.3

Remote bridge and service manager for codex-mobile.
Documentation
mod content;
mod diff;
mod event_projection;
mod item_projection;
mod metadata;
mod metadata_merge;
mod normalize;
mod payload;
mod semantic;
mod summary;

use anyhow::Result;
use serde_json::Value;

use crate::bridge_protocol::{PersistedEvent, ThreadSummary, TimelineEntry};

pub(super) fn normalize_thread(
    runtime_id: &str,
    thread: &Value,
    archived: bool,
) -> Result<ThreadSummary> {
    normalize::normalize_thread(runtime_id, thread, archived)
}

pub(super) fn normalize_delta_payload(
    runtime_id: &str,
    params: Value,
    entry_type: &str,
    title: Option<String>,
    status: Option<String>,
    raw_type: &str,
    payload: Value,
    summary_index: Option<i64>,
    content_index: Option<i64>,
) -> Value {
    normalize::normalize_delta_payload(
        runtime_id,
        params,
        entry_type,
        title,
        status,
        raw_type,
        payload,
        summary_index,
        content_index,
    )
}

pub(super) fn timeline_entries_from_thread(
    runtime_id: &str,
    thread: &Value,
) -> Result<Vec<TimelineEntry>> {
    item_projection::timeline_entries_from_thread(runtime_id, thread)
}

pub(super) fn timeline_entry_from_thread_item(
    runtime_id: &str,
    thread_id: &str,
    turn_id: Option<&str>,
    item: &Value,
    source_kind: &str,
    is_streaming: bool,
    authoritative: bool,
) -> Option<TimelineEntry> {
    item_projection::timeline_entry_from_thread_item(
        runtime_id,
        thread_id,
        turn_id,
        item,
        source_kind,
        is_streaming,
        authoritative,
    )
}

pub(super) fn timeline_entry_from_plan_update(
    runtime_id: &str,
    thread_id: &str,
    turn_id: &str,
    explanation: Option<String>,
    plan: Value,
) -> TimelineEntry {
    item_projection::timeline_entry_from_plan_update(
        runtime_id,
        thread_id,
        turn_id,
        explanation,
        plan,
    )
}

pub(super) fn timeline_entries_from_events(events: &[PersistedEvent]) -> Vec<TimelineEntry> {
    event_projection::timeline_entries_from_events(events)
}