start method

Future<List<AgentResult>> start()

Implementation

Future<List<AgentResult>> start() async {
  final scheme = _protocolScheme;
  if (_publishSurfaceLink && scheme != null && scheme.isNotEmpty) {
    _closeSurfaceLink = await publishIntentCallSurfaceLink(
      bridge: bridge,
      protocolScheme: scheme,
      linkDirectory: _linkDirectory,
    );
  }
  registerIntentCallAwaitingHandler(bridge);
  if (registerWebMcp) {
    projectRegistryToWebMcp(
      bridge.registry,
      policy: bridge.policy,
      surfaceIndex: webMcpSurfaceIndex,
    );
  }
  await _deepLinkListener?.start();
  _wakeSubscription ??= _wakeSignals?.listen((final trigger) {
    unawaited(requestDrain(trigger).catchError((_) => <AgentResult>[]));
  });
  if (!drainOnStart) {
    return const <AgentResult>[];
  }
  return requestDrain(IntentCallDrainTrigger.start);
}