Skip to content

Conversation

@claytercek
Copy link
Member

@claytercek claytercek commented Oct 17, 2025

Phase 1: Central Controller Architecture

Phase 1 of #215

Summary

Introduces a central controller architecture that orchestrates subsystems (content and monitor) through commands and events, providing the foundation for future persistent mode operations.

🎯 What's Changed

New Controller Package (@bluecadet/launchpad-controller)

  • LaunchpadController - Central orchestrator class
  • EventBus - Type-safe event system with declaration merging
  • StateStore - Aggregates state from all subsystems
  • CommandDispatcher - Routes commands to appropriate subsystems

Enhanced Subsystem Integration

  • Added controller interfaces to @bluecadet/launchpad-utils
  • Updated content and monitor packages to implement optional interfaces
  • Introduced type-safe event definitions with declaration merging

CLI Integration

  • Updated launchpad content and launchpad monitor commands to use controller
  • Added task mode for ephemeral controller operations
  • Controller now required dependency (no fallback logic)

🔧 Key Features

Type-Safe Events

// Subsystems define their own events via declaration merging
declare module '@bluecadet/launchpad-controller' {
  interface LaunchpadEvents {
    'content:fetch:start': { timestamp: Date };
    'content:fetch:done': { sources: string[]; totalFiles: number };
  }
}

Duck-Typed Interfaces

interface Subsystem<TCommand, TState> = Partial<
  EventBusAware &
  CommandExecutor<TCommand> &
  StateProvider<TState> &
  Disconnectable
>;

Task Mode Architecture

  1. Create controller instance
  2. Register subsystem(s)
  3. Start controller
  4. Execute command(s)
  5. Stop controller

💥 Breaking Changes

None! This is a fully backward-compatible enhancement.

@changeset-bot
Copy link

changeset-bot bot commented Oct 17, 2025

🦋 Changeset detected

Latest commit: 02adddf

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@bluecadet/launchpad-controller Minor
@bluecadet/launchpad-cli Minor
@bluecadet/launchpad Patch
@bluecadet/launchpad-content Patch
@bluecadet/launchpad-monitor Patch
@bluecadet/launchpad-utils Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@claytercek
Copy link
Member Author

This doesn't include any documentation updates because there are no end-user API changes... that said it's probably worth documenting this architecture and the design decisions somewhere in the repo that isn't just code comments...

@claytercek claytercek mentioned this pull request Oct 17, 2025
17 tasks
@claytercek
Copy link
Member Author

Still need to actually emit events in content/monitor 🤦

I declared the event types, but didn't actually integrate them anywhere

@claytercek claytercek changed the title Launchpad Controller: Phase 1 Introduce Launchpad Controller Oct 17, 2025
@claytercek
Copy link
Member Author

Also worth noting: keeping the major version as 0, as the controller API could change significantly in the next 2 phases.

@claytercek claytercek merged commit 39f6b7d into develop Oct 17, 2025
7 checks passed
@claytercek claytercek deleted the feat/controller branch October 17, 2025 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants