Hyperlinkv0.9.0-beta.0

Launcher

One-shot bring-up: spawn → awaitReady → handoff per unit, then the launcher may exit. Accepts one SpawnSpec or a readonly array (not Group). Units run sequentially (Effect.forEach concurrency 1) so custody stays ordered.

constructorsSpawnSpecGroup
export const up = (
  spec: SpawnSpec | ReadonlyArray<SpawnSpec>,
): Effect.Effect<
  void,
  | ReadyTimedOut
  | ChildExited
  | HandleSpent
  | HandleNotReady
  | AssumeTokenMismatch
  | AssumeTokenReused
  | AssumeNotReady
  | NodeUnreachable
  | ProtocolUnanswered
  | ServiceNotReady
  | ServiceNotServed
  | UnaddressedNode
  | PlatformError
  | ConfigError,
  ChildProcessSpawner.ChildProcessSpawner | Scope.Scope
> =>
  withLauncherPhase(
    "up",
    "up",
    Effect.gen(function* () {
      const units = isSpawnSpec(spec) ? [spec] : spec;
      yield* Effect.logInfo("Launcher.up starting").pipe(
        Effect.annotateLogs({ "launcher.units": String(units.length) }),
      );
      yield* Effect.forEach(
        units,
        (unit) =>
          spawn(unit).pipe(
            Effect.flatMap((handle) => handle.awaitReady()),
            Effect.flatMap((handle) => handle.handoff()),
          ),
        { concurrency: 1 },
      );
      yield* Effect.logInfo("Launcher.up complete");
    }),
  );