/** * Language directive for principle generation prompts (PRI-336). * * Generates a prompt instruction telling the LLM to produce human-readable * principle fields in the owner's preferred language, while keeping technical * identifiers untranslated. * * ## Source of truth * * The canonical `outputLanguage` value comes from `.pd/config.yaml` * (`principles.outputLanguage`), read by `getPrinciplesOutputLanguage()` * in the pd-console config store. This module is pure logic — it receives * the resolved value as a parameter and never reads config directly. * * ## What is translated * * - `title`, `statement`, `rationale`, `applicability`, `antiPatterns` * (human-readable principle fields) * - `description` in diagnostician recommendations * * ## What is NOT translated * * - Technical identifiers: `taskId`, `sourcePainId`, `sourceTaskId`, * `sourceRunIds`, artifact IDs, run IDs * - File names, function names, class names, module paths * - Error codes, CLI commands, PR numbers * - Lineage and evidence fields * - Structured output schema field names (JSON keys) */ /** Valid output language values, matching pd-console config. */ export declare const VALID_OUTPUT_LANGUAGES: readonly ['zh-CN', 'en']; export type OutputLanguage = (typeof VALID_OUTPUT_LANGUAGES)[number]; /** Default output language when not configured. */ export declare const DEFAULT_OUTPUT_LANGUAGE: OutputLanguage; /** * Runtime-validated output language with optional degradation warning. * * Per ERR-002/ERR-009: malformed config must produce a structured warning, * not a silent fallback. */ export interface ResolvedOutputLanguage { /** The effective output language to use. */ readonly outputLanguage: OutputLanguage; /** * Warning when the provided value was invalid and a default was used. * Absent when the value was valid or not provided (legitimate default). * Present when the value was malformed (ERR-009: fail loud). */ readonly degradationWarning?: string; } /** * Runtime type guard for OutputLanguage. * Per ERR-001: No `as` casts on untrusted values. */ export declare function isValidOutputLanguage(value: unknown): value is OutputLanguage; /** * Validate and resolve an outputLanguage value from config. * * Per ERR-001: No `as` casts — use runtime type guard. * Per ERR-002: Degradation must include a reason. * Per ERR-009: Malformed values must fail loud with reason + nextAction. * * @param raw - The raw value from config (unknown at boundary). * @returns ResolvedOutputLanguage with effective value and optional warning. */ export declare function resolveOutputLanguage(raw: unknown): ResolvedOutputLanguage; /** * Build a language directive string for inclusion in a generation prompt. * * This directive tells the LLM: * 1. Which language to use for human-readable output fields * 2. Which fields must NOT be translated (technical identifiers, lineage) * * Returns empty string when `outputLanguage` is undefined (no directive). * * PRI-714: `subject` selects the field list named in the directive. The * language, no-translate and JSON-key rules are identical for all subjects; * only the enumerated human-readable field list (and subject-specific echo * rules) change. Each list mirrors the agent's actual output schema: * - 'principle' — scribe (PRI-336 wording, byte-identical when omitted) * - 'dreamer' — dreamer candidates (candidates[].{badDecision, * betterDecision, rationale, strategicPerspective}) * - 'philosopher' — philosopher thesis/principleCandidate/risks * - 'review' — evaluator (explicit nested paths incl. * codeReview.traceCoverage.gaps and * adversarialCases[].rationale; carries the PRI-630 * requirementLedger verbatim-echo rule) * - 'rollout-review' — rollout reviewer (review.* fields) * - 'implementation' — artificer (implementationSummary/risks) * * @param outputLanguage - The resolved output language preference. * When undefined, no directive is generated (backward compatible). * @param subject - Which artifact family the target prompt generates. * Defaults to 'principle' (PRI-336 wording, byte-identical when omitted). */ export type LanguageDirectiveSubject = 'principle' | 'dreamer' | 'philosopher' | 'review' | 'rollout-review' | 'implementation'; export declare function buildLanguageDirective(outputLanguage: OutputLanguage | undefined, subject?: LanguageDirectiveSubject): string; //# sourceMappingURL=language-directive.d.ts.map