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

Function transition_from_ended

atomic-agent/src/turn/phase.rs:559–593  ·  view source on GitHub ↗
(event: Event, ctx: TransitionContext)

Source from the content-addressed store, hash-verified

557}
558
559fn transition_from_ended(event: Event, ctx: TransitionContext) -> TransitionResult {
560 match event {
561 // Turn start on ended session → re-enter
562 Event::TurnStart => TransitionResult::with_actions(
563 Phase::Active,
564 vec![Action::ClearEndedAt, Action::UpdateInteraction],
565 ),
566
567 // Turn end while ended → no-op
568 Event::TurnEnd => TransitionResult::noop(Phase::Ended),
569
570 // A record on ended session → depends on whether files changed
571 Event::Recorded => {
572 if ctx.has_files_changed {
573 TransitionResult::with_actions(
574 Phase::Ended,
575 vec![Action::RecordIfChanged, Action::UpdateInteraction],
576 )
577 } else {
578 TransitionResult::with_actions(
579 Phase::Ended,
580 vec![Action::DiscardIfNoFiles, Action::UpdateInteraction],
581 )
582 }
583 }
584
585 // Session starting on ended session → re-enter as idle
586 Event::SessionStart => {
587 TransitionResult::with_actions(Phase::Idle, vec![Action::ClearEndedAt])
588 }
589
590 // Session stop on ended session → no-op (already ended)
591 Event::SessionStop => TransitionResult::noop(Phase::Ended),
592 }
593}
594
595// Apply Common Actions
596

Callers 1

transitionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected