Skip to content

Interface: LocalDaemonBuilder ​

Defined in: node/src/builders/local-daemon-builder.ts:64

Fluent builder for a lifecycle-bound background daemon service (local.daemon(id)).

Configures dynamic TCP port allocation, pre-start cleanup and shutdown commands, combined stdout/stderr readiness regexes, and framed pseudo-terminal (PTY) interaction tools.

Extends ​

Methods ​

interact() ​

ts
interact<TInput>(toolName, options): LocalDaemonBuilder;

Defined in: node/src/builders/local-daemon-builder.ts:147

Registers a framed PTY interaction tool exposed while the daemon service is active.

Populates LocalServiceNode.toolSchemas up front so wire tool definitions remain static across skill activation and deactivation.

Type Parameters ​

Type ParameterDefault typeDescription
TInputobjectValidated tool input payload type.

Parameters ​

ParameterTypeDescription
toolNamestringUnique tool name exposed to the agent.
optionsLocalDaemonInteractOptions<TInput>Interactive PTY command and framing configuration.

Returns ​

LocalDaemonBuilder

Updated immutable daemon builder.


lifecycle() ​

ts
lifecycle(mode): LocalDaemonBuilder;

Defined in: node/src/builders/local-daemon-builder.ts:88

Sets the lifecycle scope ('scope' | 'fork' | 'skill') governing daemon startup and teardown.

Controls when the runtime automatically starts, quiesces, and stops the daemon process.

Parameters ​

ParameterTypeDescription
mode"scope" | "fork" | "skill"Service lifecycle binding mode.

Returns ​

LocalDaemonBuilder

Updated immutable daemon builder.


port() ​

ts
port(name): LocalDaemonBuilder;

Defined in: node/src/builders/local-daemon-builder.ts:99

Declares a named dynamic TCP port to allocate conflict-free before starting the daemon.

Verifies TCP listener readiness on the allocated port before resolving service acquisition.

Parameters ​

ParameterTypeDescription
namestringLogical port key exposed on ctx.ports[name].

Returns ​

LocalDaemonBuilder

Updated immutable daemon builder.


readyWhenStdout() ​

ts
readyWhenStdout(pattern): LocalDaemonBuilder;

Defined in: node/src/builders/local-daemon-builder.ts:132

Configures a readiness regular expression evaluated over combined stdout and stderr during startup.

Blocks service session resolution until the rolling output buffer matches pattern and all TCP ports listen.

Parameters ​

ParameterTypeDescription
patternstring | RegExpRegular expression or pattern string indicating daemon readiness.

Returns ​

LocalDaemonBuilder

Updated immutable daemon builder.


runner() ​

ts
runner(runner): LocalDaemonBuilder;

Defined in: node/src/builders/local-daemon-builder.ts:77

Binds the NodeRunnerNode pool governing maxDaemons concurrency slots for this service.

Acquires a daemon slot via RunnerDriver.withDaemonSlot for the duration of the active ServiceSession.

Parameters ​

ParameterTypeDescription
runnerMaybeBuilder<NodeRunnerNode>Runner pool AST node or builder.

Returns ​

LocalDaemonBuilder

Updated immutable daemon builder.


start() ​

ts
start(startFn): LocalDaemonBuilder;

Defined in: node/src/builders/local-daemon-builder.ts:110

Binds the pure factory function producing the startup command argv for the daemon.

Receives allocated ports, the hash-suffixed scopeKey, and optional worktreePath.

Parameters ​

ParameterTypeDescription
startFn(ctx) => readonly string[]Startup argv factory.

Returns ​

LocalDaemonBuilder

Updated immutable daemon builder.


stopCommand() ​

ts
stopCommand(stopFn): LocalDaemonBuilder;

Defined in: node/src/builders/local-daemon-builder.ts:121

Binds an optional cleanup/stop command factory executed best-effort before .start() and during .stop().

Reaps crash-orphaned containers or external processes bound to the same scopeKey.

Parameters ​

ParameterTypeDescription
stopFn(ctx) => readonly string[]Cleanup argv factory.

Returns ​

LocalDaemonBuilder

Updated immutable daemon builder.


toAST() ​

ts
toAST(): LocalServiceNode;

Defined in: core/dist/ast/ast-builder.d.ts:19

Compiles the current builder configuration into a deeply frozen passive AST node.

Validates required builder invariants at compilation time and returns an immutable plain-object AST representation containing zero execution methods.

Returns ​

LocalServiceNode

Deeply frozen passive AST node.

Inherited from ​

AstBuilder.toAST

Properties ​

PropertyModifierTypeDescriptionDefined in
idreadonlystringUnique identifier of the daemon service.node/src/builders/local-daemon-builder.ts:66

Released under the MIT License.