Skip to content

@usine/agents/child-host

Children run as processes on this machine.

  • Schema.Class

new LocalProcess(…args): LocalProcess

Parameter Type
…args [props?: object, options?: MakeOptions]

LocalProcess


Children run on another machine, each as one SSH command whose standard streams are the child’s.

  • Schema.Class

new RemoteShell(…args): RemoteShell

Parameter Type
…args [props: object, options?: MakeOptions]

RemoteShell

readonly destination: string

The SSH destination, passed to the client as one argument.

readonly ssh: object

readonly args: readonly string[]

readonly command: string

readonly sshEnvironment: object

The SSH client’s own process environment: what SSH needs to reach the machine, never the orchestrator’s secrets (ADR 0011), and the variables an -o SendEnv= option in ssh names. Only those reach the child, so a value that must stay out of the command line, such as a Gateway caller token, travels here; never log this field.

[key: string]: string

One command for a host to run.

readonly args: readonly string[]

readonly command: string

readonly optional cwd?: string

The directory the command starts in; the host user’s home directory when absent.

readonly optional environment?: Readonly<Record<string, string | undefined>>

The command’s complete environment on this machine. On a remote shell, the variables exported on top of the shell’s own environment; undefined values are skipped.

readonly optional pidFile?: string

On a remote shell, holds the command’s pid while it runs, so cleanup can stop it after its SSH client is gone.

ChildHost = typeof ChildHost.Type

Where an Attempt’s children run, chosen by the Worker that prepared its checkout.


SshCommand = typeof SshCommand.Type

The local SSH executable and the options placed before the destination.

const CHILD_KILL_SCRIPT: string

Stops every child an Attempt still runs on a remote host before its worktree is kept or removed: for each <worktree>.child-*.pid that childPidFile names, TERM, a bounded wait, then KILL. Run it with sh -c and the worktree as $1; stdout reports one outcome per pid file. An SSH client that exits does not prove its remote command has stopped.


const ChildHost: Schema.Union<readonly [typeof LocalProcess, typeof RemoteShell]>

Where an Attempt’s children run, chosen by the Worker that prepared its checkout.


const childPidFile: (worktree, session) => string

Where a remote child’s pid is kept while it runs: beside its worktree, named by the child’s number in its session id.

Parameter Type
worktree string
session AgentSessionId

string


const sshArguments: (host, invocation) => string[]

The SSH client’s arguments that run invocation on the host’s machine: its options, the destination, and one remote command line.

Parameter Type
host RemoteShell
invocation HostInvocation

string[]


const SshCommand: Schema.Struct<{ args: Schema.$Array<Schema.String>; command: Schema.NonEmptyString; }>

The local SSH executable and the options placed before the destination.