Skip to content

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

A Launcher layer from its prepare function.

Signature

declare const layer: (prepare: Launcher["Service"]["prepare"]) => Layer.Layer<Launcher>

Source

Since v0.1.0

Signature

export interface Command {
readonly command: string
readonly args: ReadonlyArray<string>
}

Source

Since v0.1.0

Passed to Launcher.prepare for each agent process.

Signature

export interface LaunchContext {
readonly provider: string
readonly cwd: string
}

Source

Since v0.1.0

Must be pure: providers may apply it synchronously at spawn time.

Signature

type Wrap = (command: Command) => Command

Source

Since v0.1.0

Signature

declare class Launcher

Source

Since v0.1.0

The wrap to use: the provided Launcher’s, or none.

Signature

declare const prepare: (
context: LaunchContext,
) => Effect.Effect<Wrap, AgentError, Scope.Scope>

Source

Since v0.1.0

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>

Source

Since v0.2.0