Launcher
Control over how agent processes start. Optional: without a Launcher,
commands run as-is. Provide one to wrap each agent process, e.g. in a
systemd scope (examples/SystemdLauncher.ts in the repository), so that
stopping the session also stops whatever its commands left running, under
resource limits.
When the session’s Scope closes, the agent process and everything it
started are stopped (see ProcessTree). A cgroup launcher is the stronger
guarantee: it also catches commands that cleared their environment, and
works on platforms without /proc.
Since v0.1.0
Layers
Section titled “Layers”A Launcher layer from its prepare function.
Signature
declare const layer: (prepare: Launcher["Service"]["prepare"]) => Layer.Layer<Launcher>Since v0.1.0
Models
Section titled “Models”Command (interface)
Section titled “Command (interface)”Signature
export interface Command { readonly command: string readonly args: ReadonlyArray<string>}Since v0.1.0
LaunchContext (interface)
Section titled “LaunchContext (interface)”Passed to Launcher.prepare for each agent process.
Signature
export interface LaunchContext { readonly provider: string readonly cwd: string}Since v0.1.0
Wrap (type alias)
Section titled “Wrap (type alias)”Must be pure: providers may apply it synchronously at spawn time.
Signature
type Wrap = (command: Command) => CommandSince v0.1.0
Services
Section titled “Services”Launcher (class)
Section titled “Launcher (class)”Signature
declare class LauncherSince v0.1.0
prepare
Section titled “prepare”The wrap to use: the provided Launcher’s, or none.
Signature
declare const prepare: ( context: LaunchContext,) => Effect.Effect<Wrap, AgentError, Scope.Scope>Since v0.1.0
prepareWithFallback
Section titled “prepareWithFallback”prepare for a layer that captured a Launcher when it was built: the
caller’s Launcher if it provides one, else the layer’s, else none.
Signature
declare const prepareWithFallback: ( fallback: Option.Option<Launcher["Service"]>,) => (context: LaunchContext) => Effect.Effect<Wrap, AgentError, Scope.Scope>Since v0.2.0