Skip to content
1 min read · 204 words

Function: planRead()

ts
function planRead(
  store: PlanStore,
  planId: string,
  sel:
    | {
        phase: string;
      }
    | {
        node: string;
      },
): Promise<PlanSlice>;

Defined in: src/batteries/orchestration/outline.ts:117

Read a self-locating slice of a plan by the exact identifier the outline printed.

Parameters

ParameterTypeDescription
storePlanStorethe plan store to read from.
planIdstringthe id of the plan to read.
sel| { phase: string; } | { node: string; }the selection: { phase } to read a whole phase, or { node } to read the slice around a single node.

Returns

Promise<PlanSlice>

the self-locating slice of the plan.

Remarks

The selection is either a phase name ({ phase }) or a node id ({ node }) — the SAME identifiers the outline printed, never line numbers. The returned slice carries its phase and the immediate predecessors/successors of the slice as a whole (boundary), so a model can keep linking new nodes without re-fetching the outline.

Scoped reading is available, not mandatory: a small plan should be read whole, and the outline hop is not compulsory.

Throws

if the phase or node id is unknown, naming the valid set — never an empty slice.