use std::sync::Arc; use codex_extension_api::ExtensionEventSink; use codex_protocol::protocol::Event; use codex_protocol::protocol::EventMsg; use codex_protocol::protocol::ThreadGoal; use codex_protocol::protocol::ThreadGoalUpdatedEvent; #[derive(Clone)] pub(crate) struct GoalEventEmitter { sink: Arc, } impl GoalEventEmitter { pub(crate) fn new(sink: Arc) -> Self { Self { sink } } pub(crate) fn thread_goal_updated( &self, event_id: impl Into, turn_id: Option, goal: ThreadGoal, ) { self.sink.emit(Event { id: event_id.into(), msg: EventMsg::ThreadGoalUpdated(ThreadGoalUpdatedEvent { thread_id: goal.thread_id, turn_id, goal, }), }); } }