launch method

Future<String> launch({
  1. required String blurb,
  2. String? seedPlan,
  3. bool disconnectedBridge = false,
})

Launch ultraplan.

Shared entry for the slash command, keyword trigger, and the plan-approval dialog's "Ultraplan" button.

Resolves immediately with the user-facing message. Eligibility check, session creation, and task registration run detached and failures surface via notifications.

Implementation

Future<String> launch({
  required String blurb,
  String? seedPlan,
  bool disconnectedBridge = false,
}) async {
  // Check for already active session.
  if (sessionUrl.value != null || isLaunching.value) {
    return buildAlreadyActiveMessage(sessionUrl.value);
  }

  // Bare /ultraplan (no args, no seed plan) just shows usage.
  if (blurb.isEmpty && seedPlan == null) {
    return [
      'Usage: /ultraplan <prompt>, or include "ultraplan" anywhere',
      'in your prompt',
      '',
      'Advanced multi-agent plan mode with our most powerful model',
      '(Opus). Runs in Neomage on the web. When the plan is ready,',
      'you can execute it in the web session or send it back here.',
      'Terminal stays free while the remote plans.',
      'Requires /login.',
      '',
      'Terms: $ccrTermsUrl',
    ].join('\n');
  }

  // Set launching flag to prevent duplicate launches.
  isLaunching.value = true;

  // Launch detached — don't await the full flow.
  _launchDetached(blurb: blurb, seedPlan: seedPlan);

  return buildLaunchMessage(disconnectedBridge: disconnectedBridge);
}