Skip to content

Interface: PoolBuilder<TItem> ​

Defined in: builders/pool-builder.ts:17

Fluent builder for capacity and model pools (P.pool(id)).

Aggregates ordered candidate items (AccountSeatASTNode or ModelASTNode) with a selection strategy and optional fallback item.

Extends ​

Type Parameters ​

Type ParameterDefault typeDescription
TItem extends ASTNodeASTNodePool candidate AST node type.

Methods ​

fallback() ​

ts
fallback(item): PoolBuilder<TItem>;

Defined in: builders/pool-builder.ts:90

Configures a fallback item used when all primary candidates in the pool are rate-limited or exhausted.

Extracts the underlying AST node from item and stores it on PoolNode.fallbackItem.

Parameters ​

ParameterTypeDescription
itemMaybeBuilder<TItem>Fallback candidate AST node or builder.

Returns ​

PoolBuilder<TItem>

New immutable pool builder.


strategy() ​

Call Signature ​

ts
strategy(configure): PoolBuilder<TItem>;

Defined in: builders/pool-builder.ts:46

Configures the pool's selection strategy via a fluent PoolStrategyBuilder configurator callback.

Enables fluent configuration of .escalateOnRetry(options?) on $.

Parameters ​
ParameterTypeDescription
configure($) => MaybeBuilder<PoolStrategyNode<TItem>>Fluent strategy configurator callback.
Returns ​

PoolBuilder<TItem>

New immutable pool builder.

Call Signature ​

ts
strategy(selectFn): PoolBuilder<TItem>;

Defined in: builders/pool-builder.ts:60

Configures the pool's selection strategy via a custom synchronous candidate selector function.

Receives candidate states (readonly PoolCandidateState<TItem>[]) and PoolSelectionContext (containing attempt, runId, and stepExecId) to pick a candidate item.

Parameters ​
ParameterTypeDescription
selectFnPoolSelectorFn<TItem>Custom synchronous selector function.
Returns ​

PoolBuilder<TItem>

New immutable pool builder.

Call Signature ​

ts
strategy(strategyInput): PoolBuilder<TItem>;

Defined in: builders/pool-builder.ts:71

Configures the pool's selection strategy via a built-in strategy name, custom selector function, strategy node, or fluent configurator callback.

Defaults to 'round-robin' when .strategy(...) is not explicitly called.

Parameters ​
ParameterTypeDescription
strategyInput| "soonest-reset" | "round-robin" | "least-used" | PoolStrategyNode<TItem> | PoolSelectorFn<TItem> | (($) => MaybeBuilder<PoolStrategyNode<TItem>>)Strategy specification.
Returns ​

PoolBuilder<TItem>

New immutable pool builder.


toAST() ​

ts
toAST(): PoolNode;

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 ​

PoolNode

Deeply frozen passive AST node.

Inherited from ​

AstBuilder.toAST


with() ​

ts
with<TNextItem>(...items): PoolBuilder<TNextItem>;

Defined in: builders/pool-builder.ts:33

Populates the pool with candidate items (AccountSeatASTNode or ModelASTNode).

Replaces the candidate list and narrows the pool's item type parameter to TNextItem.

Type Parameters ​

Type ParameterDescription
TNextItem extends ASTNodeCandidate AST node type.

Parameters ​

ParameterTypeDescription
...itemsreadonly MaybeBuilder<TNextItem>[]Candidate AST nodes or builders.

Returns ​

PoolBuilder<TNextItem>

New immutable pool builder typed to TNextItem.

Properties ​

PropertyModifierTypeDescriptionDefined in
idreadonlystringUnique identifier of the pool.builders/pool-builder.ts:20

Released under the MIT License.