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

Function transition_from_active

atomic-agent/src/turn/phase.rs:494–525  ·  view source on GitHub ↗
(event: Event)

Source from the content-addressed store, hash-verified

492}
493
494fn transition_from_active(event: Event) -> TransitionResult {
495 match event {
496 // Turn start while active → Ctrl-C recovery, continue
497 // The previous turn was interrupted — just continue with the new one.
498 // Any pending changes from the interrupted turn will be captured
499 // when this new turn ends.
500 Event::TurnStart => {
501 TransitionResult::with_actions(Phase::Active, vec![Action::UpdateInteraction])
502 }
503
504 // Turn ended → go idle, record the turn
505 Event::TurnEnd => TransitionResult::with_actions(
506 Phase::Idle,
507 vec![Action::RecordTurn, Action::UpdateInteraction],
508 ),
509
510 // A record happened mid-turn → note it, defer turn recording to TurnEnd
511 Event::Recorded => {
512 TransitionResult::with_actions(Phase::ActiveRecorded, vec![Action::UpdateInteraction])
513 }
514
515 // Another session started while this one is active → warn
516 Event::SessionStart => {
517 TransitionResult::with_actions(Phase::Active, vec![Action::WarnStaleSession])
518 }
519
520 // Session stopped while active → end
521 Event::SessionStop => {
522 TransitionResult::with_actions(Phase::Ended, vec![Action::UpdateInteraction])
523 }
524 }
525}
526
527fn transition_from_active_recorded(event: Event) -> TransitionResult {
528 match event {

Callers 1

transitionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected