/** * Router: pick which {@link Reasoner} handles an utterance. * * The default policy is `rule-first`: run the rule reasoner; if its plan is * confident enough (at or above the threshold) or no other reasoner is registered, * keep it; otherwise escalate to the highest-scoring other reasoner (an LLM, when * one is added in P4). With only the rule reasoner present this degrades cleanly to * rule-only, which is the no-LLM default. * * @see plans/ai-reasoning-layer-spec.md (section 4.8) */ import type { GridContext } from './context.js'; import type { Reasoner } from './reasoner.js'; import type { Plan } from './types.js'; export type RoutingPolicy = 'rule-only' | 'llm-only' | 'rule-first' | 'llm-first' | 'highest-score'; /** Chooses a reasoner and returns its plan. */ export interface Router { route(utterance: string, ctx: GridContext, reasoners: Reasoner[]): Promise; } /** Options for {@link createRouter}. */ export interface RouterOptions { /** Default `'rule-first'`. */ policy?: RoutingPolicy; /** Rule-plan confidence at/above which the router does NOT escalate. Default `0.5`. */ threshold?: number; } /** Create the default {@link Router}. */ export declare function createRouter(options?: RouterOptions): Router;