Skip to content

Total architecture

This page is the single map of the whole omega_architecture stack: how runtime, channel, flows, agents, navigation, Flutter widgets, and tooling fit together. Use it before diving into the focused guides linked in each section.

For a narrative “why” and product fit, start with Vision & why Omega. For step-by-step setup, see Getting started and omega_setup.dart.


What Omega optimizes for

  • One communication planeOmegaChannel broadcasts OmegaEvents; the UI and domain code do not call each other directly.
  • Intent-first UI — Screens emit OmegaIntents; OmegaFlowManager routes them to running OmegaFlows.
  • Agents for side effectsOmegaAgent + OmegaAgentBehaviorEngine centralize IO, storage, and imperative work; widgets stay thin.
  • Observable orchestration — Flows emit expressions (streams) for UI state and can trigger navigation through the same channel conventions the navigator listens for.

More narrative walkthroughs: Getting started, Channel & events, and the example app on GitHub.


Layers at a glance

mermaid
flowchart TB
  subgraph presentation["Presentation (Flutter)"]
    Scope[OmegaScope]
    Pages[Pages / OmegaRoute builders]
    Builders[OmegaBuilder / expression listeners]
    Insp[OmegaInspector / receiver]
  end

  subgraph orchestration["Orchestration"]
    FM[OmegaFlowManager]
    Flows[OmegaFlow instances]
  end

  subgraph domain["Domain & IO"]
    Agents[OmegaAgent + behavior rules]
    Proto[OmegaAgentProtocol]
  end

  subgraph plane["Communication plane"]
    Ch[OmegaChannel]
    NS[OmegaChannel.namespace]
  end

  subgraph nav["Navigation"]
    Nav[OmegaNavigator]
    Routes[OmegaRoute registry]
  end

  Pages --> Scope
  Builders --> Ch
  Flows --> FM
  FM --> Flows
  Agents --> Ch
  Flows --> Ch
  FM --> Nav
  Nav --> Routes
  Proto --> Agents
  Insp --> Scope
  Scope --> Ch
  Scope --> FM
LayerResponsibilityTypical types
Communication planeBroadcast events; optional per-module namespacesOmegaChannel, OmegaEvent, typed names via OmegaEventName / OmegaIntentName
OrchestrationWhich flow is active; handle intents; translate channel traffic into expressions and navigation signalsOmegaFlowManager, OmegaFlow, OmegaFlowContext, OmegaFlowExpression
Domain & IOReactions to events (HTTP, DB, device); optional direct agent messagingOmegaAgent, OmegaAgentBehaviorEngine, OmegaAgentProtocol
NavigationMap navigate.* / navigation.intent to Flutter routesOmegaNavigator, OmegaRoute
PresentationInject dependencies; rebuild on events/expressions; debug surfacesOmegaScope, builders, inspector

Bootstrap: from main to a live app

OmegaRuntime.bootstrap is the single factory that wires everything:

  1. Creates one OmegaChannel.
  2. Calls your OmegaConfig Function(OmegaChannel) (usually createOmegaConfig in omega_setup.dart).
  3. Builds OmegaFlowManager, OmegaAgentProtocol, and OmegaNavigator.
  4. Registers agents, flows, and routes from OmegaConfig.
  5. Calls wireNavigator so navigation events on the channel reach the navigator.
  6. Runs optional intentHandlerRegistrars (e.g. OmegaFlowManager.registerIntentHandler, lightweight pipelines).
mermaid
sequenceDiagram
  participant Main as main()
  participant RT as OmegaRuntime
  participant CH as OmegaChannel
  participant CFG as OmegaConfig
  participant FM as OmegaFlowManager
  participant NAV as OmegaNavigator

  Main->>RT: bootstrap(createOmegaConfig)
  RT->>CH: OmegaChannel()
  RT->>CFG: createOmegaConfig(channel)
  RT->>FM: register flows, wireNavigator(NAV)
  RT->>RT: register agents, routes, intentHandlerRegistrars
  RT-->>Main: OmegaRuntime(channel, flowManager, ...)
  Main->>Main: OmegaScope + MaterialApp(navigatorKey)

Cold start is explicit: initialFlowId selects which flow is running; initialNavigationIntent (with OmegaInitialRoute / OmegaScope.initialNavigationIntent) aligns the first Navigator screen with navigate.* semantics. Details: omega_setup.dart, Navigation & routes.


Channel, namespaces, events, and intents

  • Events — “Something happened” (OmegaEvent: id, name, payload). Consumers use payloadAs<T>() / typedPayloadAs<T>() (extensions on OmegaEvent; typedPayloadAs for OmegaTypedEvent payloads).
  • Intents — “Something is requested” (OmegaIntent). The flow manager delivers intents to flows in running state via handleIntent or handleTypedIntent (OmegaTypedIntent); use payloadAs / typedPayloadAs on OmegaIntent in onIntent. Navigation uses the same intent model with names like navigate.login or navigate.push.detail.
  • NamespacesOmegaChannel.namespace scopes traffic by module (auth, checkout, …) while sharing one physical channel.
  • Typed wire names — Prefer enums implementing OmegaEventName / OmegaIntentName with OmegaEvent.fromName / OmegaIntent.fromName (static methods; optional <T> on payload) instead of raw strings.

More detail: Channel & events, Data flow.


Flows and flow manager

PieceRole
OmegaFlowBusiness process: onIntent, onEvent, emits expressions for UI and events for agents / navigation
OmegaFlowManagerRegisters flows; activate / switchTo; handleIntent / handleTypedIntent to running flows
OmegaFlowStateOnly running flows receive intents and process events
OmegaFlowExpressionUI-facing stream of state (loading, success, error, …)
OmegaFlowContextContext passed into onIntent / onEvent
OmegaWorkflowFlowStep-based flows built on the same channel model

Optional OmegaFlowContract documents listened events, handled intents, and emitted expression kinds; in debug, mismatches are reported. See example/lib/auth/ (AuthFlow / AuthAgent) for contract usage.

SnapshotsOmegaFlowSnapshot / app-level snapshots support debugging, persistence, and time-travel tooling (OmegaSnapshotStorage, restoreFromSnapshot).

Focused guides: Intents, flows & manager, Data flow.


Agents and behaviors

PieceRole
OmegaAgentListens to the channel; delegates decisions to the behavior engine; runs onAction for imperative work
OmegaAgentBehaviorEngineEvaluates OmegaAgentBehaviorRules or custom logic → OmegaAgentReaction
OmegaAgentProtocolRegistry + direct / broadcast messaging between agents (OmegaAgentMessage, inbox) — not a replacement for the global channel

Optional OmegaAgentContract mirrors the flow contract idea for agents.

Focused guide: Agents & behaviors.


OmegaFlowManager.wireNavigator connects the channel to OmegaNavigator:

  • Payload OmegaIntent on navigation.intent, or
  • Event names navigate.<id> / navigate.push.<id> derived into intents.

OmegaRoute registers builders; OmegaRoute.typed avoids manual arguments casts.

Focused guide: Navigation & routes.


Flutter UI integration

Widget / APIUse when
OmegaScopeRoot: exposes channel, flow manager, optional initial flow / navigation intent
OmegaAgentScope / OmegaScopedAgentBuilderBind subtree to a specific agent and its view state
OmegaFlowActivatorActivate flows from UI where needed
OmegaFlowExpressionBuilderRebuild from a flow’s expression stream
OmegaBuilderRebuild on a named channel event
OmegaInitialRoute / OmegaInitialNavigationEmitterCold start navigation
OmegaInspector / OmegaInspectorReceiver / launcherDebug: events + flow snapshots (including multi-window web)

Lightweight intent handling (optional)

For small apps you can register OmegaFlowManager.registerIntentHandler or use Omega.handle / OmegaIntentReducer / OmegaIntentHandlerPipeline without a dedicated flow class — often wired through OmegaConfig.intentHandlerRegistrars after bootstrap.


Cross-cutting concerns

TopicWhere it lives
FailuresOmegaFailure for semantic errors on the channel or return paths
Contracts (debug)OmegaFlowContract, OmegaAgentContract — guide: Contracts
Time travelOmegaTimeTravelRecorder, OmegaRecordedSessionTime travel, omega trace (CLI)
Offline-first intentsOmegaOfflineQueueOffline-first
Package barrelomega_architecture.dart — canonical exports

Repository and tooling (outside lib/omega)

AreaRole
example/Runnable reference: omega_setup.dart, auth flow/agent, routes
bin/omega.dartomega CLI: create app, ecosystem generation, validate, traces, optional AI helpers
docs/This VitePress site; public/inspector.html for VM Service inspector page

Guides: Repository layout, Omega CLI, Inspector & VM Service, Testing.


End-to-end intent → screen (summary)

mermaid
sequenceDiagram
  participant UI as Widget
  participant FM as OmegaFlowManager
  participant F as OmegaFlow
  participant CH as OmegaChannel
  participant A as OmegaAgent
  participant NAV as OmegaNavigator

  UI->>FM: handleIntent / handleTypedIntent(login)
  FM->>F: onIntent (running flows)
  F->>CH: emit auth.login.request
  CH->>A: event stream
  A->>CH: emit auth.login.success
  CH->>F: onEvent
  F->>CH: emitExpression(success) / navigate.home
  CH->>NAV: navigation event
  NAV-->>UI: new route

Suggested reading order

  1. Vision & why OmegaGetting started
  2. This page (total map) → Core conceptsData flow
  3. omega_setup.dartChannel & eventsIntents, flows & managerAgents & behaviorsNavigation & routes
  4. API reference on pub.dev for signatures
  5. Example app while reading example/lib/ on GitHub