MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / dispatch

Method dispatch

atomic-agent/src/turn/orchestrator/mod.rs:289–297  ·  view source on GitHub ↗

Dispatch a turn event through the orchestrator. This is the main entry point called by the CLI hook handler. It: 1. Routes the event to the appropriate handler based on `event_type` 2. Loads or creates the session state 3. Runs the state machine transition 4. Executes any actions (begin/end turn, record change) 5. Saves the updated session state 6. Returns a `DispatchResult` with any data to send

(&mut self, event: TurnEvent)

Source from the content-addressed store, hash-verified

287 /// Most errors are non-fatal — the orchestrator logs warnings and
288 /// continues. Fatal errors (session store IO failure, etc.) are propagated.
289 pub async fn dispatch(&mut self, event: TurnEvent) -> AgentResult<DispatchResult> {
290 match event.event_type {
291 HookType::SessionStart => self.handle_session_start(event).await,
292 HookType::TurnStart => self.handle_turn_start(event).await,
293 HookType::TurnEnd => self.handle_turn_end(event).await,
294 HookType::SessionEnd => self.handle_session_end(event).await,
295 HookType::PreToolUse | HookType::PostToolUse => self.handle_tool_use(event).await,
296 }
297 }
298}
299
300// ═══════════════════════════════════════════════════════════════════════

Calls 5

handle_session_startMethod · 0.80
handle_turn_startMethod · 0.80
handle_turn_endMethod · 0.80
handle_session_endMethod · 0.80
handle_tool_useMethod · 0.80