footprintjs - v11.2.0
    Preparing search index...

    Class DeciderList<TOut, TScope>

    Fluent helper returned by addDeciderFunction to add branches. end() sets deciderFn = true — the fn IS the decider.

    Type Parameters

    • TOut = any
    • TScope = any
    Index
    • Parameters

      • id: string
      • name: string
      • Optionalfn: StageHandler<TOut, TScope>
      • Optionaldescription: string
      • Optionaloptions: {
            loopTo?: string;
            retry?: RetryPolicy;
            tags?: readonly string[];
            touches?: StageTouches;
        }

        { loopTo } declares this branch loops back to an already-declared stage — the loop is SOURCED FROM THIS BRANCH (not the decider). { retry } gives THIS BRANCH's stage a declarative retry policy; { tags } puts declared tags on it (see FlowChartBuilder.tag).

      Returns DeciderList<TOut, TScope>

    • Add a pausable stage as a decider branch.

      When this branch is chosen, the handler's execute runs. If it returns data, the pipeline pauses. On resume, handler.resume runs with the human's input. If execute returns void, the stage continues normally (conditional pause).

      Parameters

      • id: string
      • name: string
      • handler: PausableHandler<TScope>
      • Optionaldescription: string
      • Optionaloptions: {
            loopTo?: string;
            retry?: RetryPolicy;
            tags?: readonly string[];
            touches?: StageTouches;
        }

        { loopTo } declares this branch loops back to an already-declared stage — the loop is SOURCED FROM THIS BRANCH (not the decider). { retry } gives THIS BRANCH's execute half a retry policy (the resume half runs without it — a different function, a different contract); { tags } puts declared tags on it.

      Returns DeciderList<TOut, TScope>

    • Attach a loop-back edge to the LAST-added branch, so the loop is sourced from THAT branch node (e.g. 'tool-calls' → loopTo('context')) rather than from the decider. The chart then reads honestly: the decider splits into a looping branch [ToolCalls → back to Context] and a terminating branch [Final → end], instead of a single loop hanging off the decider.

      No engine change is needed: the runtime runs the chosen branch and then follows that branch node's OWN next — and a next flagged isLoopRef routes back to the target exactly like the decider's own loop does. This method just lets the builder express what the engine already supports.

      Targets the branch added immediately before this call (chain it right after the branch's addFunctionBranch/addPausableFunctionBranch/ addSubFlowChartBranch). Mirrors FlowChartBuilder.loopTo validation.

      Works on a SUBFLOW branch too: the branch node carries both its subflow resolver AND the loop-back next — they coexist safely (the runtime runs the subflow, then follows the loop ref). The target must be a stage already declared BEFORE the decider (e.g. an upstream context); branch ids and the synthetic 'default' clone are NOT valid loop targets.

      Parameters

      • stageId: string

      Returns DeciderList<TOut, TScope>