Line

packages/engine/botRunner

the bot runner: the executeStep #287's engine is waiting for.

Engine, v0.9. Source: packages/engine/botRunner.mjs.

Functions#

botBranch()#

botBranch(processId): string

Defined in: packages/engine/botRunner.mjs:63

The git branch a process's bot works on.

Parameters#

processId

string

Process id (characters outside A-Za-z0-9._- become _).

Returns#

string

construct/bot/<processId>.

Example#

botBranch('p-12'); // => 'construct/bot/p-12'

createBotRunner()#

createBotRunner(options?): object

Defined in: packages/engine/botRunner.mjs:102

Create the runner that gives each process its own detached git worktree and spawns a construct bot inside it, bounded by a concurrency limit. Worktrees whose owning pid is dead are reclaimed.

Parameters#

options?
bin?

string = BIN

The construct entry point to spawn.

env?

Record<string, string> = process.env

Environment for spawned bots.

maxConcurrent?

number

Concurrent bots; see resolveMaxConcurrent(). Hand runner.maxConcurrent to the engine.

nodeArgs?

string[] = []

Extra node arguments.

stateDir?

string = ...

Where worktrees live (<stateDir>/worktrees).

Returns#

object

The runner.

executeStep

executeStep: Function

maxConcurrent

maxConcurrent: number

reclaimDead

reclaimDead: Function

release

release: Function

worktreeOf

worktreeOf: (processId) => string

Parameters
processId

string

Returns

string

worktreeRoot

worktreeRoot: string


resolveMaxConcurrent()#

resolveMaxConcurrent(explicit, env?): number

Defined in: packages/engine/botRunner.mjs:48

Configured concurrency: an explicit option, else CONSTRUCT_BOT_CONCURRENCY, else 1 (this box is 15 GB with no swap). Never below 1.

Parameters#

explicit

any

env?

any = process.env

Returns#

number