/** * DreamerPromptBuilder — transforms Dreamer context into a prompt for the LLM. * * PRI-107: The Dreamer runner previously sent only `{ taskId, contextHash }` as * inputPayload, giving the LLM no instructions about what to produce. This builder * follows the DiagnosticianPromptBuilder pattern: it packages context data + an * explicit instruction telling the LLM to produce DreamerOutputV1 JSON. * * ## Contract * * buildPrompt() takes DreamerPromptBuilderInput and returns a build result * whose `message` is the JSON string to be passed as `inputPayload` in * StartRunInput, and whose `systemPrompt` is the base-layer system prompt * (role + protocol) to pass via `StartRunInput.systemPrompt` (PRI-633). * * ## Constraints * * - Message payload is ONLY task data (JSON) — no markdown, no file ops, no tool calls * - Role/protocol instructions travel as the base systemPrompt layer, NOT in * the user payload (PRI-633); the profile's configured systemPrompt remains * the append layer owned by the agent profile (DPB-07, as revised by PRI-633) * - buildPrompt() is a pure function — no DB calls, no side effects */ import type { CoreAxiomBlockOptions } from '../core-principles/core-axiom-block.js'; import type { OutputLanguage } from '../language-directive.js'; export interface DreamerPromptBuilderInput { taskId: string; contextHash: string; contextRefs: readonly string[]; predecessorOutput: unknown; /** Inject core axiom grounding section (default: false). */ coreGrounding?: boolean; /** Output language for bilingual principle statements. */ outputLanguage?: OutputLanguage; } export interface DreamerPromptInput { taskId: string; contextHash: string; contextRefs: readonly string[]; predecessorOutput: unknown; } export interface DreamerPromptBuildResult { readonly message: string; readonly promptInput: DreamerPromptInput; /** * PRI-633: base-layer system prompt (role + protocol). Previously embedded * in the payload as `dreamerInstruction`; now delivered via the system * channel by the runtime adapter. */ readonly systemPrompt: string; } /** * Build the Dreamer protocol instruction with optional core axiom grounding. * * When `coreGrounding` is true, a CORE AXIOMS section is injected so the * Dreamer can correctly reference existing principles via sourcePrincipleId. * * PRI-714 (review fix): when `outputLanguage` is provided, a language * directive is appended so the CANDIDATE OUTPUT (not just the axiom block) * follows the owner's language — badDecision/betterDecision/rationale/ * strategicPerspective are the human-readable fields (riskLevel stays an * English enum; lineage/IDs stay untranslated). Undefined = no directive * (byte-identical to the pre-PRI-714 instruction). */ export declare function buildDreamerProtocolInstruction(opts?: CoreAxiomBlockOptions): string; export declare class DreamerPromptBuilder { private readonly coreGrounding; private readonly outputLanguage?; constructor(opts?: { coreGrounding?: boolean; outputLanguage?: OutputLanguage; }); buildPrompt(input: DreamerPromptBuilderInput): DreamerPromptBuildResult; } //# sourceMappingURL=dreamer-prompt-builder.d.ts.map