OmegaRuntime.bootstrap constructor

OmegaRuntime.bootstrap(
  1. OmegaConfig createConfig(
    1. OmegaChannel
    )
)

Creates channel, config (with your createConfig), flowManager, protocol, navigator; registers agents, flows and routes; connects navigator to the channel.

Example: OmegaRuntime.bootstrap((channel) => OmegaConfig(channel: channel, agents: [AuthAgent(...)], flows: [AuthFlow(channel)], routes: [...], initialFlowId: "authFlow"));

Implementation

factory OmegaRuntime.bootstrap(
  OmegaConfig Function(OmegaChannel) createConfig,
) {
  final channel = OmegaChannel();
  final config = createConfig(channel);
  final flowManager = OmegaFlowManager(channel: channel);
  final protocol = OmegaAgentProtocol(channel);
  final navigator = OmegaNavigator();

  // Agents
  for (final agent in config.agents) {
    protocol.register(agent);
  }

  // Flows
  for (final flow in config.flows) {
    flowManager.registerFlow(flow);
  }

  // Routes
  for (final route in config.routes) {
    navigator.registerRoute(route);
  }

  flowManager.wireNavigator(navigator);

  return OmegaRuntime._(
    channel,
    flowManager,
    protocol,
    navigator,
    config.initialFlowId,
  );
}