Skip to content

Interface: ForkCapabilityBuilder<TParentIn, TReq, TChildIn, TChildOut, THandle> ​

Defined in: builders/fork-capability-builder.ts:18

Fluent sub-builder for a downward child fork capability ($cap.fork(toolName, childExecutable, $f => ...)).

Configures transcript sharing (historyMode), request validation (requestSchema), child input projection (mapInput), and conditional model routing (modelRouting).

Extends ​

Type Parameters ​

Type ParameterDefault typeDescription
TParentInunknownParent actor input payload type.
TRequnknownValidated fork tool request payload type.
TChildInunknownChild executable input payload type.
TChildOutunknownChild executable output payload type.
THandleunknownRuntime handle type of the active BranchableScope.

Methods ​

historyMode() ​

ts
historyMode(mode): ForkCapabilityBuilder<TParentIn, TReq, TChildIn, TChildOut, THandle>;

Defined in: builders/fork-capability-builder.ts:34

Configures the transcript history sharing mode ('shared-prefix-only' or 'clone-transcript').

Defaults to 'shared-prefix-only'; 'clone-transcript' requires toolsMode: 'union' when toolsets differ.

Parameters ​

ParameterTypeDescription
mode"shared-prefix-only" | "clone-transcript"Transcript sharing mode.

Returns ​

ForkCapabilityBuilder<TParentIn, TReq, TChildIn, TChildOut, THandle>

New immutable fork builder.


mapInput() ​

ts
mapInput(mapper): ForkCapabilityBuilder<TParentIn, TReq, TChildIn, TChildOut, THandle>;

Defined in: builders/fork-capability-builder.ts:62

Binds the synchronous mapper projecting (parentInput, req) into the child executable's input TChildIn.

Invoked before branching the isolation scope and starting the child executable.

Parameters ​

ParameterTypeDescription
mapper(parentInput, req) => TChildInChild input projection callback.

Returns ​

ForkCapabilityBuilder<TParentIn, TReq, TChildIn, TChildOut, THandle>

New immutable fork builder.


modelRouting() ​

ts
modelRouting(configure): ForkCapabilityBuilder<TParentIn, TReq, TChildIn, TChildOut, THandle>;

Defined in: builders/fork-capability-builder.ts:75

Configures conditional model routing for the forked child session.

Invokes configure with a ForkModelRoutingBuilder and attaches the resulting routing config.

Parameters ​

ParameterTypeDescription
configure($m) => ForkModelRoutingBuilder<TParentIn, TReq>Model routing configurator callback.

Returns ​

ForkCapabilityBuilder<TParentIn, TReq, TChildIn, TChildOut, THandle>

New immutable fork builder.


requestSchema() ​

ts
requestSchema<TNewReq>(schema): ForkCapabilityBuilder<TParentIn, TNewReq, TChildIn, TChildOut, THandle>;

Defined in: builders/fork-capability-builder.ts:49

Binds the Zod validation schema for the parent agent's fork tool call arguments.

Resets any previously bound mapInput or modelRouting callbacks when the request type changes.

Type Parameters ​

Type ParameterDescription
TNewReqValidated fork request payload type.

Parameters ​

ParameterTypeDescription
schemaZodType<TNewReq>Zod schema for the fork request.

Returns ​

ForkCapabilityBuilder<TParentIn, TNewReq, TChildIn, TChildOut, THandle>

New immutable fork builder.


toAST() ​

ts
toAST(): ForkCapabilityNode;

Defined in: ast/ast-builder.ts:20

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 ​

ForkCapabilityNode

Deeply frozen passive AST node.

Inherited from ​

AstBuilder.toAST

Released under the MIT License.