export type Provider = import("../types").Provider; export type Step = { /** * - Unique step identifier. */ id: string; /** * - Description of the step to execute. */ action: string; /** * - Ids of steps that must complete first. */ dependsOn: string[]; /** * - Lifecycle status (e.g. 'pending'). */ status: string; }; export type PlannerOptions = { /** * - LLM provider (must implement generate()). */ provider: Provider; /** * - Custom planning prompt override. */ prompt?: string | undefined; /** * - Cache time-to-live in ms. 0 disables caching. */ cacheTTL?: number | undefined; /** * - Budget hook * (mirror of Evaluator's). Forwards the planning call's `usage` to the gate so decomposition spend is * visible — without it the plan call is invisible to bareguard's budget (the RLM Family-B meter gap). A * cache hit does NOT forward (no LLM call happened). */ onLlmResult?: ((payload: { usage: any; model: string | null; kind: "plan"; }) => any) | undefined; }; export class Planner { /** * @param {PlannerOptions} options * @throws {Error} `[Planner] requires a provider` — when options.provider is missing. * @when you need to turn a goal into an ordered step DAG for an LLM to execute — optionally forcing exactly N independent steps for fan-out * @fails throws if constructed without a provider; a plan call's HaltError (governance cap) propagates clean. Plan-call usage forwards via onLlmResult. * @example * const planner = new Planner({ provider }); * const steps = await planner.plan('ship the release', { count: 4 }); * await runPlan(steps, ctx); */ constructor(options?: PlannerOptions); provider: import("../types").Provider; prompt: string; _cacheTTL: number; _cache: Map; onLlmResult: ((payload: { usage: any; model: string | null; kind: "plan"; }) => any) | null; /** * Generate a step DAG from a goal. * @param {string} goal - The user's goal to decompose. * @param {{info?: string, count?: number}} [context={}] - Optional context. `info` is prior * context to factor in. `count` (RLM NB-2 seam): when a positive integer, forces the plan to * exactly that many INDEPENDENT, parallelizable steps (all `dependsOn: []`) instead of the * model's free 2–7 — lets `recurse()` impose the deterministic tier→count for forced fan-out. * @returns {Promise} * @throws {Error} `[Planner] could not parse plan` — when LLM output is not parseable JSON. * @throws {Error} `[Planner] expected JSON array` — when parsed result is not an array. * @throws {Error} `[Planner] step missing id or action` — when a step lacks required fields. */ plan(goal: string, context?: { info?: string; count?: number; }): Promise; clearCache(): void; /** * @param {string} text - Raw LLM output to parse into steps. * @returns {Step[]} */ _parse(text: string): Step[]; }