/** * RouterPromptBuilder — Stage C prompt builder for the split diagnostician pipeline. * * The Router stage receives both Stage A (Root Cause) and Stage B (Distiller) * artifacts and produces the final `DiagnosticianOutputV1` — the unchanged * downstream contract consumed by the rest of the system. * * Unlike the monolithic DiagnosticianPromptBuilder which runs the full 5-phase * protocol, the Router does NOT re-derive root causes or invent new principles. * It routes what the distiller produced into the appropriate recommendation * taxonomy kind(s). * * @see PRI-372 — Split diagnostician into Stage A (Root Cause) + Stage B (Distiller) + Stage C (Router) */ import type { TSchema } from '@sinclair/typebox'; import type { SchemaPromptAdapter } from '../adapter/schema-prompt-adapter.js'; import type { DiagRootCauseOutputV1 } from './diag-rootcause-output.js'; import type { DiagDistillerOutputV1 } from './diag-distiller-output.js'; import type { BuildPromptOptions } from '../diagnostician-prompt-builder.js'; import type { OutputLanguage } from '../language-directive.js'; /** * Options for RouterPromptBuilder constructor and buildRouterInstruction(). * * Uses opts-object pattern to stay within max-params limit and allow * partial overrides at both construction and method-call time. * * @see PRI-372 */ export interface RouterPromptBuilderOptions { /** Schema prompt adapter (default: DefaultSchemaPromptAdapter) */ adapter?: SchemaPromptAdapter; /** TypeBox schema for output validation (default: DiagnosticianOutputV1Schema) */ schema?: TSchema; /** Output language directive (default: none) */ outputLanguage?: OutputLanguage; } /** * Structured input for the Router stage, carrying both Stage A and Stage B * artifacts with their IDs for lineage tracing. * * @see PRI-372 */ export interface RouterContextInput { /** Artifact ID of the Stage A (Root Cause) output */ rootCauseArtifactId: string; /** Stage A output — the root cause analysis result */ rootCauseOutput: DiagRootCauseOutputV1; /** Artifact ID of the Stage B (Distiller) output */ distillerArtifactId: string; /** Stage B output — the distilled principle and grounding */ distillerOutput: DiagDistillerOutputV1; } /** * Prompt input for the Router stage — the JSON message sent to the LLM. * * Unlike the monolithic DiagnosticianPromptBuilder's PromptInput, the router * carries Stage A and Stage B artifacts directly rather than a full * DiagnosticianContextPayload with conversation window and source refs. * * @see PRI-372 */ export interface RouterPromptInput { /** Task being diagnosed — from Stage A output */ taskId: string; /** Artifact ID of the Stage A (Root Cause) output for lineage */ rootCauseArtifactId: string; /** Stage A output — root cause analysis result */ rootCauseOutput: DiagRootCauseOutputV1; /** Artifact ID of the Stage B (Distiller) output for lineage */ distillerArtifactId: string; /** Stage B output — distilled principle and grounding */ distillerOutput: DiagDistillerOutputV1; } /** * Build result for the Router stage — follows the same pattern as PromptBuildResult. * * @see PRI-372 */ export interface RouterPromptBuildResult { /** JSON string — the exact value to pass as openclaw agent --message argument */ readonly message: string; /** The RouterPromptInput object that was serialized to JSON */ readonly promptInput: RouterPromptInput; /** * PRI-633: base-layer system prompt (role + routing protocol). Previously * embedded in the payload as `routerInstruction`; now delivered via the * system channel by the runtime adapter. */ readonly systemPrompt: string; } /** * Prompt builder for Stage C (Router) of the split diagnostician pipeline. * * The Router takes the root cause from Stage A and the distilled principle * from Stage B, then decides the concrete carrier(s) — the recommendation * taxonomy kind(s) — and assembles the final `DiagnosticianOutputV1`. * * Key constraint: the Router MUST NOT re-derive the root cause or invent * new principles. It routes what the distiller produced. * * @see PRI-372 */ export declare class RouterPromptBuilder { private readonly adapter; private readonly schema; constructor(opts?: RouterPromptBuilderOptions); /** * Build the router instruction string — the system-level directive that * tells the LLM its role, input format, routing rules, output requirements, * and constraints. * * @param opts - Optional overrides for adapter, schema, and outputLanguage. * When provided, these override the constructor defaults for this call only. * @returns The router instruction string. * * @see PRI-372 */ buildRouterInstruction(opts?: RouterPromptBuilderOptions): string; /** * Build the full prompt for the Router stage, combining the router * instruction with the structured Stage A + Stage B context. * * @param context - Structured input carrying Stage A and Stage B artifacts. * @param opts - Build options including outputLanguage. * @returns RouterPromptBuildResult with JSON message and RouterPromptInput object. * * @see PRI-372 */ buildPrompt(context: RouterContextInput, opts?: BuildPromptOptions): RouterPromptBuildResult; } //# sourceMappingURL=router-prompt-builder.d.ts.map