This PR completes the MVC-inspired refactoring by moving the event system from the engine into the reducer.
The engine package is now removed entirely, as the reducer handles both reduction logic and lifecycle events.
Add pkg/reducer/events.go with StartEvent, StepEvent, and StopEvent.
Extend Reducer interface to embed Emitter[Event] and add Expression() method.
Update NormalOrderReducer to embed BaseEmitter and emit lifecycle events during reduction.
Update all plugins to attach to Reducer instead of Engine.
Remove internal/engine package entirely.
Add Off() method to BaseEmitter to complete the Emitter interface.
Fix Emitter.On signature to use generic type E instead of string.
Decisions
The Reducer interface now combines reduction logic with event emission, making it the single orchestration point.
Plugins attach directly to the reducer, simplifying the architecture.
The Expression() method on Reducer provides access to current state for plugins.
Benefits
Simpler architecture with one fewer abstraction layer.
Plugins are now mode-agnostic - they work with any Reducer implementation.
Cleaner separation: reducers handle reduction, plugins observe via events.
Easier to add new evaluation modes - just implement Reducer with embedded emitter.
## Description
This PR completes the MVC-inspired refactoring by moving the event system from the engine into the reducer.
The engine package is now removed entirely, as the reducer handles both reduction logic and lifecycle events.
- Add `pkg/reducer/events.go` with `StartEvent`, `StepEvent`, and `StopEvent`.
- Extend `Reducer` interface to embed `Emitter[Event]` and add `Expression()` method.
- Update `NormalOrderReducer` to embed `BaseEmitter` and emit lifecycle events during reduction.
- Update all plugins to attach to `Reducer` instead of `Engine`.
- Remove `internal/engine` package entirely.
- Add `Off()` method to `BaseEmitter` to complete the `Emitter` interface.
- Fix `Emitter.On` signature to use generic type `E` instead of `string`.
### Decisions
- The `Reducer` interface now combines reduction logic with event emission, making it the single orchestration point.
- Plugins attach directly to the reducer, simplifying the architecture.
- The `Expression()` method on `Reducer` provides access to current state for plugins.
## Benefits
- Simpler architecture with one fewer abstraction layer.
- Plugins are now mode-agnostic - they work with any `Reducer` implementation.
- Cleaner separation: reducers handle reduction, plugins observe via events.
- Easier to add new evaluation modes - just implement `Reducer` with embedded emitter.
## Checklist
- [x] Code follows conventional commit format.
- [x] Branch follows naming convention (`<type>/<description>`).
- [x] Tests pass (if applicable).
- [ ] Documentation updated (if applicable).
Move the event emitter and lifecycle events from the engine into the reducer,
making the reducer the single point of orchestration for reduction.
This eliminates the engine package entirely.
- Add events.go to pkg/reducer with Start, Step, and Stop events.
- Extend Reducer interface to embed Emitter and add Expression() method.
- Update NormalOrderReducer to embed BaseEmitter and emit lifecycle events.
- Update all plugins to attach to Reducer instead of Engine.
- Remove internal/engine package.
- Add Off() method to BaseEmitter to complete Emitter interface.
- Fix Emitter.On signature to use generic type E instead of string.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Description
This PR completes the MVC-inspired refactoring by moving the event system from the engine into the reducer.
The engine package is now removed entirely, as the reducer handles both reduction logic and lifecycle events.
pkg/reducer/events.gowithStartEvent,StepEvent, andStopEvent.Reducerinterface to embedEmitter[Event]and addExpression()method.NormalOrderReducerto embedBaseEmitterand emit lifecycle events during reduction.Reducerinstead ofEngine.internal/enginepackage entirely.Off()method toBaseEmitterto complete theEmitterinterface.Emitter.Onsignature to use generic typeEinstead ofstring.Decisions
Reducerinterface now combines reduction logic with event emission, making it the single orchestration point.Expression()method onReducerprovides access to current state for plugins.Benefits
Reducerimplementation.Reducerwith embedded emitter.Checklist
<type>/<description>).