aKode fase 5: rinomina interna (crate akode-*, akode-rs/, akode-cli/, binario akode, AKODE_*, ~/.akode, snapshot)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
34
akode-rs/ext/goal/src/events.rs
Normal file
34
akode-rs/ext/goal/src/events.rs
Normal file
@@ -0,0 +1,34 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use akode_extension_api::ExtensionEventSink;
|
||||
use akode_protocol::protocol::Event;
|
||||
use akode_protocol::protocol::EventMsg;
|
||||
use akode_protocol::protocol::ThreadGoal;
|
||||
use akode_protocol::protocol::ThreadGoalUpdatedEvent;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct GoalEventEmitter {
|
||||
sink: Arc<dyn ExtensionEventSink>,
|
||||
}
|
||||
|
||||
impl GoalEventEmitter {
|
||||
pub(crate) fn new(sink: Arc<dyn ExtensionEventSink>) -> Self {
|
||||
Self { sink }
|
||||
}
|
||||
|
||||
pub(crate) fn thread_goal_updated(
|
||||
&self,
|
||||
event_id: impl Into<String>,
|
||||
turn_id: Option<String>,
|
||||
goal: ThreadGoal,
|
||||
) {
|
||||
self.sink.emit(Event {
|
||||
id: event_id.into(),
|
||||
msg: EventMsg::ThreadGoalUpdated(ThreadGoalUpdatedEvent {
|
||||
thread_id: goal.thread_id,
|
||||
turn_id,
|
||||
goal,
|
||||
}),
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user