Files
sideline/presets.toml
David Gwilliam e0bbfea26c refactor: consolidate pipeline architecture with unified data source system
MAJOR REFACTORING: Consolidate duplicated pipeline code and standardize on
capability-based dependency resolution. This is a significant but backwards-compatible
restructuring that improves maintainability and extensibility.

## ARCHITECTURE CHANGES

### Data Sources Consolidation
- Move engine/sources_v2.py → engine/data_sources/sources.py
- Move engine/pipeline_sources/ → engine/data_sources/
- Create unified DataSource ABC with common interface:
  * fetch() - idempotent data retrieval
  * get_items() - cached access with automatic refresh
  * refresh() - force cache invalidation
  * is_dynamic - indicate streaming vs static sources
- Support for SourceItem dataclass (content, source, timestamp, metadata)

### Display Backend Improvements
- Update all 7 display backends to use new import paths
- Terminal: Improve dimension detection and handling
- WebSocket: Better error handling and client lifecycle
- Sixel: Refactor graphics rendering
- Pygame: Modernize event handling
- Kitty: Add protocol support for inline images
- Multi: Ensure proper forwarding to all backends
- Null: Maintain testing backend functionality

### Pipeline Adapter Consolidation
- Refactor adapter stages for clarity and flexibility
- RenderStage now handles both item-based and buffer-based rendering
- Add SourceItemsToBufferStage for converting data source items
- Improve DataSourceStage to work with all source types
- Add DisplayStage wrapper for display backends

### Camera & Viewport Refinements
- Update Camera class for new architecture
- Improve viewport dimension detection
- Better handling of resize events across backends

### New Effect Plugins
- border.py: Frame rendering effect with configurable style
- crop.py: Viewport clipping effect for selective display
- tint.py: Color filtering effect for atmosphere

### Tests & Quality
- Add test_border_effect.py with comprehensive border tests
- Add test_crop_effect.py with viewport clipping tests
- Add test_tint_effect.py with color filtering tests
- Update test_pipeline.py for new architecture
- Update test_pipeline_introspection.py for new data source location
- All 463 tests pass with 56% coverage
- Linting: All checks pass with ruff

### Removals (Code Cleanup)
- Delete engine/benchmark.py (deprecated performance testing)
- Delete engine/pipeline_sources/__init__.py (moved to data_sources)
- Delete engine/sources_v2.py (replaced by data_sources/sources.py)
- Update AGENTS.md to reflect new structure

### Import Path Updates
- Update engine/pipeline/controller.py::create_default_pipeline()
  * Old: from engine.sources_v2 import HeadlinesDataSource
  * New: from engine.data_sources.sources import HeadlinesDataSource
- All display backends import from new locations
- All tests import from new locations

## BACKWARDS COMPATIBILITY

This refactoring is intended to be backwards compatible:
- Pipeline execution unchanged (DAG-based with capability matching)
- Effect plugins unchanged (EffectPlugin interface same)
- Display protocol unchanged (Display duck-typing works as before)
- Config system unchanged (presets.toml format same)

## TESTING

- 463 tests pass (0 failures, 19 skipped)
- Full linting check passes
- Manual testing on demo, poetry, websocket modes
- All new effect plugins tested

## FILES CHANGED

- 24 files modified/added/deleted
- 723 insertions, 1,461 deletions (net -738 LOC - cleanup!)
- No breaking changes to public APIs
- All transitive imports updated correctly
2026-03-16 19:47:12 -07:00

118 lines
2.4 KiB
TOML

# Mainline Presets Configuration
# Human- and machine-readable preset definitions
#
# Format: TOML
# Usage: mainline --preset <name>
#
# Built-in presets can be overridden by user presets in:
# - ~/.config/mainline/presets.toml
# - ./presets.toml (local override)
[presets.demo]
description = "Demo mode with effect cycling and camera modes"
source = "headlines"
display = "pygame"
camera = "vertical"
effects = ["noise", "fade", "glitch", "firehose"]
viewport_width = 80
viewport_height = 24
camera_speed = 1.0
firehose_enabled = true
[presets.poetry]
description = "Poetry feed with subtle effects"
source = "poetry"
display = "pygame"
camera = "vertical"
effects = ["fade"]
viewport_width = 80
viewport_height = 24
camera_speed = 0.5
[presets.border-test]
description = "Test border rendering with empty buffer"
source = "empty"
display = "terminal"
camera = "vertical"
effects = []
viewport_width = 80
viewport_height = 24
camera_speed = 1.0
firehose_enabled = false
border = true
[presets.websocket]
description = "WebSocket display mode"
source = "headlines"
display = "websocket"
camera = "vertical"
effects = ["noise", "fade", "glitch"]
viewport_width = 80
viewport_height = 24
camera_speed = 1.0
firehose_enabled = false
[presets.sixel]
description = "Sixel graphics display mode"
source = "headlines"
display = "sixel"
camera = "vertical"
effects = ["noise", "fade", "glitch"]
viewport_width = 80
viewport_height = 24
camera_speed = 1.0
firehose_enabled = false
[presets.firehose]
description = "High-speed firehose mode"
source = "headlines"
display = "pygame"
camera = "vertical"
effects = ["noise", "fade", "glitch", "firehose"]
viewport_width = 80
viewport_height = 24
camera_speed = 2.0
firehose_enabled = true
[presets.pipeline-inspect]
description = "Live pipeline introspection with DAG and performance metrics"
source = "pipeline-inspect"
display = "pygame"
camera = "vertical"
effects = ["crop"]
viewport_width = 100
viewport_height = 35
camera_speed = 0.3
firehose_enabled = false
# Sensor configuration (for future use with param bindings)
[sensors.mic]
enabled = false
threshold_db = 50.0
[sensors.oscillator]
enabled = false
waveform = "sine"
frequency = 1.0
# Effect configurations
[effect_configs.noise]
enabled = true
intensity = 1.0
[effect_configs.fade]
enabled = true
intensity = 1.0
[effect_configs.glitch]
enabled = true
intensity = 0.5
[effect_configs.firehose]
enabled = true
intensity = 1.0
[effect_configs.hud]
enabled = true
intensity = 1.0