Skip to content

Split main_controller.dart into per-feature bridge/service files #76

Description

@neooriginal

This issue is AI generated.

Problem

flutter_app/lib/main_controller.dart is approximately 7000+ lines and contains nearly all app state, all Socket.IO event handlers, all backend API call wrappers, and significant business logic. GUIDELINES.md states:

"flutter_app/lib/main_controller.dart is the single root ChangeNotifier. Do not introduce competing global state objects."
"Feature logic goes in lib/src/<feature>_bridge.dart or lib/src/<feature>_service.dart. Widgets are thin — no business logic in widget files."

The controller violates the second principle entirely. The consequence: every feature change requires reading the entire file, merge conflicts are frequent, and the controller cannot be unit tested in isolation.

Required change

Extract feature domains into dedicated bridge/service classes following the established _io / _web / _stub pattern:

  • lib/src/agent_run_bridge.dart — run submission, steerable run state, tool events
  • lib/src/approval_bridge.dart — pending approval queue, approval resolution
  • lib/src/voice_bridge.dart — live voice session management
  • lib/src/recording_bridge_service.dart — recording session lifecycle (expand existing stub)
  • lib/src/memory_bridge.dart — memory read/write, retrieval inspector data

NeoAgentController becomes a thin coordinator that instantiates and delegates to these bridges and exposes their state to the widget tree.

Acceptance criteria

  • main_controller.dart is under 800 lines after extraction.
  • Each bridge/service file is independently testable.
  • All existing Flutter tests pass.
  • No new global state objects are introduced; bridges are owned by the controller.

Metadata

Metadata

Assignees

No one assigned

    Labels

    autonomousGenerated by AIenhancementNew feature or requestpriority: lowNice to have — refactoring, minor UX, or future featuresreliabilityReliability, resilience, or concurrency concern

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions