mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-08-26 23:50:17 +00:00
feat(bridge): integrate with web gateway via AppEvent + v1 conversation DB
Three changes to make engine v2 visible in the web gateway:
1. SSE event streaming (AppEvent broadcast):
- ThreadEvent → AppEvent conversion via thread_event_to_app_event()
- Events broadcast to SseManager during the poll loop
- Covers: Thinking, ToolCompleted (success/error), Status, Response
- Web gateway receives real-time progress without any gateway changes
2. Conversation persistence to v1 database:
- After thread completes, writes user message + agent response to
v1 ConversationStore via add_conversation_message()
- Uses get_or_create_assistant_conversation() for per-user per-channel
- Web gateway reads from DB as usual — chat history appears
3. Final response broadcast:
- AppEvent::Response with full text + thread_id sent via SSE
- Web gateway renders the response in the chat UI
New EngineState fields: sse (Option<Arc<SseManager>>),
db (Option<Arc<dyn Database>>). Both populated from Agent.deps.
Agent.deps visibility widened to pub(crate).
Depends on: ironclaw_common crate with AppEvent type (PR #1615).
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
This commit is contained in:
@@ -177,7 +177,7 @@ pub struct AgentDeps {
|
||||
/// The main agent that coordinates all components.
|
||||
pub struct Agent {
|
||||
pub(super) config: AgentConfig,
|
||||
pub(super) deps: AgentDeps,
|
||||
pub(crate) deps: AgentDeps,
|
||||
pub(crate) channels: Arc<ChannelManager>,
|
||||
pub(super) context_manager: Arc<ContextManager>,
|
||||
pub(super) scheduler: Arc<Scheduler>,
|
||||
|
||||
Reference in New Issue
Block a user