Skip to content

Interface: InterruptEdgeBuilder<TIn, TPayload, THandle, TCustomMetrics, TAbortMeta> ​

Defined in: builders/interrupt-edge-builder.ts:132

Fluent builder for an .onInterrupt(interrupt, $intr => ...) resolution edge on a flow step or actor.

Supports three mutually exclusive resolution modes: automated adjudication (.adjudicateWith(...)), bidirectional human approval (.ask(...)), and abort-plus-replacement (.onAbort(...).replaceWith(...)).

Extends ​

Type Parameters ​

Type ParameterDefault typeDescription
TInunknownEnclosing step or actor input payload type.
TPayloadunknownValidated interrupt payload type.
THandleunknownRuntime handle type of the active isolation scope.
TCustomMetrics extends Record<string, unknown>Record<string, unknown>Custom step telemetry metrics type.
TAbortMeta extends Record<string, unknown>Record<string, unknown>Structured abort hook metadata type.

Methods ​

adjudicateWith() ​

ts
adjudicateWith<TAdjIn, TVerdict>(adjudicator, mapInput): AdjudicateInterruptBuilder<TIn, TPayload, THandle, TVerdict, TAdjIn>;

Defined in: builders/interrupt-edge-builder.ts:152

Routes the interrupt to an automated adjudicator step (AgentNode, LoopNode, or CommandNode).

Parks the interrupted actor while running adjudicator with mapInput(input, payload).

Type Parameters ​

Type ParameterDescription
TAdjInAdjudicator input payload type.
TVerdictAdjudicator output verdict type.

Parameters ​

ParameterTypeDescription
adjudicatorMaybeBuilder<StepASTNode<TAdjIn, TVerdict, THandle>>Adjudicator step AST node or builder.
mapInput(input, payload) => TAdjInInput mapper for the adjudicator.

Returns ​

AdjudicateInterruptBuilder<TIn, TPayload, THandle, TVerdict, TAdjIn>

Fluent adjudicate interrupt builder.


ask() ​

ts
ask<TDecision, TMode>(human, responseSchema): AskInterruptBuilder<TPayload, TDecision>;

Defined in: builders/interrupt-edge-builder.ts:170

Routes the interrupt to a bidirectional human authority and validates the response with responseSchema.

Rejects 'notify-only' human channels at .ask() builder call time.

Type Parameters ​

Type ParameterDefault typeDescription
TDecision-Validated human decision response type.
TMode extends "bidirectional" | "notify-only""bidirectional" | "notify-only"Human channel interaction mode ('bidirectional' | 'notify-only').

Parameters ​

ParameterTypeDescription
humanMaybeBuilder<HumanNode<TMode>>Bidirectional HumanNode or builder.
responseSchemaZodType<TDecision>Zod schema validating the human decision.

Returns ​

AskInterruptBuilder<TPayload, TDecision>

Fluent ask interrupt builder.


onAbort() ​

ts
onAbort<THook>(abortHook): InterruptEdgeBuilder<TIn, TPayload, THandle, TCustomMetrics, ExtractAbortMeta<THook>>;

Defined in: builders/interrupt-edge-builder.ts:186

Binds an explicit abort hook (git.snapshotAndReset()) executed before .replaceWith(...) starts the replacement step.

Narrows TAbortMeta to ExtractAbortMeta<THook> so telemetry.abortMeta is strongly typed in mapReplacementInput.

Type Parameters ​

Type ParameterDescription
THook extends GitSnapshotAndResetNodeAbort hook AST node type.

Parameters ​

ParameterTypeDescription
abortHookMaybeBuilder<THook>Abort hook AST node or builder.

Returns ​

InterruptEdgeBuilder<TIn, TPayload, THandle, TCustomMetrics, ExtractAbortMeta<THook>>

New immutable interrupt edge builder.


replaceWith() ​

ts
replaceWith<TRepIn, TRepOut>(replacementExecutable, mapReplacementInput): AstBuilder<ReplaceInterruptHandlerNode<TIn, TPayload, THandle>>;

Defined in: builders/interrupt-edge-builder.ts:203

Aborts the interrupted actor and replaces it with replacementExecutable.

Passes (input, payload, telemetry) to mapReplacementInput to construct the replacement step's input.

Type Parameters ​

Type ParameterDefault typeDescription
TRepIn-Replacement executable input payload type.
TRepOutunknownReplacement executable output payload type.

Parameters ​

ParameterTypeDescription
replacementExecutableMaybeBuilder<StepASTNode<TRepIn, TRepOut, THandle>>Replacement step AST node or builder.
mapReplacementInput(input, payload, telemetry) => TRepInReplacement input projector.

Returns ​

AstBuilder<ReplaceInterruptHandlerNode<TIn, TPayload, THandle>>

Completed replace interrupt handler builder.


toAST() ​

ts
toAST(): InterruptHandlerNode;

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 ​

InterruptHandlerNode

Deeply frozen passive AST node.

Inherited from ​

AstBuilder.toAST

Released under the MIT License.