footprintjs - v11.2.0
    Preparing search index...

    Interface IControlFlowNarrative

    interface IControlFlowNarrative {
        getSentences(): string[];
        onAttempt(
            stageName: string,
            stageId: string,
            record: AttemptRecord,
            structuredError: StructuredErrorInfo | undefined,
            traversalContext?: TraversalContext,
        ): void;
        onBreak(
            stageName: string,
            traversalContext?: TraversalContext,
            reason?: string,
            propagatedFromSubflow?: string,
        ): void;
        onDecision(
            deciderName: string,
            chosenBranch: string,
            rationale?: string,
            deciderDescription?: string,
            traversalContext?: TraversalContext,
            evidence?: DecisionEvidence,
        ): void;
        onError(
            stageName: string,
            errorMessage: string,
            structuredError: StructuredErrorInfo,
            traversalContext?: TraversalContext,
        ): void;
        onFork(
            parentStage: string,
            childNames: string[],
            traversalContext?: TraversalContext,
        ): void;
        onLoop(
            targetStage: string,
            iteration: number,
            description?: string,
            traversalContext?: TraversalContext,
        ): void;
        onNext(
            fromStage: string,
            toStage: string,
            description?: string,
            traversalContext?: TraversalContext,
        ): void;
        onPause(
            stageName: string,
            stageId: string,
            pauseData: unknown,
            subflowPath: readonly string[],
            traversalContext?: TraversalContext,
        ): void;
        onResume(
            stageName: string,
            stageId: string,
            hasInput: boolean,
            traversalContext?: TraversalContext,
        ): void;
        onRunEnd(output: unknown, traversalContext?: TraversalContext): void;
        onRunFailed(
            error: StructuredErrorInfo,
            traversalContext?: TraversalContext,
            failure?: TerminalFailureContext,
        ): void;
        onRunStart(input: unknown, traversalContext?: TraversalContext): void;
        onSelected(
            parentStage: string,
            selectedNames: string[],
            totalCount: number,
            traversalContext?: TraversalContext,
            evidence?: SelectionEvidence,
        ): void;
        onStageExecuted(
            stageName: string,
            description: string | undefined,
            traversalContext: TraversalContext | undefined,
            stageType: StageType,
        ): void;
        onStageRetry(
            stageName: string,
            stageId: string,
            attempt: number,
            maxAttempts: number,
            delayMs: number,
            structuredError: StructuredErrorInfo,
            traversalContext?: TraversalContext,
        ): void;
        onSubflowEntry(
            subflowName: string,
            subflowId?: string,
            description?: string,
            traversalContext?: TraversalContext,
            mappedInput?: Record<string, unknown>,
        ): void;
        onSubflowExit(
            subflowName: string,
            subflowId?: string,
            traversalContext?: TraversalContext,
            outputState?: Record<string, unknown>,
        ): void;
        onSubflowRegistered(
            subflowId: string,
            name: string,
            description?: string,
            specStructure?: unknown,
        ): void;
        onThrottled?(
            stageName: string,
            stageId: string,
            structuredError: StructuredErrorInfo,
            traversalContext?: TraversalContext,
        ): void;
    }

    Implemented by

    Index
    • Called at the END of every attempt (10.1) — every outcome, with the attempt's AttemptRecord (timing, outcome, category, the retry-or-stop decision): a stage's own (record.kind === 'stage', under a retry policy, a timeoutMs or a run deadline), and the calls it makes ('call', scope.$call) and outside attempts it reports ('observed') during the stage (P2). A stage attempt fires before onStageRetry when it is retried, and before onError / onStageExecuted for the last. structuredError is the attempt's served error (raw included unless the policy masked it; never for an observed attempt); absent for a success or a pause.

      Event arithmetic: one per attempt — for a stage, the number of attempts it made plus one per call or observed attempt (filter on record.kind).

      Parameters

      Returns void

    • Called when a stage triggers break (early termination).

      Parameters

      • stageName: string
      • OptionaltraversalContext: TraversalContext
      • Optionalreason: string

        Optional string passed to scope.$break(reason).

      • OptionalpropagatedFromSubflow: string

        When set, this break was raised on the parent because an inner subflow (this id) broke with propagateBreak enabled. Used by recorders to distinguish originating vs propagated breaks and render them accordingly.

      Returns void

    • Called when a decider selects a branch. Most valuable for LLM context.

      Parameters

      • deciderName: string
      • chosenBranch: string
      • Optionalrationale: string
      • OptionaldeciderDescription: string
      • OptionaltraversalContext: TraversalContext
      • Optionalevidence: DecisionEvidence

      Returns void

    • Called when a stage throws an error, with its SERVED form: for a stage's own failure that is RedactionRule.retainStageError (the diagnostic policy applied once), elsewhere extractErrorInfo.

      Parameters

      Returns void

    • Called when a fork executes all children in parallel.

      Parameters

      • parentStage: string
      • childNames: string[]
      • OptionaltraversalContext: TraversalContext

      Returns void

    • Called on loop iteration (back-edge traversal).

      Parameters

      • targetStage: string
      • iteration: number
      • Optionaldescription: string
      • OptionaltraversalContext: TraversalContext

      Returns void

    • Called on linear continuation from one stage to the next.

      Parameters

      • fromStage: string
      • toStage: string
      • Optionaldescription: string
      • OptionaltraversalContext: TraversalContext

      Returns void

    • Called when a pausable stage pauses execution.

      Parameters

      • stageName: string
      • stageId: string
      • pauseData: unknown
      • subflowPath: readonly string[]
      • OptionaltraversalContext: TraversalContext

      Returns void

    • Called when a paused stage is resumed.

      Parameters

      • stageName: string
      • stageId: string
      • hasInput: boolean
      • OptionaltraversalContext: TraversalContext

      Returns void

    • Called once per top-level executor.run(), AFTER the last stage commits. output is the retained form of the chart's return. NOT fired on pause (the run didn't end; it suspended) or on uncaught error. Subflow-traversers do NOT fire this event — they fire onSubflowExit.

      Parameters

      Returns void

    • Called once per top-level executor.run() when traversal throws a NON-pause error, BEFORE the exception propagates to run()'s caller.

      This is the TERMINAL counterpart to onRunEnd — it closes the run boundary symmetrically so every onRunStart is followed by exactly one of onRunEnd (clean) or onRunFailed (error). Without it, a live monitor sees onRunStart then silence on a failed run and can't tell "still running" from "crashed."

      Errors STILL throw — this is the observable terminal signal, not a recovery mechanism (no routing, no error-subflow). Pause is NOT an error, so it does not fire this. Subflow-traversers do NOT fire it; their errors propagate to the parent and surface at the top level.

      Parameters

      Returns void

    • Called once per top-level executor.run(), BEFORE the first stage executes. input is the retained form of run({input}) after schema validation; the run's key/path redaction applies before dispatch. See FlowRunEvent. Subflow-traversers do NOT fire this event — they fire onSubflowEntry.

      Parameters

      Returns void

    • Called when a stage completes its main work. Fires for ALL stage kinds ('linear', 'decider', 'fork', 'selector', 'subflow-mount') AFTER the corresponding specialized event (onDecision, onFork, onSelected, onSubflowEntry). For linear stages, fires after the stage function returns.

      Consumers tracking "did this stage run?" use this event uniformly and switch on stageType for kind-specific work.

      Parameters

      • stageName: string
      • description: string | undefined
      • traversalContext: TraversalContext | undefined
      • stageType: StageType

      Returns void

    • Called when an attempt at a stage with a declared retry policy failed AND another attempt will run. Fires after that attempt's onAttempt, after its staged writes are discarded and BEFORE the backoff wait, so a live monitor learns "retrying in 500 ms" when the decision is made, not after the wait.

      Event arithmetic: an exhausted policy fires attempts - 1 of these and then one onError; a retryOn that declines fires ZERO of these and one onError. The final attempt never fires this event.

      Parameters

      Returns void

    • Called when entering a subflow (nested context boundary).

      Parameters

      • subflowName: string
      • OptionalsubflowId: string
      • Optionaldescription: string
      • OptionaltraversalContext: TraversalContext
      • OptionalmappedInput: Record<string, unknown>

      Returns void

    • Called when exiting a subflow.

      Parameters

      • subflowName: string
      • OptionalsubflowId: string
      • OptionaltraversalContext: TraversalContext
      • OptionaloutputState: Record<string, unknown>

      Returns void

    • Called when a dynamic subflow is registered during traversal.

      Parameters

      • subflowId: string
      • name: string
      • Optionaldescription: string
      • OptionalspecStructure: unknown

      Returns void

    • Called when a fork child failed and the run's throttlingErrorChecker classified its error as throttling (9.39.0). The child's failure takes its ordinary path too; this only names it as throttling.

      Parameters

      Returns void